Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy

Test Apple Pay on iOS devices

  • This feature is currently a Private Beta service and available only under Device Cloud Pro, Device Cloud Pro + Visual Cloud, and Enterprise Pro plans. Contact our Support team or Sales team to enable this feature. For more details, check out our pricing page.
  • Setting this feature will lead to an increase in session start-time by 100-180 seconds. Thus, users are expected to use this feature based on their needs.

The Apple Pay feature in iOS devices enables purchases, one-click payments, and provides additional security for financial transactions.
Browserstack App Automate enables you to test Apple Pay as a payment method in your mobile apps on select remote iOS devices.

In this guide you will learn about:

Supported App types

App Automate only supports testing of Apple Pay with mobile apps that are signed using Apple’s Developer Enterprise Program. Also, ensure that your app has Apple Pay entitlement added as a dependency.

Supported Devices and OS Versions

Supported Devices iOS Version
iPhone 15 17
iPhone 14 16
iPhone 14 Pro 16
iPhone 13 Pro Max 15
iPhone 13 Pro 15
iPhone 13 Mini 15
iPhone 13 15
iPhone 11 Pro 15
iPhone 11 15
iPhone XR 15

Enable Apple Pay using a capability

Use the capability values enableApplePay for W3C protocol and browserstack.enableApplePay for JSON wire protocol in your test scripts. Upon passing this capability, the following actions are completed on the device before starting your Appium session:

  • A passcode is set on the device.
  • A sample card for testing payments is added to the Wallet app.
  • Assistive Touch is enabled.
  • Apple Pay is added to the Assistive Touch menu.

If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml file:

Capability Description
enableApplePay Set this capability to "true" if you want to test Apple Pay in your test session.
browserstack.yml
Copy icon Copy snippet

BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

Capability Description
enableApplePay Set this capability to "true" if you want to test Apple Pay in your test session.

Example:

DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("resignApp", "false");
browserstackOptions.put("enableApplePay", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
capabilities.setCapability("platformName", "ios");
capabilities.setCapability("platformVersion", "15");
capabilities.setCapability("deviceName", "iPhone 13 Pro");
var capabilities = {
	"platformName" : "ios",
	"appium:platformVersion" : "15",
	"appium:deviceName" : "iPhone 13 Pro",
	'bstack:options' : {
		"resignApp" : "false",
		"enableApplePay" : "true",
	}
}
AppiumOptions capabilities = new AppiumOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("resignApp", "false");
browserstackOptions.Add("enableApplePay", "true");
capabilities.AddAdditionalCapability("bstack:options", browserstackOptions);
capabilities.AddAdditionalCapability("platformName", "ios");
capabilities.AddAdditionalCapability("platformVersion", "15");
capabilities.AddAdditionalCapability("appium:deviceName", "iPhone 13 Pro");
desired_cap = {
	"platformName" : "ios",
	"platformVersion" : "15",
	"deviceName" : "iPhone 13 Pro",
	'bstack:options' : {
		"resignApp" : "false",
        "enableApplePay" : "true",
	},
}
capabilities = {
	"platformName" => "ios",
	"platformVersion" => "15",
	"deviceName" => "iPhone 13 Pro",
	'bstack:options' => {
		"resignApp" => "false",
		"enableApplePay" => "false",
	},
}
Capability Description
browserstack.enableApplePay Set this capability to "true" if you want to test Apple Pay in your test session.

Example:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("os_version", "15");
capabilities.setCapability("device", "iPhone 13 Pro");
capabilities.setCapability("browserstack.resignApp", "false");
capabilities.setCapability("browserstack.enableApplePay","true");
var capabilities = {
    "os_version" : "15",
    "device" : "iPhone 13 Pro",
    "browserstack.resignApp" : "false",
    "browserstack.enableApplePay" : "true"
}
AppiumOptions capabilities = new AppiumOptions();
capabilities.AddAdditionalCapability("os_version", "15");
capabilities.AddAdditionalCapability("device", "iPhone 13 Pro");
capabilities.AddAdditionalCapability("browserstack.resignApp", "false");
capability.AddAdditionalCapability("browserstack.enableApplePay", "true");
desired_cap = {
    "os_version" : "15",
    "device" : "iPhone 13 Pro",
    "browserstack.resignApp" : "false"
    "browserstack.enableApplePay" : "true"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["os_version"] = "15"
caps["device"] = "iPhone 13 Pro"
caps["browserstack.resignApp"] = "false"
caps["browserstack.enableApplePay"] = "true"

You need to set the browserstack.resignApp capability to false when testing Apple Pay to disable re-signing of Enterprise signed app uploaded on BrowserStack. Checkout Disable re-signing iOS apps documentation for more information.

Confirm Apple Pay payment using Javascript executor

After triggering the payment workflow that uses Apple Pay as the payment method using your framework-specific commands, confirm the payment transaction using the following Javascript executor in your tests. The executor command automates the click on Apple Pay option inside the Assistive Touch menu.

driver.execute_script("browserstack_executor: {\"action\":\"applePay\", 
\"arguments\": {
  \"confirmPayment\" : \"true\"
  }
});
await driver.execute("browserstack_executor: {\"action\":\"applePay\", \"arguments\": { \"confirmPayment\" : \"true\"} }”)
((IJavaScriptExecutor)driver).ExecuteScript("browserstack_executor: {\"action\":\"applePay\", 
\"arguments\": {
  \"confirmPayment\" : \"true\"
  }
});
driver.execute_script("browserstack_executor: {\"action\":\"applePay\", \"arguments\": { \"confirmPayment\" : \"true\"} }”)
driver.execute_script("browserstack_executor: {\"action\:"\"applePay\", \"arguments\": { \"confirmPayment\" : \"true\"}}”)

Users are expected to add shipping address and contact details wherever necessary.

Enter the passcode 123456 to complete the payment when the passcode prompt comes up on the next screen.

Check this page for a list of various JavaScript Executors that BrowserStack offers.

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
Download Copy