Untuk melakukan simulasi pembayaran eWallet pada mode tes atau test mode, Anda perlu mengetahui bahwa eWallet memiliki 2 jenis tipe pembayaran (untuk referensi lebih lengkap Anda dapat klik docs berikut):
1. No Redirection Payment Flow/ Push Notification Flow:
- OVO
- JeniusPay
2. Redirection Payment Flow:
- DANA
- ShopeePay (ID & PH)
- LinkAja
- AstraPay
- GCash
- Paymaya
- GrabPay
Berikut adalah langkah-langkah cara membuat eWallet charge dan simulasikan pembayaran pada test mode:
1. Membuat secret API Key melalui dashboard Anda dalam mode test
Referensi dapat dilihat di doc berikut.
2. Masukkan callback URL Anda pada Dashboard - Settings - Callbacks di bagian eWallet payment status dan pastikan saat klik "test and save" respon mengembalikan 2XX
3. Membuat eWallet charge menggunakan endpoint:
POST https://api.xendit.co/ewallets/charges
4. Masukkan secret API key Anda pada Authorization
5. Pada Body request, Anda dapat menggunakan parameter yang wajib ataupun optional sesuai dengan eWallet partners (dibawah adalah contoh untuk DANA):
{
"reference_id": "test123",
"currency": "IDR",
"amount": 1000,
"checkout_method": "ONE_TIME_PAYMENT",
"channel_code": "ID_DANA",
"channel_properties": {
"success_redirect_url": "https://yourwebsiteurl/",
"failure_redirect_url": "https://yourwebsiteurl/"
},
"metadata": {
"branch_area": "PLUIT",
"branch_city": "JAKARTA"
}
}
{
"id": "ewc_57395955-790c-46c2-8f84-0a16673b6e91",
"business_id": "6253abec9547485c4a83xxx",
"reference_id": "test123",
"status": "PENDING",
"currency": "IDR",
"charge_amount": 1000,
"capture_amount": 1000,
"payer_charged_currency": null,
"payer_charged_amount": null,
"refunded_amount": null,
"checkout_method": "ONE_TIME_PAYMENT",
"channel_code": "ID_DANA",
"channel_properties": {
"success_redirect_url": "https://yourwebsiteurl/",
"failure_redirect_url": "https://yourwebsiteurl/"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=ce838ropvgtcs06rtg9g",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=ce838ropvgtcs06rtg9g",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://hooks.zapier.com/hooks/catch/9675406x/oj8regt/",
"created": "2022-12-07T06:36:31.131839Z",
"updated": "2022-12-07T06:36:31.131839Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": null,
"customer": null,
"payment_method_id": null,
"failure_code": null,
"basket": null,
"metadata": {
"branch_area": "PLUIT",
"branch_city": "JAKARTA"
},
"shipping_information": null
}
1. Redirection Flow: