Test Apple Pay on Private Devices
Learn how to test Apple Pay in your app on Private Devices using BrowserStack App Automate.
Apple Pay testing allows you to validate one-click payments and purchase flows securely within your test suite.
Prerequisites
Before you begin, please ensure your setup meets the following requirements. You may need to contact your Customer Engineer (CE) for assistance.
-
You must have access to devices with Apple Pay enabled.
-
iOS entitlements must be preserved for developer or enterprise-signed apps.
-
Supported App configuration:
- Your app must be signed using the developer (for app testing) or enterprise signed certificates.
- Your app must have the Apple Pay entitlement added as a dependency.
- In addition, you must add your device UDID to the developer signed certificates for Private Devices.
Supported devices and OS versions:
Supported Devices | iOS Version |
---|---|
iPhone 16 | 18 |
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 | 15 |
iPhone XR | 15 |
Benefits of using Apple Pay on Private Devices
You can use Apple Pay on private devices to support a variety of advanced testing needs. Here are some of the common use cases:
-
Test with production or custom cards:
You can manually set up the Apple Pay process on your private devices to add and test with production cards or cards from your own custom sandbox environment. -
Meet security and compliance requirements:
You get a fully isolated environment for running your tests securely, which is not possible on public cloud. -
Perform advanced, end-to-end testing:
You can use private device features like UDID targeting and app persistence to validate your complete app experience. This is essential when Apple Pay is deeply integrated into your app and testing the payment flow in isolation isn’t enough. -
Test developer-signed apps:
On public cloud, apps are resigned, which can cause them to lose the necessary entitlements for Apple Pay to function. With private devices, your app is not resigned, allowing you to test your developer-signed app without any issues.
Enable Apple Pay in your test script
You can enable Apple Pay in your test sessions using either capabilities in your test script or through the REST API when uploading your app.
Method 1: Using capabilities (for Appium)
To enable Private Devices, ensure to set dedicatedDevice: true
in your browserstack.yml
file.
If you’re using Appium, you can enable Apple Pay by setting the browserstack.enableApplePay
capability to true
in your test script.
BrowserStack uses sandboxed cards provided by Apple for Apple Pay testing. These cards may occasionally fail due to card network instability or limitations.
To improve test stability, you can use the applePayPreferredNetworks
capability to specify your preferred payment networks. BrowserStack automatically selects the most stable cards from your preferred networks and adds them to the test session.
This capability is optional, and if not specified, BrowserStack will use a default set of networks.
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 use Apple Pay in the test. |
applePayPreferredNetworks |
Set this capability if you want to set preferred payment networks for Apple Pay to improve stability. For example, ["Visa", "Mastercard"] .This capability is optional. |
nativeWebTap |
Set this capability to "true" if you are unable to get Apple Pay payment screen after clicking the Apple Pay button. |
Example
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 use Apple Pay in the test. |
applePayPreferredNetworks |
Set this capability if you want to set preferred payment networks for Apple Pay to improve stability. For example, ["Visa", "Mastercard"] .This capability is optional. |
nativeWebTap |
Set this capability to "true" if you are unable to get Apple Pay payment screen after clicking the Apple Pay button. |
Example
Capability | Description |
---|---|
browserstack.enableApplePay |
Set this capability to "true" if you want to use Apple Pay in the test. |
browserstack.applePayPreferredNetworks |
Set this capability if you want to set preferred payment networks for Apple Pay to improve stability. For example, ["Visa", "Mastercard"] .This capability is optional. |
browserstack.nativeWebTap |
Set this capability to "true" if you are unable to get Apple Pay payment screen after clicking the Apple Pay button. |
Example
To test payment flows using a JavaScript executor, refer to the testing using JavaScript Executor documentation.
Method 2: Using the REST API (XCUITest)
For XCUITest frameworks, set the enableApplePay
parameter to true
in your build creation REST API request.
When you set this parameter, BrowserStack automatically performs the following actions on the device before your session starts:
- Sets a passcode on the device.
- Adds a sample card to the Wallet app for testing payments.
- Enables Assistive Touch.
- Adds Apple Pay to the Assistive Touch menu.
The following REST API requests show how to enable Apple Pay.
Upon passing this parameter, the following actions are completed on the device before starting your 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.
Add Apple Pay details
To pre-fill shipping, billing, or contact information, use the applePayDetails
parameter in your REST API request.
When providing these details, make sure you follow these rules:
- Include only the applicable address parameters. For example, if your test address doesn’t use a province, remove that key from your JSON.
- For the geographical code, use only one of
postalCode
,postCode
, orzip
, depending on the address format and device region. - The phone number must start with a + followed by the country code (for example,
+1-212-456-7890
or+12124567890
).
Here is an example to include the applePayDetails
parameter:
You need to set the resignApp
parameter 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.
Geographic limitations
Testing for Apple Pay on BrowserStack’s remote iOS devices is currently limited to specific geographic regions.
Geography | Country |
---|---|
North America | United States, Canada |
Europe | France, Ireland, Italy, Spain, United Kingdom, Germany |
Asia | China Mainland, Hong Kong, Taiwan, Japan, Russia, Singapore |
Australia | Australia, New Zealand |
Understanding the test environment
To provide a stable testing experience, the Apple Pay test environment has a specific cleanup process and some setting restrictions.
Session cleanup
After your test session is complete, a cleanup process runs. The behavior depends on your device configuration settings.
-
If you select Retain user data between sessions: Your non-card specific details including the shipping and billing address on card is retained for your next session. All other card details are cleared out.
-
If you select Reset all user data after each session: All card details and non-card-specific details like shipping and billing addresses are cleared.
Device setting restrictions
To ensure the Apple Pay configuration remains stable, BrowserStack restricts certain sections within the device’s Settings app. These restrictions are active during all sessions on the device.
Full sections restricted:
-
Apple Account: Prevents changes to personal info, payment details, and associated devices.
-
Wallet: Prevents modification of the sandbox cards used for testing.
Sub-sections restricted:
-
Accessibility → Touch → AssistiveTouch: The Confirm with AssistiveTouch toggle is locked.
-
Language & Region → Region: The ability to change the region is locked to prevent you from selecting a region that does not support Apple Pay.
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
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!