Airwallex Setup & Integration Guide
The airwallex provider integrates Airwallex Payment Links, Multi-Currency Global Acquiring, and Dispute Read Tracking into the Kirak payments runtime across global markets (AUD, HKD, SGD, CNY, GBP, EUR, USD).
1. Prerequisites & Installation
Section titled “1. Prerequisites & Installation”Kirak communicates with Airwallex directly via async REST API calls with httpx. No external Airwallex SDK or additional pip package is required.
pip install "kirak"2. Credentials & Configuration
Section titled “2. Credentials & Configuration”Step 1: Obtain API Keys
Section titled “Step 1: Obtain API Keys”In the Airwallex Web App:
- Navigate to Developer $\rightarrow$ API Keys.
- Copy your Client ID.
- Generate and copy an API Key.
Step 2: Configure Webhooks
Section titled “Step 2: Configure Webhooks”In Developer $\rightarrow$ Webhooks:
- Add a notification URL:
https://your-domain.com/payments/webhook/airwallex. - Subscribe to:
payment_link.paidrefund.accepted,refund.settled,refund.failed- All
payment_dispute.*events
- Copy the webhook Secret.
Step 3: Configure kirak.json
Section titled “Step 3: Configure kirak.json”{ "payments": { "default_provider": "airwallex", "providers": { "airwallex": { "type": "airwallex", "environment": "sandbox" } } }}Step 4: Set Environment Variables
Section titled “Step 4: Set Environment Variables”KIRAK_PAYMENT_AIRWALLEX_CLIENT_ID=...KIRAK_PAYMENT_AIRWALLEX_API_KEY=...KIRAK_PAYMENT_AIRWALLEX_WEBHOOK_SECRET=your_webhook_secret_from_step2[!NOTE] Automatic Token Caching: Kirak authenticates against
POST /api/v1/authentication/loginand caches the bearer token in memory until two minutes before expiry (approx. 30 minutes). If Airwallex returns a 401 Unauthorized, Kirak refreshes the token transparently.
3. Usage Examples
Section titled “3. Usage Examples”3.1 One-Time Payment Link
Section titled “3.1 One-Time Payment Link”result = await kirak.payments.initiate_payment({ "provider": "airwallex", "user_id": "usr_1000", "amount": 5000, # $50.00 AUD in cents "currency": "AUD", "name": "Global Export Fee", "type": "one_time", "payment_email": "buyer@example.com.au",})
payment_link_url = result["data"]["url"]3.2 Reading Disputes
Section titled “3.2 Reading Disputes”Airwallex chargebacks are ingested via webhooks. Administrators can inspect dispute records directly:
dispute = await kirak.payments.get_dispute({ "provider": "airwallex", "dispute_id": "dis_1234567890",})(Contesting evidence via submit_dispute_evidence is not available in Airwallex’s API; evidence must be submitted through the Airwallex web app).
4. Feature Limitations
Section titled “4. Feature Limitations”| Feature | Support Status | Notes |
|---|---|---|
| One-Time Payment Links | Supported | Multi-currency global payment methods |
| Refunds | Supported | Dispatched via /api/v1/pa/refunds |
Dispute Read (get_dispute) |
Supported | Full dispute status query |
Dispute Evidence (submit_dispute_evidence) |
Not Supported | Returns 501 NOT_SUPPORTED; use Airwallex dashboard |
| Subscriptions & Billing Portal | Not Supported | Returns 501 NOT_SUPPORTED |
| Saved Payment Methods | Not Supported | Returns 501 NOT_SUPPORTED |
5. Webhook Event Mapping
Section titled “5. Webhook Event Mapping”Normalized event |
Gateway Events | Description |
|---|---|---|
payment_completed |
payment_link.paid |
Payment link paid successfully |
refund_completed |
refund.settled |
Refund confirmed and settled |
refund_pending |
refund.accepted |
Refund accepted by bank |
refund_failed |
refund.failed |
Refund rejected |
dispute_created |
payment_dispute.created |
Chargeback initiated |
dispute_updated |
payment_dispute.updated, payment_dispute.closed |
Dispute status updated |