Desktop/Mobile Website Browser
Step 1. Initialize a Payment Intent
Create a PaymentIntent object with a request_id, amount, currency and a merchant_order_id from your backend server.
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/create \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -d '{5 "request_id": "d917ad44-6ae4-447e-a534-cce4ceebfd2e",6 "amount": 100,7 "currency": "EUR",8 "merchant_order_id": "85d7b0e0-7235-11ea-862e-9f6aa1adfca6",9 "return_url": "https://www.airwallex.com"10 }'
Step 2. Confirm the Payment Intent with Bizum
When a shopper selects to pay with Bizum on their desktop or mobile browser, call the following API endpoint to confirm the PaymentIntent. The shopper's phone number is required.
Request:
1curl -X POST https://api-demo.airwallex.com/api/v1/pa/payment_intents/{{PAYMENT_INTENT_ID}}/confirm \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -d '{5 "request_id": "d917ad44-6ae4-447e-a534-cce4ceebfd2e",6 "payment_method": {7 "type": "bizum",8 "bizum": {9 "shopper_phone": "+34612345678"10 }11 },12 "return_url": "https://www.airwallex.com"13 }'
Response: The response contains a next_action with type notify_customer_authorization. Prompt the shopper to check their phone for a push notification from their banking app to authorize the payment.
1{2 "next_action": {3 "type": "notify_customer_authorization"4 }5}
Step 3. Query the payment result status
To get the payment result, we suggest you poll the status of the Payment Intent via the Retrieve a Payment Intent API API. You may start polling the Payment Intent status after the shopper is redirected back to your website or mobile app, that is, the return_url passed when creating the Payment Intent.
In addition, Airwallex will notify you of the payment result asynchronously via the webhooks. Please refer to the webhook documentation to set up your webhook accordingly. Although subscribing to webhook events is optional, it is recommended to subscribe to the payment_intent.succeeded webhook which indicates that the shopper has paid the order.