To create payment with eWallet tokenization (please follow this link if you would like to know what is eWallet tokenization), please follow the steps below:
1. Create secret API Key on your dashboard
Reference can be found in this doc.
2. Set your test callback URL in Dashboard - Settings - Callbacks in Payment Method and eWallet payment status and make sure upon "test and save" it returns 2XX
3. Create Customer Object using this 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 using this 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"
}
}
You will then get this response:
{
"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
}
Please save the payment method id for the next step later on.
5. Click on the "url" under "action" section for the linking process and proceed to link the eWallet (below is the example in test mode):
6. If successful, you will be redirected to thesuccess_return_url
and receive a successful account linking callback
7. Once done, continue to create eWallet charge using this endpoint:
POST https://api.xendit.co/ewallets/charges
Body request:Please add the payment method id (starts with pm-) from previous response to the parameter "payment_method_id" (in bold):
{
"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
}
Please continue to payment after the charge is created successfully. Your eWallet tokenization is done!