Skip to main content

Test Apple Pay on iOS devices

Note: Apple Pay feature is currently in the Private Beta phase and supports only iOS 15 and above. Reach out to our Support team to enable the Apple Pay feature for your profile.

The Apple Pay feature in iOS devices enables purchases, one-click payments, and provides additional security for financial transactions. Browserstack Automate enables you to test Apple Pay on remote iOS devices.

In this guide you will learn about:

Supported devices

Supported Devices iOS Version
iPhone 15 and above

Set the Apple Pay capability

Use the capability values enableApplePay for W3C protocol and browserstack.enableApplePay for JSON wire protocol in your test scripts.

Capability Description
enableApplePay Set this capability to "true" if you want to use Apple Pay in the test.
Capability Description
browserstack.enableApplePay Set this capability to "true" if you want to use Apple Pay in the test.

Example:

//Java example
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("osVersion", "16");
browserstackOptions.put("deviceName", "iPhone 14");
browserstackOptions.put("enableApplePay", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"osVersion" : "16",
		"deviceName" : "iPhone 14",
		"enableApplePay" : "true",
	}
}
SafariOptions capabilities = new SafariOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("osVersion", "16");
browserstackOptions.Add("deviceName", "iPhone 14");
browserstackOptions.Add("enableApplePay", "true");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
desired_cap = {
    'bstack:options' : {
        "osVersion" : "16",
        "deviceName" : "iPhone 14",
        "enableApplePay" : "true",
    },
}
capabilities = {
	'bstack:options' => {
		"osVersion" => "16",
		"deviceName" => "iPhone 14",
		"enableApplePay" => "true",
	},
}
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
caps.setCapability("os_version", "16");
caps.setCapability("device", "iPhone 14");
desiredCapabilities.setCapability("browserstack.enableApplePay","true");
var capabilities = {
    "os_version" : "16",
    "device" : "iPhone 14",
    "browserstack.enableApplePay" : "true",
}
SafariOptions capability = new SafariOptions();
capability.AddAdditionalCapability("os_version", "16");
capability.AddAdditionalCapability("device", "iPhone 14");
capability.AddAdditionalCapability("browserstack.enableApplePay", "true");
desired_cap = {
    "os_version" : "16",
    "device" : "iPhone 14",
    "browserstack.enableApplePay" : "true"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["os_version"] = "16"
caps["device"] = "iPhone 14"
caps["browserstack.enableApplePay"] = "true"

Apple Pay test flow

Your test script must be modified with these custom executors along with the logic to select the UI elements in the webapp that triggers the Apple Pay payment, in the following order.

  1. Trigger the payment workflow that uses Apple Pay as the payment method using your framework specific commands.
  2. After initiating the payment flow from your automation, use the following Javascript executor to confirm the transaction.
      driver.execute_script("browserstack_executor:{
     \"action\":\"applePay\", 
     \"arguments\": {
       \"confirmPayment\" : \"true\"
       }
     });
    
  3. Enter the passcode 123456 to complete the payment.
      driver.getKeyboard().sendKeys("123456");
    

Limitations with Apple Pay

On Browserstack remote iOS devices, testing with Apple Pay is limited to the following geographies:

Geography Country
North America United States, Canada
Europe France, Ireland, Italy, Spain, United Kingdom
Asia China Mainland, Hong Kong, Taiwan, Japan, Russia, Singapore
Australia Australia, New Zealand

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert