Overview
Apple Pay lets a user pay from your web cashier using the cards stored in their Apple Wallet, authorized with Face or Touch ID. The Push SDK handles presenting the payment sheet and processing the payment data received from Apple after the user authenticates and completes the payment. Your integration is responsible for displaying the Apple Pay button, initializing the SDK, and supplying the resulting token to the Push API to authorize the payment. Apple Pay supports both payment directions. A user can deposit (cash_in) with any card in their Apple Wallet, and later withdraw (cash_out) to a debit card they previously deposited with — no separate account linking required. See Withdrawals for the returning-user cash-out flow.
Integration overview
The steps below show an overview of how to accept an Apple Pay deposit.-
Register the user. Call the create-user endpoint with the user’s name, email, address, and phone number.
- Store the returned Push
idalongside your internal user record. - Register each user only once and reuse the user’s
idon every subsequent transaction.
- Store the returned Push
-
Initialize the Apple Pay launcher. Call the create-user-url endpoint with the user’s
idandtype: "apple_pay"when the user loads the payment page, then initialize the SDK launcher with the returnedurl.- Check
ApplePaySession.canMakePayments()and render the Apple Pay button only when it returnstrue. For styling and placement, follow Apple’s design guidelines and JavaScript guide. - To support non-Apple devices or browsers other than Safari, install the Apple Pay JS SDK on your cashier. Initiating the payment then displays a QR code the user scans with an Apple device to authorize.
- Check
-
Display the payment sheet. When the user clicks the Apple Pay button, call
launcher.display()with the paymentamount,currency,direction, and anonAuthorizecallback. The SDK handles merchant validation and presents the payment sheet.- Optionally pass an
onCompletecallback that runs when the payment sheet is dismissed.
- Optionally pass an
-
Authorize the payment. The
onAuthorizecallback receives atokenonce the user approves with Face ID or Touch ID. Pass thetoken, along with the sameamount,currency, anddirection, to the authorize-payment endpoint from your backend.- Return the resulting status (
approvedordeclined) fromonAuthorizeto complete the Apple Pay session. Theamountandcurrencysent to/authorizemust match the values passed todisplay().
- Return the resulting status (
Sequence Diagram
Sequence Diagram
Launcher and payment sheet
The Push SDK exposes anApplePay launcher. Instantiate it from the url returned by create-user-url when the page loads — not inside the button’s click handler. Apple only allows the payment sheet to be presented from within a user-gesture handler, so display() must run synchronously on the click; the launcher it depends on has to already exist.
Withdrawals
A returning user can withdraw funds to a debit card they previously deposited with via Apple Pay — no re-authentication through the payment sheet is required. Users must have completed at least one deposit through the flow above before a withdrawal credential is available.-
Display stored credentials. Call the list-user-credentials endpoint with the user’s ID, then filter the results for credentials with type
apple_pay_debit— only these can receive a withdrawal. Render them so the user can pick which card to withdraw to.- For
apple_pay_debitcredentials,card_last4is the last four digits of the user’s FPAN (the physical card number), not the device-specific token (DPAN) Apple generates. Displaycard_last4so the user recognizes their card. - Credentials created from a credit card have type
apple_payand cannot receive withdrawals — exclude them from the selection UI.
- For
-
Submit the withdrawal. Call the authorize-payment endpoint with the selected
credential_id,direction: cash_out, and theamount.- A
200response means the withdrawal was approved — display the result to the user. - Handle a
401response. In a small number of cases the debit card does not support OCT (Original Credit Transactions), which are required to push funds to a card. This is determined by the card issuer and cannot be resolved for that card — prompt the user to select or add a different debit card.
- A
Domain registration
Apple Pay on the web requires your cashier to be served over HTTPS on a domain that Apple has verified. Verification is a one-time, manual step per domain (you verify your sandbox and production domains separately), completed together with Push Cash:-
Supply your domain. Give your Push Cash representative the exact domain your cashier is served from (for example,
cashier.your-domain.com). For sandbox, email hello@pushcash.com. -
Receive the domain association file. Push generates and sends you the
apple-developer-merchantid-domain-association.txtfile for that domain over Slack or email. -
Host the file. Place it at:
- Push verifies the domain. Once the file is reachable over HTTPS, Push verifies the domain in the Apple developer console. This must be done by Push — it is not self-serve.
Production domain verification is completed live on your go-live call. See the Go-Live Checklist for the full production cutover.
Sandbox testing
Test the full flow against the sandbox host (sandbox.pushcash.com) before going live. Because Apple Pay cannot run on localhost, deploy your sandbox cashier to a verified HTTPS domain (see Domain registration) to exercise the payment sheet.
In sandbox, simulate a declined authorization by submitting for 2200 cents ($22.00). Any other amount is approved. This applies to both deposit authorizations and withdrawal OCT declines.
Work through the following before requesting production access:
- Simulate an approved deposit by submitting a payment for $10.00
- Simulate a declined deposit by submitting a payment for $22.00
- Create an
apple_pay_debitcredential by depositing with a debit card from your Apple Wallet, verify it is displayed withcard_last4, and test a withdrawal to it - Create an
apple_paycredential by depositing with a credit card, and verify it is not presented for withdrawals - Test an OCT decline by submitting a
cash_outfor2200cents ($22.00) against anapple_pay_debitcredential
Next steps
- Set up webhooks to receive asynchronous updates about payment status — see the enabling webhooks guide.
- Move your integration from sandbox to production with the Go-Live Checklist.