Untuk membuat eWallet tokenization (mohon klik link berikut apabila Anda ingin mengetahui pengertiannya), ikuti langkah-langkah berikut:
1. Membuat secret API Key melalui dashboard Anda.
Referensi dapat dilihat di doc berikut.
2. Masukkan callback URL Anda pada Dashboard - Settings - Callbacks di bagian Payment Method dan eWallet payment status dan pastikan saat klik "test and save" respon mengembalikan 2XX
3. Create Customer Object menggunakan endpoint:
POST https://api.xendit.co/customers
Body request:
{
"reference_id": "testing123",
"mobile_number": "+6281388089106",
"given_names": "John Doe"
}
{
"id": "f928fc16-d118-4d66-b82d-6dbfd3a25415",
"reference_id": "testing123",
"given_names": "John Doe",
"email": null,
"mobile_number": "+6281388089106",
"description": null,
"middle_name": null,
"surname": null,
"phone_number": null,
"hashed_phone_number": null,
"nationality": null,
"date_of_birth": null,
"metadata": null,
"employment": null,
"addresses": null
}
4. Create Linking Account menggunakan endpoint:
POST https://api.xendit.co/v2/payment_methods
{
"type": "EWALLET",
"reusability": "MULTIPLE_USE",
"ewallet": {
"channel_code": "OVO",
"channel_properties": {
"success_return_url": "https://your-redirect-website.com/success",
"failure_return_url": "https://your-redirect-website.com/failure"
}
},
"customer_id": "f928fc16-d118-4d66-b82d-6dbfd3a25415",
"metadata": {
"sku": "IPHONE20"
}
}
Anda kemudian akan mendapatkan respons berikut:
{
"id": "pm-ddaa8e60-bfc8-4cbe-bb0d-1426abbc5d0a",
"type": "EWALLET",
"country": "ID",
"business_id": "6253abec9547485c4a838dbe",
"customer_id": "f928fc16-d118-4d66-b82d-6dbfd3a25415",
"reference_id": "0799d13d-cdea-446b-b562-b605c65beb3e",
"reusability": "MULTIPLE_USE",
"status": "REQUIRES_ACTION",
"actions": [
{
"action": "AUTH",
"url": "https://link-web-staging.xendit.co/oauth/lat-c0a8d5c0-f528-4766-96cb-47e1d7f761e2/confirm",
"url_type": "WEB",
"method": "GET"
}
],
"description": null,
"created": "2022-12-09T06:32:06.176314733Z",
"updated": "2022-12-09T06:32:06.176314733Z",
"metadata": {
"sku": "IPHONE20"
},
"billing_information": null,
"failure_code": null,
"ewallet": {
"channel_code": "OVO",
"channel_properties": {
"failure_return_url": "https://your-redirect-website.com/failure",
"success_return_url": "https://your-redirect-website.com/success"
},
"account": {
"name": null,
"account_details": null,
"balance": null,
"point_balance": null
}
},
"direct_bank_transfer": null,
"direct_debit": null,
"card": null,
"over_the_counter": null,
"qr_code": null,
"virtual_account": null
}
Mohon untuk menyimpan payment method id untuk langkah berikutnya saat charge creation.
5. Klik pada "url" dibawah "action" untuk proses linking dan klik "proceed to link the eWallet" (dibawah adalah contoh untuk test mode):
6. Jika sudah sukses, Anda akan diarahkan kesuccess_return_url
and dan menerima callback successful account linking
7. Create eWallet charge menggunakan endpoint:
POST https://api.xendit.co/ewallets/charges
Body request:Mohon untuk input payment method id (dimulai dengan pm-) dari respons sebelumnya ke parameter "payment_method_id" (yang ditebalkan):
{
"reference_id" : "test_reference_id112",
"currency" : "IDR",
"amount" : 5000,
"checkout_method" : "TOKENIZED_PAYMENT",
"payment_method_id" : "pm-ddaa8e60-bfc8-4cbe-bb0d-1426abbc5d0a",
"channel_properties" :
{
"success_redirect_url" : "https://redirect.me/payment",
"failure_redirect_url" : "https://redirect.me/failed",
"redeem_points" : "REDEEM_NONE"
},
"metadata" :
{
"branch_code" : "PLUIT",
"branch_city" : "JAKARTA"
}
}
{
"id": "ewc_49253caf-fc7f-400d-82da-8260f8f5482b",
"business_id": "6253abec9547485c4a838dbe",
"reference_id": "test_reference_id112",
"status": "PENDING",
"currency": "IDR",
"charge_amount": 5000,
"capture_amount": 5000,
"payer_charged_currency": null,
"payer_charged_amount": null,
"refunded_amount": null,
"checkout_method": "TOKENIZED_PAYMENT",
"channel_code": "ID_OVO",
"channel_properties": {
"success_redirect_url": "https://redirect.me/payment",
"failure_redirect_url": "https://redirect.me/failed",
"redeem_points": "REDEEM_NONE"
},
"actions": {
"desktop_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=ce9dhpgpvgtcs06s21ig",
"mobile_web_checkout_url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=ce9dhpgpvgtcs06s21ig",
"mobile_deeplink_checkout_url": null,
"qr_checkout_string": null
},
"is_redirect_required": true,
"callback_url": "https://hooks.zapier.com/hooks/catch/9675406/oj8regt/",
"created": "2022-12-09T06:42:46.283184Z",
"updated": "2022-12-09T06:42:46.283184Z",
"void_status": null,
"voided_at": null,
"capture_now": true,
"customer_id": "f928fc16-d118-4d66-b82d-6dbfd3a25415",
"customer": null,
"payment_method_id": "pm-ddaa8e60-bfc8-4cbe-bb0d-1426abbc5d0a",
"failure_code": null,
"basket": null,
"metadata": {
"branch_city": "JAKARTA",
"branch_code": "PLUIT"
},
"shipping_information": null
}
Silakan untuk melanjutkan pembayaran dan eWallet tokenization Anda sudah selesai!