Introduction
This guide covers the steps to integrate Apple Pay as a payment option for users. In order to enable Apple Pay, perform the following integration steps- Initialize Push Apple Pay launcher and display button
- Launch payment session and create intent
- Receive confirmation of payment status via webhook
Step 1: Display Apple Pay button
Enable users to select Apple Pay as their payment option by initializing the Push Apple Pay launcher and displaying the Apple Pay button when a user loads the payment page Make a callPOST /token with the user’s ID and type = ‘apple_pay’. A new token must be created each time the user loads the payment page and should not be cached.
If a user has not previously used Push, you must first register them by calling create-user.
The Push SDK can be installed from
https://cdn.pushcash.com/sdk/push.umd.js via a script tag on your payment pageIf you want to support Apple Pay on non-Apple devices (or if you are not using Safari), install the Apple Pay JS SDK on your cashier. Initiating the payment will display a QR code which you will scan with an Apple device to authorize the payment.
Step 2: Launch payment session & create payment intent
When the user selects Apple Pay as their payment option, in the onClick handler launch the payment session and call the Push API to create a payment intent by handling the onStart callback.You must supply type = “apple_pay” and the token to POST /intent
onComplete() callback that runs when the Apple Pay payment sheet is dismissed.
https://your-domain.com/.well-known/apple-developer-merchantid-domain-association.txt to complete domain verification.
Step 3: Receive payment status via webhook
Refer to the enabling webhooks guide on how to receive asynchronous updates about payment status. This webhook will be how you are notified if the payment is approved or declined.To simulate a decline, submit a transaction for $0.01