Skip to main content

Simulasi Pembayaran eWallet

Deskripsi

Simulasi dan pengembangan dengan Xendit eWallet tidak memerlukan akun aktif. Setelah Anda mendaftar untuk mendapatkan akun Xendit secara gratis, Anda dapat segera mulai mensimulasikan pembayaran eWallet melalui API.

Simulasi Pembayaran eWallet

  1. Untuk melakukan simulasi eWallet dengan Xendit, pertama-tama buat API secret key dari development mode. Pastikan untuk memberikan izin Money-In WRITE
  2. Atur callback URL pilihan Anda di bagian Callbacks pada tab Settings
  3. Ikuti dan gunakan Referensi API kami sebagai panduan untuk detail tentang persyaratan request

Simulasi Pembayaran One-Time Payment

Langkah 1: Buat eWallet Charge

Kirim permintaan 'POST' ke Buat eWallet Charge API menggunakan API key dari development mode Anda

info

Untuk mensimulasikan dan menguji skenario kesalahan/kegagalan, gunakan nilai yang sesuai dalam parameter amount seperti yang ditentukan dalam Skenario Pengujian untuk Charge Endpoint eWallet di bawah ini.

POST https://api.xendit.co/ewallets/charges
{
"reference_id": "order-id-123",
"currency": "IDR",
"amount": 25000,
"checkout_method": "ONE_TIME_PAYMENT",
"channel_code": "ID_DANA",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
}
}

Jika berhasil, Anda akan mendapatkan respons PENDING

{
"id": "ewc_8c0a48ab-dad1-45f9-b57b-b994ab504989",
"business_id": "5abe2389ewpejrt238",
"reference_id": "order-id-123",
"status": "PENDING",
"currency": "IDR",
"charge_amount": 25000,
"capture_amount": 25000,
"refunded_amount": null,
"checkout_method": "ONE_TIME_PAYMENT",
"channel_code": "ID_DANA",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://calling-back.com/xendit/dana",
"created": "2021-03-14T06:43:24.899492Z",
"updated": "2021-03-14T06:43:24.899492Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": null,
"payment_method_id": null,
"failure_code": null,
"basket": null,
"metadata": null
}

Langkah 2: Simulasikan Pembayaran eWallet

Buka URL yang ditampilkan di bawah parameter actions dari respons di atas (mis. https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345) dan lanjutkan untuk mensimulasikan pembayaran

info

Perhatikan bahwa URL simulasi pembayaran hanya berlaku selama 10 menit.

Jika berhasil, Anda akan diarahkan ke success_redirect_url dan menerima callback pembayaran yang berhasil

{
"event": "ewallet.capture",
"business_id": "5abe2389ewpejrt238",
"created": "2021-03-14T06:43:24.899492Z",
"data": {
"id": "ewc_8c0a48ab-dad1-45f9-b57b-b994ab504989",
"business_id": "5abe2389ewpejrt238",
"reference_id": "order-id-123",
"status": "SUCCEEDED",
"currency": "IDR",
"charge_amount": 25000,
"capture_amount": 25000,
"refunded_amount": null,
"checkout_method": "ONE_TIME_PAYMENT",
"channel_code": "ID_DANA",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://calling-back.com/xendit/dana",
"created": "2021-03-14T06:43:24.899492Z",
"updated": "2021-03-14T06:43:24.899492Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": null,
"payment_method_id": null,
"failure_code": null,
"basket": null,
"metadata": null
}
}

Simulasi Pembayaran Tokenisasi

Langkah 1: Buat Customer Object

Kirim permintaan 'POST' ke API Create Customer Object menggunakan API key dari development mode Anda

POST https://api.xendit.co/customers
{
"reference_id": "customer-id-123",
"mobile_number": "+6208774494404",
"given_names": "John Doe"
}

Jika berhasil, Anda akan menerima customer_id dalam respons

{
"id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450",
"reference_id": "customer-id-123",
"given_names": "John Doe",
"email": null,
"mobile_number": "+628774494404",
"description": null,
"middle_name": null,
"surname": null,
"phone_number": null,
"nationality": null,
"date_of_birth": null,
"metadata": null,
"employment": null,
"addresses": null,
"source_of_wealth": null
}

Langkah 2: Buat Metode Pembayaran eWallet

Kirim permintaan 'POST' ke Create Payment Method API dengan menggunakan customer_id di atas

POST https://api.xendit.co/v2/payment_methods
{
"type": "EWALLET",
"reusability": "MULTIPLE_USE",
"ewallet": {
"channel_code": "OVO",
"channel_properties": {
"mobile_number": "+628774494404",
"success_return_url": "https://your-redirect-website.com/success",
"failure_return_url": "https://your-redirect-website.com/failure"
}
},
"customer_id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450"
}

Jika berhasil, Anda akan menerima respons REQUIRES_ACTION

{
"id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39",
"type": "EWALLET",
"reusability": "MULTIPLE_USE",
"customer_id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450",
"business_id": "5f27a14a9bf05c73123123123",
"status": "REQUIRES_ACTION",
"country": "ID",
"actions": [
{
"action": "AUTH",
"url_type": "WEB",
"url": "https://link-web-staging.xendit.co/oauth/lat-b32caa2d-a36b-4e50-a1da/confirm",
"method": "GET"
}
],
"created": "2022-01-29T09:12:33.001Z",
"updated": "2022-01-29T09:12:33.001Z",
"metadata": null,
"ewallet": {
"channel_code": "OVO",
"channel_properties": {
"success_return_url": "https://your-redirect-website.com/success",
"failure_return_url": "https://your-redirect-website.com/failure"
},
"account": {
"account_details": null,
"name": null,
"balance": null,
"point_balance": null
}
},
"direct_debit": null,
"card": null,
"over_the_counter": null,
"virtual_account": null,
"qr_code": null
}

Langkah 3: Simulasikan Penautan Akun eWallet

Buka URL yang diberikan pada parameter actions dari respons di atas (mis. https://link-web-staging.xendit.co/oauth/lat-b32caa2d-a36b-4e50-a1da/confirm) dan lanjutkan langkah penautan akun

Jika berhasil, Anda akan diarahkan ke success_return_url dan menerima callback penautan akun yang berhasil

{
"id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39",
"event": "payment_method.activated",
"business_id": "5f27a14a9bf05c73123123123",
"created": "2022-01-29T09:13:33.001Z",
"data": {
"id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39",
"type": "EWALLET",
"country": "ID",
"customer_id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450",
"business_id": "5f27a14a9bf05c73123123123",
"reusability": "MULTIPLE_USE",
"status": "ACTIVE",
"actions": [],
"created": "2022-01-29T09:12:33.001Z",
"updated": "2022-01-29T09:12:33.001Z",
"metadata": null,
"ewallet": {
"channel_code": "OVO",
"channel_properties": {
"success_return_url": "https://your-redirect-website.com/success",
"failure_return_url": "https://your-redirect-website.com/failure"
},
"account": {
"name": null,
"account_details": null,
"balance": 666666,
"point_balance": 666666
}
},
"direct_debit": null,
"card": null,
"over_the_counter": null,
"virtual_account": null,
"qr_code": null
}
}

Langkah 4: Buat Charge eWallet

Kirim permintaan 'POST' ke API Create eWallet Charge dengan menggunakan payment_method_id di atas

POST https://api.xendit.co/ewallets/charges
{
"reference_id": "order-id-123",
"currency": "IDR",
"amount": 25000,
"checkout_method": "TOKENIZED_PAYMENT",
"channel_code": "ID_OVO",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
},
"payment_method_id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39"
}

Jika berhasil, Anda akan menerima respons PENDING

{
"id": "ewc_8c0a48ab-dad1-45f9-b57b-b994ab504989",
"business_id": "5abe2389ewpejrt238",
"reference_id": "order-id-123",
"status": "PENDING",
"currency": "IDR",
"charge_amount": 25000,
"capture_amount": 25000,
"refunded_amount": null,
"checkout_method": "TOKENIZED_PAYMENT",
"channel_code": "ID_OVO",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://calling-back.com/xendit/ovo",
"created": "2022-03-14T06:43:24.899492Z",
"updated": "2022-03-14T06:43:24.899492Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450",
"payment_method_id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39",
"failure_code": null,
"basket": null,
"metadata": null
}

Langkah 5: Simulasi Pembayaran eWallet (Hanya berlaku untuk alur Non-Auto Debit)

info

Diarahkannya pengguna akhir untuk mengotorisasi pembayaran setelah penautan akun hanya berlaku untuk eWallet dengan alur tokenisasi default pengalihan. Untuk eWallet dengan alur tokenisasi default auto debit , callback pembayaran dikirim tanpa perlu mengarahkan pengguna akhir ke URL simulasi pembayaran.

Indonesia

NilaiOVODANALinkAja
Alur Default TokenisasiPengalihanPengalihanPengalihan

Filipina

NilaiPayMayaGrabPayShopeePay (PH)
Alur Default TokenisasiAuto DebitAuto DebitAuto Debit

Buka URL yang ditampilkan pada parameter actions dari respons di atas (mis. https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345) dan lanjutkan untuk mensimulasikan pembayaran

info

Perhatikan bahwa URL simulasi pembayaran hanya berlaku selama 10 menit.

Jika berhasil, Anda akan diarahkan ke success_redirect_url dan menerima callback pembayaran yang berhasil

{
"event": "ewallet.capture",
"business_id": "5abe2389ewpejrt238",
"created": "2022-03-14T06:43:24.899492Z",
"data": {
"id": "ewc_8c0a48ab-dad1-45f9-b57b-b994ab504989",
"business_id": "5abe2389ewpejrt238",
"reference_id": "order-id-123",
"status": "SUCCEEDED",
"currency": "IDR",
"charge_amount": 25000,
"capture_amount": 25000,
"refunded_amount": null,
"checkout_method": "TOKENIZED_PAYMENT",
"channel_code": "ID_OVO",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://calling-back.com/xendit/ovo",
"created": "2022-03-14T06:43:24.899492Z",
"updated": "2022-03-14T06:43:24.899492Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": "b7c308fe-2836-41c8-98ae-0d23ed4d8450",
"payment_method_id": "pm-123123123-f4d9-421c-9f0b-ab3b2b6bbc39",
"failure_code": null,
"basket": null,
"metadata": null
}
}

Skenario Testing untuk Endpoint Charge eWallet

Skenario Positif

SkenarioKriteriaHasil yang diharapkan
Pembayaran berhasilNilai selain 10100-10102 dan 20101-20111Segera mendapatkan respons status pembayaran “PENDING” . Setelah pengguna akhir mengotorisasi pembayaran, berhasil atau gagal, callback akan dikembalikan dengan status “SUCCEEDED” atau “FAILED”

Skenario Negatif

SkenarioKriteriaHasil yang diharapkan
Saluran pembayaran eWallet belum diaktifkan. Aktifkan eWallet melalui Dasbor XenditJumlah = 10100API Response Error 403 CHANNEL_NOT_ACTIVATED
Layanan penyedia eWallet tidak tersediaJumlah = 10101API Response Error 503 CHANNEL_UNAVAILABLE
Layanan Xendit mengalami kendala tidak terduga (jarang terjadi)Jumlah = 10102Respons 500 SERVER_ERROR
Akun customer telah dibatasi oleh penyedia eWalletJumlah = 20103Respons ACCOUNT_ACCESS_BLOCKED dalam callback
Customer harus menghubungi penyedia eWallet untuk menyelesaikan isuJumlah = 20104Respons INVALID_MERCHANT_CREDENTIALS failure dalam callback
Credential merchant mengalami isu di sisi penyedia eWallet. Silakan hubungi Customer Success Xendit untuk mengatasi masalah iniJumlah = 20104Respons INVALID_MERCHANT_CREDENTIALS dalam callback
Customer menolak permintaan pembayaranJumlah = 20105Respons USER_DECLINED_PAYMENT dalam callback
Rincian akun customer tidak validJumlah = 20106Respons INVALID_ACCOUNT_DETAILS dalam callback
Akun eWallet customer telah mencapai batas maksimum jumlah transaksiJumlah = 20107Respons MAXIMUM_LIMIT_REACHED dalam callback
Perangkat customer tidak dapat dijangkau. Umumnya terjadi karena jaringan yang tidak stabil, kesalahan perangkat, atau perangkat yang di-jailbreak.Jumlah = 20108Respons USER_UNREACHABLE dalam callback
Layanan penyedia eWallet mengalami kendala tidak terdugaJumlah = 20109Respons CHANNEL_UNAVAILABLE dalam callback
Saldo eWallet customer tidak mencukupiJumlah = 20110Respons INSUFFICIENT_BALANCE dalam callback
Akun customer belum diaktifkan. Aktifkan akun sebelum mencoba kembali.Jumlah = 20111Respons ACCOUNT_NOT_ACTIVATED dalam callback
Apakah dokumentasi pada bagian ini membantu?