Retrieve card tokenization results
Last updated: July 2, 2025
Use the onTokenized
event to monitor the results of tokenizing the payment card. For example, if you want to conduct a pre-payment risk check with the card's details and decide whether to proceed with 3D Secure authentication or abort the payment.
Information
Follow the Getting started with Flow guide before you update your integration with the steps outlined on this page.
The onTokenized
event triggers when the card is tokenized and returns a Request card metadata response.
Add the event to the initialization code for your Flow instance:
1// Flow initialization2const flowComponent = checkout.create('flow', {3onTokenized,4});
Implement the event logic to customize the payment flow depending on the results of tokenization. For example, the following code uses the tokenization result to perform a risk check and aborts the payment if it fails:
1const onTokenized = async (self, tokenizeResult) => {2// Perform risk check with the tokenization result. For example, using an async function to3// send the data to a third-party risk tool:4cardRiskCheckResult = await performRiskCheck(tokenizeResult);56// Return `{ continue: false }` to abort payment with the card7if (cardRiskCheckResult.result === 'abort') {8return {9continue: false,10errorMessage: 'This card is not supported',11};12}1314// Otherwise return `{ continue: true }` to proceed with payment15return {16continue: true,17};18};
The handleSubmit
event enables you to submit a modified payment session.
Add the event to the initialization code for your Flow instance:
1// Flow initialization2const flowComponent = checkout.create('flow', {3onTokenized,4handleSubmit,5});
Implement the event logic to provide the tokenization result data to your server-side integration:
1const handleSubmit = async (self, submitData) => {2// Provide the `submitData` to your server-side integration3// for payment submission4const submitResponse = await performPaymentSubmission(submitData, cardRiskCheckResult);56return submitResponse;7};
Call the Submit a payment session endpoint and provide the payment session's ID as a path parameter.
In your request, provide the payment session data from the handleSubmit
event in session_data
. You can also modify any of the following fields:
3ds
amount
items
reference
post
https://api.checkout.com/payment-sessions/{id}/submit
1{2"session_data": "{SESSION_DATA_FROM_FLOW}",3"3ds": {4"enabled": true5}6}
1{2"id": "pay_f2ws3hn4ijquzbytp3v5lsfxge",3"status": "Action Required",4"type": "card",5"action": {6"type": "3ds",7"url": "http://3ds2.checkout.com/interceptor/sid_y3oqhf46pyzuxjbcn2giaqnb44"8}9}
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.