# Access payment details from a wallet 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](https://www.checkout.com/docs/payments/add-payment-methods/apple-pay/web) and [Google Pay](https://www.checkout.com/docs/payments/add-payment-methods/google-pay/web) Flow guides before you update your integration with the steps outlined on this page. --- ## Add the onAuthorized event `Client side` The `onAuthorized` [event](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-on-your-website/flow-library-reference/flowcomponent.md#onAuthorized(FlowComponent,_AuthorizeResult)) 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. **Apple Pay** ```javascript // Flow initialization const applepayComponent = checkout.create('applepay', { onAuthorized, }); ``` **Google Pay** ```javascript // Flow initialization const googlepayComponent = checkout.create('googlepay', { onAuthorized, }); ``` 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 successful `return` value. - To reject the card, provide `{ continue: false, errorMessage: "YOUR_ERROR_MESSAGE" }` as the unsuccessful `return` value. The optional `errorMessage` 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](https://developer.apple.com/documentation/applepayontheweb/applepaypaymentauthorizedevent) 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: ```javascript const onAuthorized = async (self, authorizeResult) => { if (authorizeResult?.payment?.token?.paymentMethod?.type === 'credit') { return { continue: false, errorMessage: 'Credit cards are not accepted.', }; } return { continue: true }; }, ``` --- ## Handle the payment response `Client side` 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](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-on-your-website/get-started-with-flow.md#Handle_the_payment_response_) for both asynchronous and synchronous payments.