Save and reuse payment details
Saving and reusing payment details lets returning shoppers pay faster and enables you to run recurring and off-session charges without asking for payment details each time. This is built on top of Credential-on-file (CoF) payments, where the shopper explicitly authorizes you to store their payment credentials for future use.
In Airwallex, saving and reusing payment details typically involves the following objects:
- Customer: Identifies the shopper in your system and in Airwallex.
- PaymentMethod: Tokenized representation of card or local payment method credentials.
- PaymentConsent: The payment agreement that defines how a stored credential may be reused.
- PaymentIntent: Represents a specific payment you want to collect.
Together, these objects allow you to store credentials once and securely reuse them across customer-initiated transactions (CIT) such as one-click checkout, and merchant-initiated transactions (MIT) such as subscriptions, installments, and unscheduled charges.
Before you begin
- Ensure online payments and any required payment methods have been activated for your account using the Airwallex web app.
- Obtain an access token using your unique Client ID and API key. You must have your access token to make API calls.
- Install Airwallex.js JS. If your integration currently uses Airwallex Payment Elements , refer to our upgrade guide for information on migrating to Airwallex.js.
Save payment details without a payment
You have the option to save a shopper's card details without an upfront payment, allowing you to charge them at a later time. Typical for onboarding shoppers and storing their payment information for future recurring or one-time payments.
Step 1: Create a Customer
To set a card up for future payments, you must first create a Customer object to which the payment details will be linked. Create a Customer object using Create a Customer API when your shopper creates an account with your business. You can also store name, email, and other details on the Customer. The response will contain a unique id for the Customer and also a client_secret. Save the customer id for later.
Both the Customer and the PaymentIntent objects return a client_secret. When initializing a checkout session from your frontend, always use the PaymentIntent client_secret from Step 2—this is the secret that authorizes the checkout session. The Customer client_secret is only used for Customer-level operations, such as attaching or managing saved payment methods.
Step 2: Create a zero-amount PaymentIntent
To capture the payment card details from your shopper, you need to initiate a PaymentIntent by calling Create a PaymentIntent API API. Include the customer_id returned in Step 1—this allows you to link the payment details to already registered shoppers. Set the amount to 0 and save the client_secret received in the response. If you are new to creating PaymentIntents, see the quickstart for a general walkthrough. Note that the quickstart uses a non-zero amount; for this flow, set amount to 0.
Example request
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/create \2 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \3 -H 'Content-Type: application/json' \4 -d '{5 "amount": 0,6 "currency": "USD",7 "merchant_order_id": "D202503210001",8 "customer_id": "cus_sgdv77ldrh3orm9rlp2",9 "request_id": "b01737e5-c5ab-4765-8834-cbd92dfeaf81",10 "descriptor": "Airwallex - Test Descriptor",11 "return_url": "https://www.example.com/payment-result",12 "metadata": {13 "foo": "bar"14 }15 }'
Step 3: Confirm the payment method details to be saved
Redirect your shopper to the Hosted Payment Page JS by passing the following fields in the redirectToCheckout() function:
intent_id: The PaymentIntent ID from Step 2.client_secret: The client secret from Step 2.currency: The currency code.successUrl: The URL on your site where Airwallex redirects the shopper when the Hosted Payment Page flow completes. For return behavior and query parameters, seesuccessUrlJS.country_code: The shopper's country as an ISO 3166-1 alpha-2 code (for example,US).payment_consent: An object containing the intended usage details of the agreement.
Include the intended usage details of the agreement to register it. This helps Airwallex understand if the subsequent payment will be initiated by your shopper or yourself.
After the shopper returns to your site, do not rely on the redirect alone to determine whether saving the payment method succeeded. On your server, call Retrieve a PaymentIntent API to verify the PaymentIntent status, or handle the payment_intent.succeeded event from Payments webhooks. When the flow succeeds, read payment_consent_id from the PaymentIntent in the API response (or from the webhook payload) and store it for subsequent payments.
Set payment_consent.next_triggered_by to customer.
When you include a customer_id on a PaymentIntent, the checkout page shows a “Save my card for future payments” checkbox that is pre-selected by default. If the shopper leaves the checkbox selected, Airwallex saves the payment method to that shopper after a successful payment — even without the explicit payment_consent flows described on this page. If the shopper clears the checkbox, the payment is processed as a guest checkout and no vaulting occurs. Make sure this default behaviour aligns with your data privacy and consent requirements.
The payment_consent object described below controls the type of agreement (CIT vs MIT) and how the credential may be reused.
Example code
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo',5 enabledElements: ['payments'],6});78payments.redirectToCheckout({9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 successUrl: 'https://www.example.com/payment-result',14 payment_consent: {15 next_triggered_by: 'customer'16 }17});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoscheduled. Used when payments are collected at fixed, recurring intervals.
Example code
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo',5 enabledElements: ['payments'],6});78payments.redirectToCheckout({9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 successUrl: 'https://www.example.com/payment-result',14 payment_consent: {15 next_triggered_by: 'merchant',16 merchant_trigger_reason: 'scheduled'17 }18});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontounscheduled. Used when payments do not follow a fixed schedule, such as one-off charges made without the shopper being in session.
Example code
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo',5 enabledElements: ['payments'],6});78payments.redirectToCheckout({9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 successUrl: 'https://www.example.com/payment-result',14 payment_consent: {15 next_triggered_by: 'merchant',16 merchant_trigger_reason: 'unscheduled'17 }18});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoinstallments. Used when the total amount is collected from the shopper over multiple installment payments. For this option, you must provide additional installment details underpayment_consent.terms_of_useobject.
Example code
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo',5 enabledElements: ['payments'],6});78payments.redirectToCheckout({9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 successUrl: 'https://www.example.com/payment-result',14 payment_consent: {15 next_triggered_by: 'merchant',16 merchant_trigger_reason: 'installments',17 terms_of_use: {18 payment_amount_type: 'FIXED',19 fixed_payment_amount: 100,20 payment_schedule: {21 period: 1,22 period_unit: 'MONTH',23 },24 total_billing_cycles: 12,25 billing_cycle_charge_day: 1,26 start_date: '2025-05-01',27 end_date: '2026-05-01',28 },29 },30});
Create a checkout page with Drop-in Element JS to collect payment details by passing the following fields in createElement():
intent_id: The PaymentIntent ID from Step 2.client_secret: The client secret from Step 2.currency: The currency code.country_code: The shopper's country as an ISO 3166-1 alpha-2 code (for example,US).payment_consent: An object containing the intended usage details of the agreement.
Include the intended usage details of the agreement to register it. This helps Airwallex understand if the subsequent payment will be initiated by your shopper or yourself.
Do not rely on the Drop-in Element client callbacks alone to determine whether saving the payment method succeeded. On your server, call Retrieve a PaymentIntent API to verify the PaymentIntent status, or handle the payment_intent.succeeded event from Payments webhooks. When the flow succeeds, read payment_consent_id from the PaymentIntent in the API response (or from the webhook payload) and store it for subsequent payments.
Add a container element (for example, <div id="dropIn"></div>). After createElement('dropIn', options) JS, call mount() JS with that container id, then attach ready, success, and error listeners after mount(). For a full walkthrough, see Guest user checkout with Drop-in Element.
Set payment_consent.next_triggered_by to customer.
When you include a customer_id on a PaymentIntent, the checkout page shows a “Save my card for future payments” checkbox that is pre-selected by default. If the shopper leaves the checkbox selected, Airwallex saves the payment method to that shopper after a successful payment — even without the explicit payment_consent flows described on this page. If the shopper clears the checkbox, the payment is processed as a guest checkout and no vaulting occurs. Make sure this default behaviour aligns with your data privacy and consent requirements.
The payment_consent object described below controls the type of agreement (CIT vs MIT) and how the credential may be reused.
Example code
1import { init, createElement } from '@airwallex/components-sdk';23await init({4 env: 'demo',5 enabledElements: ['payments'],6});78const element = createElement('dropIn', {9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 payment_consent: {14 next_triggered_by: 'customer',15 },16});1718element.mount('dropIn');
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoscheduled. Used when payments are collected at fixed, recurring intervals.
Example code
1import { init, createElement } from '@airwallex/components-sdk';23await init({4 env: 'demo',5 enabledElements: ['payments'],6});78const element = createElement('dropIn', {9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 payment_consent: {14 next_triggered_by: 'merchant',15 merchant_trigger_reason: 'scheduled',16 },17});1819element.mount('dropIn');
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontounscheduled. Used when payments do not follow a fixed schedule, such as one-off charges made without the shopper being in session.
Example code
1import { init, createElement } from '@airwallex/components-sdk';23await init({4 env: 'demo',5 enabledElements: ['payments'],6});78const element = createElement('dropIn', {9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 payment_consent: {14 next_triggered_by: 'merchant',15 merchant_trigger_reason: 'unscheduled',16 },17});1819element.mount('dropIn');
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoinstallments. Used when the total amount is collected from the shopper over multiple installment payments. For this option, you must provide additional installment details underpayment_consent.terms_of_useobject.
Example code
1import { init, createElement } from '@airwallex/components-sdk';23await init({4 env: 'demo',5 enabledElements: ['payments'],6});78const element = createElement('dropIn', {9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 payment_consent: {14 next_triggered_by: 'merchant',15 merchant_trigger_reason: 'installments',16 terms_of_use: {17 payment_amount_type: 'FIXED',18 fixed_payment_amount: 100,19 payment_schedule: {20 period: 1,21 period_unit: 'MONTH',22 },23 total_billing_cycles: 12,24 billing_cycle_charge_day: 1,25 start_date: '2025-05-01',26 end_date: '2026-05-01',27 },28 },29});3031element.mount('dropIn');
This implementation applies to Card Element and Split Card Element integrations.
Create a checkout page with Embedded Card Element or Split Card Element to collect payment details.
When the shopper is ready to proceed with the payment, call confirm() JS by passing the client_secret and PaymentIntent id from Step 2, and the payment_consent object.
Include the intended usage details of the Payment Consent to register it. This helps Airwallex understand if the subsequent payment will be initiated by your shopper or yourself. Query the payment intent or subscribe to payment_intent.succeeded webhook to receive the payment_consent_id, to be used for subsequent payments.
Set payment_consent.next_triggered_by to customer.
When you include a customer_id on a PaymentIntent, the checkout page shows a “Save my card for future payments” checkbox that is pre-selected by default. If the shopper leaves the checkbox selected, Airwallex saves the payment method to that shopper after a successful payment — even without the explicit payment_consent flows described on this page. If the shopper clears the checkbox, the payment is processed as a guest checkout and no vaulting occurs. Make sure this default behaviour aligns with your data privacy and consent requirements.
The payment_consent object described below controls the type of agreement (CIT vs MIT) and how the credential may be reused.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 card.confirm({4 client_secret: 'replace-with-your-client-secret',5 intent_id: 'replace-with-your-intent-id',6 payment_consent: {7 next_triggered_by: 'customer',8 },9 }).then((response) => {10 // Listen to the request response11 /* Handle response */12 window.alert(JSON.stringify(response));13 });14});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoscheduled. Used when payments are collected at fixed, recurring intervals.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 card.confirm({4 client_secret: 'replace-with-your-client-secret',5 intent_id: 'replace-with-your-intent-id',6 payment_consent: {7 next_triggered_by: 'merchant',8 merchant_trigger_reason: 'scheduled',9 },10 }).then((response) => {11 // Listen to the request response12 /* Handle response */13 window.alert(JSON.stringify(response));14 });15});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontounscheduled. Used when payments do not follow a fixed schedule, such as one-off charges made without the shopper being in session.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 card.confirm({4 client_secret: 'replace-with-your-client-secret',5 intent_id: 'replace-with-your-intent-id',6 payment_consent: {7 next_triggered_by: 'merchant',8 merchant_trigger_reason: 'unscheduled',9 },10 }).then((response) => {11 // Listen to the request response12 /* Handle response */13 window.alert(JSON.stringify(response));14 });15});
- Set
payment_consent.next_triggered_bytomerchant. - Set
payment_consent.merchant_trigger_reasontoinstallments. Used when the total amount is collected from the shopper over multiple installment payments. For this option, you must provide additional installment details underpayment_consent.terms_of_useobject.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 card.confirm({4 client_secret: 'replace-with-your-client-secret',5 intent_id: 'replace-with-your-intent-id',6 payment_consent: {7 next_triggered_by: 'merchant',8 merchant_trigger_reason: 'installments',9 terms_of_use: {10 payment_amount_type: 'FIXED',11 fixed_payment_amount: 100,12 payment_schedule: {13 period: 1,14 period_unit: 'MONTH',15 },16 total_billing_cycles: 12,17 billing_cycle_charge_day: 1,18 start_date: '2025-05-01',19 end_date: '2026-05-01',20 },21 },22 }).then((response) => {23 // Listen to the request response24 /* Handle response */25 window.alert(JSON.stringify(response));26 });27});
Save payment details during a payment
You can collect the immediate amount for a one-off purchase, and save shopper's payment details for future purchases.
Follow the same integration steps as Save payment details without a payment, but in Step 2, when creating the PaymentIntent, provide the pending payment amount instead of setting the amount to 0.
Collect a subsequent payment using saved details
To collect a subsequent payment using the stored payment details, you need to call Create a PaymentIntent with the customer_id field. The next steps depend on whether the payment is driven by the shopper or by yourself.
Step 1: Create a PaymentIntent
Initiate a payment request by calling Create a PaymentIntent API. Include the customer_id generated by Airwallex when you registered your shopper. Save the returned intent id and client_secret.
Step 2: Confirm the PaymentIntent
The confirmation method depends on whether the payment is a CIT or a MIT.
Call redirectToCheckout() with the following details. Airwallex will list all the payment methods saved on the Customer, allowing your shopper to select any of the saved payment methods. For a saved card, the shopper will be prompted to enter their CVC of the card as an additional fraud measure to verify the shopper.
Required fields:
intent_id: The PaymentIntent ID from Step 1.client_secret: The client secret from Step 1.currency: The currency code.successUrl: The URL on your site where Airwallex redirects the shopper when the Hosted Payment Page flow completes.country_code: The shopper's country as an ISO 3166-1 alpha-2 code.
Example code
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo',5 enabledElements: ['payments'],6});78payments.redirectToCheckout({9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13 successUrl: 'https://www.example.com/payment-result',14});
After the shopper returns from Hosted Payment Page, confirm the payment outcome on your server with Retrieve a PaymentIntent API or the payment_intent.succeeded event from Payments webhooks. Do not rely on the client return alone.
Call Confirm a PaymentIntent API with the following fields to charge the shopper:
Required fields:
customer_id: Theidof the Customer associated with the saved payment method.payment_method: An object containing theidandtypeof the payment method.triggered_by: Set tomerchant.payment_method_options: Configuration options for the payment method.payment_consent_id: (Optional) Theidof the PaymentConsent must be provided when the account has multiple MITs associated with it.
Example request
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/int_hkpdskz7vg1xc7uscdj/confirm \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -d '{5 "customer_id": "cus_sgdv77ldrh3orm9rlp2",6 "payment_method": {7 "id": "mtd_sgdv8bwxbh3ol8y67nx",8 "type": "card"9 },10 "triggered_by": "merchant",11 "payment_method_options": {12 "card": {13 "authorization_type": "final_auth",14 "auto_capture": true15 }16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "return_url": "https://www.example.com/payment-result"19 }'
The confirmation method depends on whether the payment is a CIT or a MIT.
Create a checkout page with the Drop-in Element JS to collect payment details. When the PaymentIntent includes a customer_id, Drop-in automatically lists that shopper's saved payment methods so the shopper can pick one (and enter CVC for a saved card) or pay with a new method—no extra configuration is required.
Call createElement() with the following fields when the shopper pays with a saved payment method:
intent_id: Theidof the PaymentIntent you want to confirm and complete.client_secret: Theclient_secretof the PaymentIntent you want to confirm and complete.currency: The currency code.country_code: The shopper's country as an ISO 3166-1 alpha-2 code (recommended so country-specific methods and fields resolve correctly).
Example code
1import { init, createElement } from '@airwallex/components-sdk';23await init({4 env: 'demo',5 enabledElements: ['payments'],6});78const element = createElement('dropIn', {9 intent_id: 'replace-with-your-intent-id',10 client_secret: 'replace-with-your-client-secret',11 currency: 'replace-with-your-currency',12 country_code: 'replace-with-your-country-code',13});1415element.mount('dropIn');
Attach ready, success, and error listeners after mount(). See Guest user checkout with Drop-in Element.
Do not rely on the Drop-in Element success event alone to decide that the payment completed. On your server, call Retrieve a PaymentIntent API or handle the payment_intent.succeeded event from Payments webhooks before fulfilling the order or treating the charge as final.
A payment may succeed even with a failed CVC check. To prevent this, configure your Risk management rules to block payments when CVC verification fails.
Call Confirm a PaymentIntent API API with the following fields to charge the shopper:
Required fields:
intent_id: Theidof the PaymentIntent you want to confirm and complete, included as a URL parameter.customer_id: Theidof the Customer associated with the saved payment method.payment_method.id: The PaymentMethodidgenerated when initial MIT was set up.
Example request
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/int_hkpdskz7vg1xc7uscdj/confirm \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -d '{5 "customer_id": "cus_sgdv77ldrh3orm9rlp2",6 "payment_method": {7 "id": "mtd_sgdv8bwxbh3ol8y67nx",8 "type": "card"9 },10 "triggered_by": "merchant",11 "payment_method_options": {12 "card": {13 "authorization_type": "final_auth",14 "auto_capture": true15 }16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "return_url": "https://www.example.com/payment-result"19 }'
The confirmation method depends on whether the payment is a CIT or a MIT.
This implementation applies to Card Element and Split Card Element integrations.
To retrieve a list of all payment methods saved under a Customer, use Get list of all Payment Methods API and provide the customer_id. Airwallex will return the saved payment methods, which you can then present to your shopper for selection.
When the shopper selects a saved payment method, call confirm() with the following fields:
client_secret: The client secret from Step 1.intent_id: The PaymentIntent ID from Step 1.payment_method_id: The PaymentMethodidof the payment method selected by your shopper.triggered_by: Set tocustomer.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 card.confirm({4 client_secret: 'replace-with-your-client-secret',5 intent_id: 'replace-with-your-intent-id',6 payment_method_id: 'replace-with-your-payment_method_id',7 triggered_by: 'customer',8 }).then((response) => {9 // Listen to the request response10 /* Handle response */11 window.alert(JSON.stringify(response));12 });13});
With CVC input
When creating subsequent customer-initiated payments on a saved card, you may want to recollect the CVC of the card as an additional fraud measure to verify the shopper.
A payment may succeed even with a failed CVC check. To prevent this, configure your Risk management rules to block payments when CVC verification fails.
Step 1: Add CVC element to your checkout page
Create an empty container div with a unique id in your payment form and a Submit button to trigger the payment request. Airwallex inserts an iframe into this div that securely collects CVC information.
1<div>2 <div>CVC</div>3 <div id="cvc"></div>4</div>56<button id="submit">Submit</button>
When the payment form above has loaded, create the CVC Element by specifying the Element type as cvc and mount() JS it to the container div in your payment form.
1import { createElement } from '@airwallex/components-sdk';23const cvc = createElement('cvc', { cvcLength: 3 }); // specify cvc length based on card brand4cvc.mount('cvc');
Ensure that the payment form only contains one Element with cvc id. The CVC Element should only be mounted once in a single payment flow.
Step 2: Confirm the PaymentIntent with CVC
When the shopper clicks the Submit button, call confirm() by passing the following fields to complete the payment:
intent_id: The PaymentIntent ID from Step 1.client_secret: The client secret from Step 1.payment_method_id: The PaymentMethodidof the payment method selected by your shopper.triggered_by: Set tocustomer.
Example code
1// Add a button handler2document.getElementById('submit').addEventListener('click', () => {3 cvc.confirm({4 intent_id: 'replace-with-your-intent-id',5 client_secret: 'replace-with-your-client-secret',6 payment_method_id: 'replace-with-your-payment_method_id',7 triggered_by: 'customer',8 }).then((response) => {9 // Listen to the request response10 /* Handle response */11 window.alert(JSON.stringify(response));12 });13});
Call Confirm a PaymentIntent API API with the following fields to charge the shopper:
Required fields:
intent_id: Theidof the PaymentIntent you want to confirm and complete, included as a URL parameter.customer_id: Theidof the Customer associated with the saved payment method.payment_method: An object containing theidandtypeof the payment method.triggered_by: Set tomerchant.payment_method_options: Configuration options for the payment method.
Example request
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/int_hkpdskz7vg1xc7uscdj/confirm \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -d '{5 "customer_id": "cus_sgdv77ldrh3orm9rlp2",6 "payment_method": {7 "id": "mtd_sgdv8bwxbh3ol8y67nx",8 "type": "card"9 },10 "triggered_by": "merchant",11 "payment_method_options": {12 "card": {13 "authorization_type": "final_auth",14 "auto_capture": true15 }16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "return_url": "https://www.example.com/payment-result"19 }'
Reuse saved details to set up a new agreement
You can reuse the payment details your shopper has saved with you to set up a new payment agreement with your shopper. Scenarios include:
-
Shoppers setting up a new MIT payment have the option to use an existing card number or payment method. This can be one already associated with a CIT payment or another previously established MIT agreement.
-
When making a one-time payment, shoppers can choose to reuse a card number which is associated with a MIT agreement.
Follow these steps to set up a new MIT agreement using existing payment details:
-
Create a PaymentIntent using the
customer_idthat has been created. -
Register the new MIT consent with the shopper using your integration. Use the same
payment_consentvalues as in the MIT tabs under Save payment details without a payment:- Hosted Payment Page: Configure
redirectToCheckout()with the new intended usage details. Your shopper is shown saved cards linked to thecustomer_id(for both CIT and MIT) to complete the new agreement. - Drop-in Element: Configure
createElement('dropIn', …)with the new intended usage details. Your shopper is shown saved cards linked to thecustomer_id(for both CIT and MIT) to complete the new agreement. - Card Element / Split Card Element: Call Get list of all Payment Methods API for the
customer_id, then callconfirm()with the newpayment_consentand the selected saved payment method.
- Hosted Payment Page: Configure
-
Airwallex generates a new
payment_consent_idafter the completion of the payment. Save thepayment_consent_idto process subsequent payments.
As this is a new MIT setup, shoppers might still need to complete 3DS authentication. This can occur due to fraud risk assessments or PSD2 Strong Customer Authentication (SCA) requirements, and it applies regardless of whether the card is pre-existing or not.
You can reuse saved card details for CIT payments with no further integration, as described in Collect a subsequent payment using saved details.
Test your integration
Use test card numbers and the test and go-live checklist to test your integration for various success and error scenarios in the sandbox environment and then go live in the production environment.