Testing Guideline
Description
Testing and development with Xendit eWallets does not require an activated account. Once you register for a free Xendit account, you can begin simulating eWallet payments via API immediately.
Testing eWallet Payments
- To do eWallet testing with Xendit, first create a secret API key for development mode. Make sure to assign permission for Money-In as
WRITE
- Set up your preferrred callback URL in the
Callbacks
section of theSettings
tab - Follow and refer to our API Reference for details on request requirements
Testing One-Time Payment Flow
Step 1: Create an eWallet Charge
Send a ‘POST’ request to Create eWallet Charge API using your development API key
info
To simulate and test errors/failures scenarios, please use the corresponding values for the amount
parameter as specified in the Testing Scenarios for eWallet Endpoints page.
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"
}
}
If successful, you will receive a PENDING
response
{
"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
}
Step 2: Simulate an eWallet Payment
Open the URL returned under the actions
parameter from the above response (e.g. https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345
) and proceed to simulate a payment. Note that in production, for ID_OVO
, no link will be returned under the actions
parameter. Instead, the end user will receive a push notification on their registered mobile phone
If successful, you will be redirected to the success_redirect_url
and receive a successful payment callback
{
"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
}
}
Testing Tokenized Payment Flow
Step 1: Create a Customer Object
Send a ‘POST’ request to Create Customer Object API using your development API key
POST https://api.xendit.co/customers
{
"reference_id": "customer-id-123",
"mobile_number": "+6208774494404",
"given_names": "John Doe"
}
If successful, you will receive the customer_id
in the response
{
"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
}
Step 2: Create an eWallet Payment Method
Send a ‘POST’ request to Create Payment Method API using the customer_id
from above
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"
}
If successful, you will receive a REQUIRES_ACTION
response
{
"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
}
Step 3: Simulate an eWallet Account Linking
Open the URL returned under the actions
parameter from the above response (e.g. https://link-web-staging.xendit.co/oauth/lat-b32caa2d-a36b-4e50-a1da/confirm
) and proceed to simulate an account linking
If successful, you will be redirected to the success_return_url
and receive a successful account linking callback
{
"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
}
}
Step 4: Create an eWallet Charge
Send a ‘POST’ request to Create eWallet Charge API using the payment_method_id
from above
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"
}
If successful, you will receive a PENDING
response
{
"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
}
Step 5: Simulate an eWallet Payment (Only Applicable for Non-Auto Debit Flow)
info
Redirecting the end user to authorize a subsequent payment after the initial account linking is only applicable for eWallets with redirection as the default tokenization flow. For eWallets with auto debit as the default tokenization flow, a payment callback is sent without the need to redirect the end user to a payment simulation URL.
Indonesia
Value | OVO | DANA | LinkAja |
---|---|---|---|
Default Tokenization Flow | Redirection | Redirection | Redirection |
Philippines
Value | PayMaya | GrabPay | ShopeePay (PH) |
---|---|---|---|
Default Tokenization Flow | Auto Debit | Auto Debit | Auto Debit |
Open the URL returned under the actions
parameter from the above response (e.g. https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=12345
) and proceed to simulate a payment
If successful, you will be redirected to the success_redirect_url
and receive a successful payment callback
{
"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
}
}