Log inGet started
Airwallex logo
Home
Online Payments
Treasury
Transactional FX
Payouts
Issuing
Scale
Open Banking
Developer Tools
API Reference
Home
Online Payments
Overview
Starting with paymentsAirwallex platform overviewOnline payments modelPricing model
Payment Methods
OverviewGlobal
CardsPaysafecardSkrillPayPalApple PayGoogle Pay™
Enable Google Pay™Hosted Payment PageEmbedded ElementsDrop-in ElementNative API
Airwallex Pay - coming soon
EU & UKAPACUS & LATAM

Native API

Our Native API integration allows you to handle your front-end interactions completely, this gives you the desired flexibility. However, this also means that you need to handle a few interactions with Google in order to support Google Pay™.

Events & functions you need to handle in integration with Google Pay API:

  1. isReadyToPay : This function is to determine a user's ability to return a form of payment from the Google Pay API.
  2. onPaymentAuthorized Event : This method is called when a payment is authorized in the payment sheet.

Identify your payment processor

You need to identify the Payment processor in the TokenizationSpecification message to google. Google will use these identifiers to encrypt the Payment token using the Public key of the Payment processor.

> gateway : airwallex
> gatewaymerchantid : <<airwallex account open ID>> looks like acct_xxxx

Sample code

"tokenizationSpecification": 
  {
    "type": "PAYMENT_GATEWAY",
     "parameters": 
       {
          "gateway": "airwallex",
          "gatewayMerchantId": "AWX_ACCT_OPEN_ID"
        }
  }

It is important to note that you can use Airwallex certificates to process Google Pay payments only on the web, if you are using Native API to process mobile based transactions then you should have your own Google Pay Gateway ID & certificates.

Below are the steps you need to follow to integrate Google pay via Native API:

  1. Create a payment Intent Create a Payment Intent through the Airwallex API - see full details here API.

  2. Confirm the payment Intent Confirm a Payment Intent through the Airwallex API - see full details here API. Encrypted Payment token data received should be included in this API call.

Endpoint: POST pci-api-demo.airwallex.com/api/v1/pa/payment_intents/{{payment_intent_id}}/confirm

Sample request

"payment_method": {
"type": "googlepay",
"googlepay":{
"payment_data_type": "encrypted_payment_token",
"encrypted_payment_token": {
  "protocolVersion":"ECv2", "signature":"MEQCIH6Q4OwQ0jAceFEkGF0JID6sJNXxOEi4r+mA7biRxqBQAiAondqoUpU/bdsrAOpZIsrHQS9nwiiNwOrr24RyPeHA0Q\u003d\u003d",
  "intermediateSigningKey":{
"signedKey": "{\"keyExpiration\":\"1542323393147\",\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/1+3HBVSbdv+j7NaArdgMyoSAM43yRydzqdg1TxodSzA96Dj4Mc1EiKroxxunavVIvdxGnJeFViTzFvzFRxyCw\\u003d\\u003d\"}",
"signatures": ["MEYCIQCO2EIi48s8VTH+ilMEpoXLFfkxAwHjfPSCVED/QDSHmQIhALLJmrUlNAY8hDQRV/y1iKZGsWpeNmIP+z+tCQHQxP0v"]
  },
  "signedMessage":"{\"tag\":\"jpGz1F1Bcoi/fCNxI9n7Qrsw7i7KHrGtTf3NrRclt+U\\u003d\",\"ephemeralPublicKey\":\"BJatyFvFPPD21l8/uLP46Ta1hsKHndf8Z+tAgk+DEPQgYTkhHy19cF3h/bXs0tWTmZtnNm+vlVrKbRU9K8+7cZs\\u003d\",\"encryptedMessage\":\"mKOoXwi8OavZ\"}"
}
}
}
  • payment_data_type : Type of the payment data details. One of tokenized_card, encrypted_payment_token
  • encrypted_payment_token : A UTF-8 encoded, serialized JSON object with the keys specified. Refer this link for more information

Subscription payments

Airwallex allows you to create a PaymentConsent with the shopper to initiate future payments using shopper’s saved payments details. For more information, see Save payment details for future payments . You need to add additional information about the order & terms of the payment to display this information on the payment sheet.

Save payment details without payment

  1. Create customer - You need to create customer API if it is a new customer

  2. Get available payment method types - If Google Pay payment method is active with recurring transaction mode, the merchant can choose Google Pay as payment methods for subscriptions. Refer sample response below

Endpoint : GET /api/v1/pa/config/payment_method_types

{
   "has_more": false,
   "items": [
   {
   "name": "googlepay", 
   "transaction_mode": "recurring",
   "flows": [],
   "transaction_currencies": [
   "*"
   ],
   "country_codes": [
       "*"
   ],
   "active": true,
   "card_schemes": [
       {
           "name": "visa"
       },
       {
           "name": "mastercard"
       },
       {
           "name": "unionpay"
       }
   ]
   }
]
  1. Google Pay payment data request - As explained at the start of this page, you need to create Payment Data Request and include the information about subscription payment along with lineitem details. See below sample :
    "displayItems":[{
    label: "monthly",
    price: "1",
    status: "FINAL",
    type: "LINE_ITEM"
  }]
  1. Create a Payment Method - Create a Payment method through the Airwallex API - see full details here API. Sample below:
    {
"request_id": "ed489c5b-9a09-49bc-ab12-b5bf0e6c8e27",
"customer_id": "cus_nlstst8r2gakaxp8zcu",
"type": "googlepay",
    "googlepay": {
          "payment_data_type": "encrypted_payment_token",
          "encrypted_payment_token": "${{googlepaytoken}}"
                  }
    }
  1. Create a Payment consent - Create a Payment consent through the Airwallex API - see full details here API. See sample request below:

    {
    "request_id": "c2fc30c4-4a3a-4f7d-ad00-d0e5604335da",
    "customer_id": "cus_nlstst8r2gakaxp8zcu",
    "payment_method": {
            "type": "googlepay",
            "id": "mtd_nlstst8r2gakaxux44g"
                       },
    "next_triggered_by": "merchant",
    "merchant_trigger_reason": "scheduled",
    "metadata": {
            "schedule": "1st of month"
    }
    }
  2. Verify Payment consent - Verify the Payment consent through the Airwallex API - see full details here API. See sample below:

{
   "request_id": "c2fc30c4-4a3a-4f7d-ad00-d0e5604335da",
   "verification_options": {
       "googlepay": {
           "currency": "EUR"
       }
   },
   "return_url": "https://requestbin.net/r/4qu6jux0"
}

Save payment details with payment

  1. Create customer - You need to create customer API if it is a new customer

  2. Get available payment method types - If googlepay payment method is active with recurring transaction mode, the merchant can choose google Pay as payment methods for subscriptions. Refer sample response below

Endpoint : GET /api/v1/pa/config/payment_method_types

{
   "has_more": false,
   "items": [
   {
   "name": "googlepay", //"googlepay"
   "transaction_mode": "recurring",
   "flows": [],
   "transaction_currencies": [
   "*"
   ],
   "country_codes": [
       "*"
   ],
   "active": true,
   "card_schemes": [
       {
           "name": "visa"
       },
       {
           "name": "mastercard"
       },
       {
           "name": "unionpay"
       }
   ]
   }
]
  1. Google Pay payment data request - As explained at the start of this page, you need to create GooglePayPaymentDataRequest and include the information about subscription payment along with lineitem details. See below sample :
"displayItems":[{
    label: "monthly",
    price: "1",
    status: "FINAL",
    type: "LINE_ITEM"
  }]
  1. Create a Payment Method - Create a Payment method through the Airwallex API - see full details here API. Sample below:
    {
"request_id": "ed489c5b-9a09-49bc-ab12-b5bf0e6c8e27",
"customer_id": "cus_nlstst8r2gakaxp8zcu",
"type": "googlepay",
    "googlepay": {
"payment_data_type": "encrypted_payment_token",
"encrypted_payment_token": "${{googlepaytoken}}"
  }
    }
  1. Create a Payment consent - Create a Payment consent through the Airwallex API - see full details here API. See sample request below:

    {
    "request_id": "c2fc30c4-4a3a-4f7d-ad00-d0e5604335da",
    "customer_id": "cus_nlstst8r2gakaxp8zcu",
    "payment_method": {
    "type": "googlepay",
    "id": "mtd_nlstst8r2gakaxux44g"
    },
    "next_triggered_by": "merchant",
    "merchant_trigger_reason": "scheduled",
    "metadata": {
    "schedule": "1st of month"
    }
    }
  2. Create a 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.

  3. Confirm Payment Intent - Confirm the Payment intent through the Airwallex API - see full details here API. This request should refer to PaymentConsent ID created in Step#5, see sample request below:

    {
     "request_id": "c2fc30c4-4a3a-4f7d-ad00-d0e5604335db",
     "payment_consent_reference": {
       "id": "cst_nlstst8r2gakb4l54nq"
     }
    }