Skip to main content

Test Apple Pay on iOS devices

Note:
  • Apple Pay feature is currently in Private Beta phase and is supported only on iOS 15 and above devices. Reach out to our Support team to enable this feature for your profile.
  • Please note that 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.

Supported Devices and OS Versions

Supported Devices iOS Version
iPhone 14 16
iPhone 14 Pro 16
iPhone 13 Pro 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.
Capability Description
enableApplePay Set this capability to "true" if you want to test Apple Pay in your test session.
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();
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",
	},
}
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"
Important: 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

  1. 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 Assitive 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\"}}”)
  1. Enter the passcode 123456 to complete the payment when the passcode prompt comes up on the next screen.

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