Airwallex logo

API Integration

api-recurring 1

When capturing a Stored Credential for the first time

Card

  1. Create customer if it is a new customer
  2. Create payment method if a new payment method is provided by the customer
  3. Create payment consents with the customer and payment method you created in Step 1 and 2, and save Consent ID for subsequent transactions Note that A payment consent can be created without providing a payment method immediately. You can update payment_consents to attach payment_method later on.
  4. (Optional) Create Payment Intent for the order with the customer ID. This step is only needed for shopper wishes to pay for the first order in the payment method binding process.
  5. Verify payment_consents through a transaction authorization. For card transactions you have 2 options for verifying the payment consent

    • Option 1 (verification only):You can submit zero or supplementary amounts for the verification process. This will automatically create payment intent, which will be CANCELLED after verification is completed.
    • Option 2 (first payment completed): You can use the payment intent created in Step 4 to do verification by Confirm payment intent with payment_consent_reference. This will result in payment intent to be SUCCEEDED.

    Verifying a payment consent will result in the statuses of both payment consent and its payment method changed to VERIFIED. If payment consent is not verified, the status will stay as PENDING_VERIFICATION, and next_action will appear in the response.

    In case full 3DS authentication is mandatory (for card transactions in EU region) or triggered by fraud detection during a card verification, you can continue the verification by finishing the payment using payment_intents/confirm_continue .

E-wallet (eg. Kakaopay)

  1. Create customer if it is a new customer
  2. Create payment consent with the customer you created in Step 1 and save Consent ID for subsequent transactions Note that A payment consent can be created without providing a payment method immediately. You can update payment_consents to attach payment_method later on.
  3. Verify payment_consents through the authorization process. Provide details in verification_options including flow and os_type for the e-wallet your customer selected. Verifying a payment consent will result in the status of payment consent changed to VERIFIED. If payment consent is not verified, the status will stay as PENDING_VERIFICATION, and next_action will appear in the response. For E-wallet, you need to render the redirect page to the customer in order to complete the authorization. Once finished, you will receive a webhook notification of payment_consent.verified.

When initiating a subsequent transaction using a stored credential

A. For subsequent Subscription and Autodebit (MIT) transactions api-recurring 2

  1. Create payment_intent to request for subsequent payments
  2. Confirm payment_intent with payment_consent_reference.id to request payment with reference to stored payment consent

B. For subsequent Oneclick (CIT) transactions:

CIT subsequent API integration

  1. Create payment_intents with customer id to get payment methods saved by a customer. You will get customer_payment_methods and customer_payment_consents of the customer. Get payment methods information saved in payment consents by using these 2 parameters and you are ready to display to your customer payment methods they saved.
  2. Confirm payment_intents with payment_consent_reference.id to request payment with reference to stored Payment consent. If the subsequent payment is for card payment, 3DS might be triggered in the process.

Error Cases

Error CodeScenario
resource_not_foundcreate a payment consent with non-existing customer_id or payment_method_id; update a payment consent with non-existing payment_method_id
resource_not_foundconfirm a payment intent with non-existing payment_consent_id
resource_not_foundconfirm a payment intent with payment consent that is DISABLED
resource_not_foundconfirm a payment intent with payment consent of the status PENDING_VERIFICATION while its payment method requires the consent to be VERIFIED before this operation
resource_not_foundconfirm a payment intent with payment consent whose payment method has been DISABLED or EXPIRED
validation_errorconfirm a payment intent with payment consent without providing cvc while requires_cvc is true
currency_not_supportedconfirm a payment intent with payment consent whose currency is different from the intent currency