Applies to both merchants in Indonesia and Philippines
To simulate payment with PayLater in Test Mode, please also check the Paylater payment flow (for further reference can go to this docs):
Here are the steps on how to create PayLater charge and simulate payment in test mode:
1. Create secret API Key on your dashboard in test mode
Reference can be found in this doc.
Things to remember below:
2. Set your test callback URL in Dashboard > Settings > Callbacks in PayLater payment status and make sure upon "test and save" it returns 2XX
3. Create PayLater customer using endpoint:
POST https://api.xendit.co/customers
4. Input you secret API key in Authorization (test/development mode)
5. In Body Request you can input the parameters which are required or optional based on each PayLater partners:
{
"given_names": "Harry",
"surname":"Potter",
"email": "customer@domain.co",
"mobile_number": "+628123456789",
"reference_id": "harrypoter123",
"addresses": [{
"street_line1": "Manila",
"city": "Manila",
"province": "Metro Manila",
"postal_code": "1011",
"country": "PH"
}]
}
6. You will get this response afterwards:
{
"id": "c90572e0-5378-419f-917f-0abfa2707161",
"reference_id": "harrypoter123",
"given_names": "Harry",
"email": "customer@domain.co",
"mobile_number": "+628123456789",
"description": null,
"middle_name": null,
"surname": "Potter",
"phone_number": null,
"hashed_phone_number": null,
"nationality": null,
"date_of_birth": null,
"metadata": null,
"employment": null,
"addresses": [
{
"category": null,
"country": "PH",
"state": null,
"province": "Metro Manila",
"city": "Manila",
"postal_code": "1011",
"street_line1": "Manila",
"street_line2": null,
"is_preferred": false
}
]
}
7. Initiate PayLater plants using endpoint:
POST https://api.xendit.co/paylater/plans
8. Input you secret API key in Authorization (test/development mode)
9. In Body Request you can input the parameters which are required or optional based on each PayLater partners, do not forget to get the ID from the response you got from create paylater customer:
{
"customer_id": "c90572e0-5378-419f-917f-0abfa2707161",
"channel_code": "PH_BILLEASE",
"currency": "PHP",
"amount": 50,
"order_items": [{
"type": "DIGITAL_PRODUCT",
"reference_id": "SKU_1323",
"name": "Potion ebooks",
"net_unit_amount": 50,
"quantity": 1,
"url": "https://www.zngmyhome.com/ebooks",
"category": "Classes"
}]
}
{
"id": "plp_b5f3d6c5-aa6c-4bbd-8f50-1817ccc1712c",
"customer_id": "c90572e0-5378-419f-917f-0abfa2707161",
"channel_code": "PH_BILLEASE",
"currency": "PHP",
"amount": 50,
"order_items": [
{
"type": "DIGITAL_PRODUCT",
"reference_id": "SKU_1323",
"name": "Potion ebooks",
"net_unit_amount": 50,
"quantity": 1,
"url": "https://www.zngmyhome.com/ebooks",
"category": "Classes",
"subcategory": null,
"description": null,
"metadata": null
}
],
"options": [
{
"downpayment_amount": 0,
"installment_amount": 50,
"interest_rate": 0,
"total_amount": 50,
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 1,
"description": "BNPL installment option 1 month"
},
{
"downpayment_amount": 0,
"installment_amount": 16.666666666666668,
"interest_rate": 0,
"total_amount": 50,
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 3,
"description": "BNPL installment option 3 months"
},
{
"downpayment_amount": 0,
"installment_amount": 9.63,
"interest_rate": 2.6,
"total_amount": 57.8,
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 6,
"description": "BNPL installment option 6 months"
},
{
"downpayment_amount": 0,
"installment_amount": 5.47,
"interest_rate": 2.6,
"total_amount": 65.6,
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 12,
"description": "BNPL installment option 12 months"
}
],
"created": "2023-04-03T06:53:13.389Z"
}
12. Input you secret API key in Authorization (test/development mode)
13. In Body Request you can input the parameters which are required or optional based on each PayLater partners, do not forget to get the ID from the response you got from creating paylater plans (this example is for Billease):
{
"plan_id": "plp_b5f3d6c5-aa6c-4bbd-8f50-1817ccc1712c",
"reference_id": "order_id_234",
"checkout_method": "ONE_TIME_PAYMENT",
"success_redirect_url": "https://google.com",
"failure_redirect_url": "https://twitter.com"
}
{
"id": "plc_038923f7-3512-4be8-bad4-df8d9c5fb835",
"business_id": "6023480283321d40fff8cb84",
"reference_id": "order_id_234",
"customer_id": "c90572e0-5378-419f-917f-0abfa2707161",
"plan_id": "plp_b5f3d6c5-aa6c-4bbd-8f50-1817ccc1712c",
"currency": "PHP",
"amount": 50,
"channel_code": "PH_BILLEASE",
"checkout_method": "ONE_TIME_PAYMENT",
"status": "PENDING",
"actions": {
"desktop_web_checkout_url": "https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=038923f7-3512-4be8-bad4-df8d9c5fb835&connector_reference_id=82a473ed-3349-4704-b874-6a3c15d63993&business_id=6023480283321d40fff8cb84",
"mobile_web_checkout_url": "https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=038923f7-3512-4be8-bad4-df8d9c5fb835&connector_reference_id=82a473ed-3349-4704-b874-6a3c15d63993&business_id=6023480283321d40fff8cb84",
"mobile_deeplink_checkout_url": "https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=038923f7-3512-4be8-bad4-df8d9c5fb835&connector_reference_id=82a473ed-3349-4704-b874-6a3c15d63993&business_id=6023480283321d40fff8cb84"
},
"expires_at": "2023-04-05T07:13:29.164Z",
"success_redirect_url": "https://google.com",
"failure_redirect_url": "https://twitter.com",
"callback_url": "https://testpaylater.free.beeceptor.com",
"created": "2023-04-03T07:13:29.183Z",
"updated": "2023-04-03T07:13:29.249Z",
"order_items": [
{
"type": "DIGITAL_PRODUCT",
"reference_id": "SKU_1323",
"name": "Potion ebooks",
"net_unit_amount": 50,
"quantity": 1,
"url": "https://www.zngmyhome.com/ebooks",
"category": "Classes",
"subcategory": null,
"description": null,
"metadata": null
}
],
"voided_at": null,
"payment_method_id": null,
"metadata": null
}