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:
- isReadyToPay : This function is to determine a user's ability to return a form of payment from the Google Pay API.
- LoadPaymentData : This method presents a Google Pay payment sheet that allows selection of a payment method and optionally configured parameters. This method must be called while the browser processes an activation behavior as a result of a click event.
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.
Sample code
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:
Create a payment Intent Create a Payment Intent through the Airwallex API - see full details here API.
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_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
Create customer - You need to create customer API if it is a new customer
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
- 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 :
- Create a Payment Method - Create a Payment method through the Airwallex API - see full details here API. Sample below:
Create a Payment consent - Create a Payment consent through the Airwallex API - see full details here API. See sample request below:
JSONVerify Payment consent - Verify the Payment consent through the Airwallex API - see full details here API. See sample below:
Save payment details with payment
Create customer - You need to create customer API if it is a new customer
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
- 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 :
- Create a Payment Method - Create a Payment method through the Airwallex API - see full details here API. Sample below:
Create a Payment consent - Create a Payment consent through the Airwallex API - see full details here API. See sample request below:
JSONCreate 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.
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: