Test Setup
Setting up
Testing and development with Xendit Subscriptions does not require an activated account. Once you register for a free Xendit account, you can begin testing via API immediately.
- To being testing Subscriptions with Xendit, first create a secret API key in test mode using Xendit dashboard. Make sure to assign permission for Money-In as
WRITE
- Set up your preferrred Subscriptions callback URL in the
Callbacks
section of theSettings
tab - Follow and refer to our API Reference for details on request requirements
Simulating Statuses
In test mode, we recommend testing creation of Subscriptions plans using eWallets as the test scenarios are easily set up. The same result/ simulated flow should apply to all other payment methods. In test mode, Xendit uses magic numbers to help merchants complete their tests without complicated setups. Details on other payment methods are documented after the examples.
Success Plan Creation Simulation Example
- Create a Subscriptions Plan with
amount
= 13579
POST https://api.xendit.co/recurring/plans
{
"reference_id": "test_reference_id",
"customer_id": "cust-239c16f4-866d-43e8-9341-7badafbc019f",
"recurring_action": "PAYMENT",
"currency": "IDR",
"amount": 13579,
"schedule": {
"reference_id": "test_reference_id",
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 12,
"anchor_date": "2022-02-15T16:23:52Z",
"retry_interval": "DAY",
"retry_interval_count": 3,
"total_retry": 2,
"failed_attempt_notifications": [2,4]
},
"immediate_action_type": "FULL_AMOUNT",
"notification_config": {
"recurring_created": ["WHATSAPP","EMAIL"],
"recurring_succeeded": ["WHATSAPP","EMAIL"],
"recurring_failed": ["WHATSAPP","EMAIL"],
"locale": "en"},
"failed_cycle_action": "STOP",
"metadata": null,
"description": "Video Game Subscription",
"items": [
{
"type": "DIGITAL_PRODUCT",
"name": "Cine Mraft",
"net_unit_amount": 13579,
"quantity": 1,
"url": "https://www.xendit.co/",
"category": "Gaming",
"subcategory": "Open World"
}
],
"success_return_url": "https://www.xendit.co/successisthesumoffailures",
"failure_return_url": "https://www.xendit.co/failureisthemotherofsuccess"
}
- Perform account linking via eWallets on Xendit account linking page
- Complete the flow until a success page is seen
- Webhook notifications and end user notifications will be sent by Xendit
Failed Plan Creation Simulation Example
- Create a Subscriptions Plan with
amount
= 21110
POST https://api.xendit.co/recurring/plans
{
"reference_id": "test_reference_id",
"customer_id": "cust-239c16f4-866d-43e8-9341-7badafbc019f",
"recurring_action": "PAYMENT",
"currency": "IDR",
"amount": 21110,
"schedule": {
"reference_id": "test_reference_id",
"interval": "MONTH",
"interval_count": 1,
"total_recurrence": 12,
"anchor_date": "2022-02-15T16:23:52Z",
"retry_interval": "DAY",
"retry_interval_count": 3,
"total_retry": 2,
"failed_attempt_notifications": [2,4]
},
"immediate_action_type": "FULL_AMOUNT",
"notification_config": {
"recurring_created": ["WHATSAPP","EMAIL"],
"recurring_succeeded": ["WHATSAPP","EMAIL"],
"recurring_failed": ["WHATSAPP","EMAIL"],
"locale": "en"},
"failed_cycle_action": "STOP",
"metadata": null,
"description": "Video Game Subscription",
"items": [
{
"type": "DIGITAL_PRODUCT",
"name": "Cine Mraft",
"net_unit_amount": 21110,
"quantity": 1,
"url": "https://www.xendit.co/",
"category": "Gaming",
"subcategory": "Open World"
}
],
"success_return_url": "https://www.xendit.co/successisthesumoffailures",
"failure_return_url": "https://www.xendit.co/failureisthemotherofsuccess"
}
- Perform account linking via eWallets on Xendit account linking page
- Complete the flow until a failed page is seen
- Webhook notifications and end user notifications will be sent by Xendit
Success Cycle Simulation Example
- Simulate a Subscriptions Cycle with
amount
= 13579
POST https://api.xendit.co/recurring/plans/:plan_id/cycles/:id/simulate
{
"amount": 13579
}
- Webhook notifications and end user notifications will be sent by Xendit
Failed Cycle Simulation Example
- Simulate a Subscriptions Cycle with
amount
= 21110
POST https://api.xendit.co/recurring/plans/:plan_id/cycles/:id/simulate
{
"amount": 21110
}
- Webhook notifications and end user notifications will be sent by Xendit
List of Simulation Numbers
eWallets
Scenario | Simulation Amount | Expected Result |
---|---|---|
Customer's account has been restricted by eWallet provider | Amount = 21103 | ACCOUNT_ACCESS_BLOCKED failure code via callback |
Customer's account detail is invalid | Amount = 21106 | INVALID_ACCOUNT_DETAILS failure code via callback |
Customer's account has reached maximum transaction limit | Amount = 20107 | MAXIMUM_LIMIT_REACHED failure code via callback |
Insufficient balance on customer's wallet | Amount = 21110 | INSUFFICIENT_BALANCE failure code via callback |
Cards - refer to (cards testing)[https://docs.xendit.co/credit-cards/integrations/test-scenarios] for card numbers that work in test mode. Expiry dates and CVV can be random inputs.
Scenario | Simulation Amount | Expected Result |
---|---|---|
The card you are trying to capture has expired | Amount = 10051 | EXPIRED_CARD failure code via callback |
The card you are trying to capture has been declined by the issuing bank | Amount = 10052 | CARD_DECLINED failure code via callback |
The card you are trying to capture does not have enough balance to complete the capture | Amount = 10054 | INSUFFICIENT_BALANCE failure code via callback |
The card you are trying to capture has been marked as stolen | Amount = 10055 | STOLEN_CARD failure code via callback |
The card you are trying to capture is inactive | Amount = 10056 | INACTIVE_CARD failure code via callback |
The card you are trying to capture is declined due to cvn not matched | Amount = 10059 | INVALID_CVN failure code via callback |
Direct debit - refer to (direct debit testing)[https://docs.xendit.co/direct-debit/integration-guide/account-linking] for account linking details in test mode.
Scenario | Simulation Amount | Expected Result |
---|---|---|
Transaction exceeds the channel’s allowed daily limit | Amount = 11001 | MAX_AMOUNT_LIMIT_ERROR failure code via callback |
End-customer’s balance is insufficient for the transaction | Amount = 11002 | INSUFFICIENT_BALANCE failure code via callback |
Channel has blocked access to the account | Amount = 11004 | ACCOUNT_ACCESS_BLOCKED failure code via callback |