Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Test Apple Pay with Maestro on BrowserStack

Complete Apple Pay payments in your iOS app during a Maestro test on BrowserStack App Automate.

Apple Pay with Maestro requires the App Automate Device Cloud Pro plan. Otherwise, BrowserStack rejects the build.

On BrowserStack App Automate, you can test Apple Pay payments in your iOS app during a Maestro test on a remote iOS device. BrowserStack prepares the device for Apple Pay before your test starts, and your flow then adds payment details and confirms the payment.

Supported apps

App Automate supports Apple Pay testing for apps signed with an Apple Developer Enterprise Program certificate. Your app must also have the Apple Pay entitlement.

Supported devices and OS versions

Apple Pay with Maestro works on the following devices and iOS versions:

Supported Devices iOS Version
iPhone 17 Pro 26
iPhone Air 26
iPad Pro 11 2025 26
iPhone 16 18
iPhone 15 17
iPhone 14 16
iPhone 14 Pro 16
iPhone 13 Pro Max 15
iPhone 13 Pro 15
iPhone 13 16
iPhone 13 15

Prerequisites

Before you start, make sure you have the following:

  • Your BrowserStack username and access key, available in the Account & Profile section of your dashboard.
  • An iOS app as an .ipa file, signed with an Apple Developer Enterprise Program certificate and with the Apple Pay entitlement.
  • A Maestro test suite zipped inside a single parent folder, as described in Prepare your Maestro test suite.

Run a Maestro test with Apple Pay

Complete the following steps to test an Apple Pay payment during a Maestro test:

Upload your app and test suite

Upload your app and your zipped Maestro test suite, then note the app_url and test_suite_url that each response returns. You need both values to start a build. For the upload commands, see Execute Maestro tests.

Add the BrowserStack executor script to your test suite

Maestro doesn’t use the WebDriver protocol, so Maestro flows have no JavaScript executor of the kind that Appium tests use. BrowserStack provides a script that your flow calls with the runScript command instead. If you already added this script for another scenario, such as biometric authentication, reuse the same file.

At the root of your test suite’s parent folder, create a folder named bstack and save the following script as browserstack_executor.js:

browserstack_executor.js
Copy icon Copy

Your test suite now has the following structure:

sample_parent_folder/
├── bstack/
│   └── browserstack_executor.js
├── flow1.yaml
└── flow2.yaml

Don’t edit browserstack_executor.js. The script reads the values that BrowserStack sets on the test session. Everything that varies between calls comes from the env block in your flow.

Keep the bstack folder inside the parent folder that you zip, alongside your flow files. If the bstack folder sits outside the parent folder, the runScript step can’t resolve the path to the script. For the required layout, see Prepare your Maestro test suite.

Complete the Apple Pay payment from your flow

To complete an Apple Pay payment, your flow runs the following steps in order:

  1. Optional: The prefill_apple_pay_detail action adds shipping, billing, or contact details to the payment.
  2. Your flow opens the screen in your app that starts the Apple Pay payment.
  3. The apple_pay_confirm action confirms the payment through the Apple Pay option in the AssistiveTouch menu. The action stops at Pay with Passcode and doesn’t enter the passcode.
  4. Your flow taps each digit of the device passcode 123456 to complete the payment.
  5. Your flow checks that your app responds to the completed payment.

The passcode prompt is a keypad, not a text field, so inputText doesn’t work. Tap each digit instead. Below iOS 26, tap each digit by its label.

The following flow completes an Apple Pay payment on a checkout screen on a device below iOS 26:

flow1.yaml
Copy icon Copy

On iOS 26, the passcode keypad isn’t in the Maestro view hierarchy, so you can’t tap the digits by label. After the apple_pay_confirm step, wait for the keypad to appear, then tap each digit by its screen position with tapOn: point:. The positions differ between iPhone and iPad. Replace the apple_pay_confirm step and the passcode steps in the previous flow with the steps for your device:

These positions were measured on iPhone 17 Pro with iOS 26.0 in portrait orientation.

flow1.yaml
Copy icon Copy

These positions apply only in portrait orientation. Before you run your flow, check each position against a screenshot of your own device and adjust the position if needed.

The env block of each runScript step sets the following values:

  • BROWSERSTACK_EXECUTOR_ACTION names the action to run. Use prefill_apple_pay_detail to add payment details and apple_pay_confirm to confirm the payment.
  • DATA is a JSON string with the shipping, billing, or contact details. Only the prefill_apple_pay_detail action uses DATA.

Add payment details with the prefill action

If your checkout asks for a shipping address, billing address, or contact details, add a prefill_apple_pay_detail step before the step that opens the payment sheet. The prefill action adds the details through Settings > Wallet and then returns to the home screen, which closes an open payment sheet. Pass the details as a single-line JSON string in the DATA key of the env block. If your checkout doesn’t need these details, leave out the prefill step.

The DATA JSON takes the following objects. Include only the objects that your checkout needs:

Object Description
shippingDetails The shipping address for the payment. Uses the address fields in the next table.
billingDetails The billing address for the payment. Uses the address fields in the next table.
contact The contact details for the payment. Contains email and phone.

The shippingDetails and billingDetails objects take the following fields:

Field Description
firstName First name on the address.
lastName Last name on the address.
street First line of the street address.
addressLine2 Second line of the street address.
city City.
state State.
county County.
province Province.
islandName Island name.
country Country. For example, United States.
postalCode, postCode, or zip Geographical code of the address. Use only one of these fields.

The following JSON shows all three objects. Before you add it to your flow, remove the line breaks so that the JSON fits on one line inside the single quotes of the DATA value:

DATA value
Copy icon Copy

When you add payment details, make sure they meet the following conditions:

  • Include only the address fields that apply to your test address. For example, if your address has no province, remove the province field.
  • For the geographical code in each address, use only one of postalCode, postCode, or zip, based on what your address requires and the device accepts.
  • Start the phone number with the country code and the + character. For example, +1-212-456-7890 or +12124567890.
  • Set every value as a string.
  • Use only the objects and fields listed in the previous tables. An unknown field or invalid JSON fails the prefill step with an invalid-argument error.

Your session may fail if your test addresses don’t have the fields that the device requires. For example, if your test addresses have the zip parameter, but the device requires a different geographical code parameter, the session will fail. In this case, you can re-run the script with either postalCode or postCode and see which geographical code parameter the device accepts.

Adding payment details can take up to five minutes. BrowserStack keeps the session alive during this step.

Run your test with Apple Pay

Set enableApplePay to true and resignApp to false when you start the build. Before your test starts, BrowserStack completes the following actions on the device:

  • Sets a passcode on the device.
  • Adds a sample test card to the Wallet app.
  • Turns on AssistiveTouch.
  • Adds Apple Pay to the AssistiveTouch menu.
Terminal
Copy icon Copy

The following table describes the Apple Pay parameters:

Parameter Type Description
enableApplePay Boolean Set to true to prepare the device for Apple Pay and allow your flow to run Apple Pay actions during the test session. Required for Apple Pay.
resignApp Boolean Set to false so that BrowserStack doesn’t re-sign your Enterprise-signed app. Re-signing removes the Apple Pay entitlement from your app. Required for Apple Pay.
applePayPreferredNetworks Array The payment networks that BrowserStack selects sample test cards from. Accepted values are visa, mastercard, amex, and discover, and they’re case-insensitive. Set up to four networks. For example, ["visa", "mastercard"]. Optional.

If you don’t set resignApp to false, BrowserStack re-signs your app and removes its Apple Pay entitlement, and the payment fails. On iOS 18 and later, resignApp: false also requires enterprise app support on your account. Otherwise, BrowserStack rejects the build. To enable enterprise app support, contact BrowserStack Support. For more information, see Disable re-signing of apps.

BrowserStack uses sandbox cards from Apple for Apple Pay testing. These cards can fail intermittently because of card network issues. To improve stability, set applePayPreferredNetworks to the payment networks you prefer. BrowserStack then adds the most stable cards from those networks to your session. If you don’t set this parameter, BrowserStack uses a default set of networks. If you list more than four networks, BrowserStack trims the extra entries and shows a warning. Duplicate entries also show a warning.

If your flow opens a web checkout with openLink, set maestroVersion to "2.4.0" in the build request. For more information, see Set Maestro version.

Check the result in your logs

Every call to browserstack_executor.js writes a status line to your Maestro logs. A successful call shows a line such as the following:

[EXECUTOR] action=apple_pay_confirm status=200

A failed call adds a reason to the same line and stops the flow. To read these lines, see Maestro logs.

Geographic limitations

BrowserStack supports Apple Pay testing on remote iOS devices only in the following countries:

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

Limitations

Apple Pay with Maestro has the following limitations:

  • Apple Pay works only on iOS devices.
  • On iPad, Apple Pay works only on iOS 26 and later. BrowserStack rejects builds that request an iPad on an earlier iOS version at build start.
  • Your app must be signed with an Apple Developer Enterprise Program certificate and have the Apple Pay entitlement.
  • Apple Pay typically adds two to three minutes to your session start time, and occasionally up to five minutes.
  • Apple Pay is available only in the countries listed in Geographic limitations.
  • A session that doesn’t set enableApplePay rejects every Apple Pay action.

If you have any questions, contact BrowserStack Support.

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 Check Circle