Access payment details from a wallet
Last updated: July 2, 2025
Use the onAuthorized
event to monitor the card details the customer provides in Apple Pay or Google Pay. For example, if you want to abort the payment if they select a credit card or a specific scheme.
Information
Follow the Apple Pay and Google Pay Flow guides before you update your integration with the steps outlined on this page.
The onAuthorized
event triggers after the customer authorizes the payment using a digital wallet. The callback receives the event data from the wallet and provides access to the authorized payment details.
Add the event to the initialization code for your Apple Pay and Google Pay instances.
1// Flow initialization2const applepayComponent = checkout.create('applepay', {3onAuthorized,4});
Implement the event logic to customize the payment flow depending on the data the customer provided in the wallet. By default, Flow accepts the card if your provided callback doesn't return a response. Alternatively, you can explicitly provide return
values to accept or reject the card:
- To accept the card, provide
{ continue: true }
as the successfulreturn
value. - To reject the card, provide
{ continue: false, errorMessage: "YOUR_ERROR_MESSAGE" }
as the unsuccessfulreturn
value. The optionalerrorMessage
is displayed to the customer in Flow.
Information
For Apple Pay payments, the onAuthorize
event returns an AuthorizeResult
object which contains the payload from the onpaymentauthorized
event provided by the Apple Pay Javascript SDK.
For example, the following code rejects the payment if the customer selects a credit card stored in the wallet as the payment option:
1const onAuthorized = async (self, authorizeResult) => {23if (authorizeResult?.payment?.token?.paymentMethod?.type === 'credit') {4return {5continue: false,6errorMessage: 'Credit cards are not accepted.',7};8}910return { continue: true };1112},
You must provide the unmodified response to the handleSubmit
event in the client-side integration. Flow handles any additional required actions.
You can obtain the payment response for both asynchronous and synchronous payments.