Skip to main content

Testing

In the sandbox, the number the customer types on the checkout page decides what happens. You can test every outcome without real money. None of this works in production.

The sandbox checkout shows three test payment methods. They run on BillPay's simulator, so no real bank, wallet, or card is involved.

On the checkout pageprovider / instrument in the API
BillPay Test WalletSANDBOX_WALLET / TEST_WALLET
BillPay Test Bank
BillPay Test Card

These are sandbox-only. Production will show the real providers as they go live.

Payments​

Type on checkoutResultfailureCode
0911234567, or any number not listed belowPaid after a few seconds
0911000000 (ends in 0000)RefusedINSUFFICIENT_FUNDS
0911001111 (ends in 1111)Declined by the customerCUSTOMER_DECLINED
0911002222 (ends in 2222)Refused, account blockedACCOUNT_BLOCKED
0911003333 (ends in 3333)Refused, over the customer's limitLIMIT_EXCEEDED
0911008888 (ends in 8888)Paid after a few minutes, like a slow customer
0911009999 (ends in 9999)Never answers. The try ends as TIMEOUT, and the payment becomes EXPIRED when the link runs outPROVIDER_TIMEOUT

Test cards​

On the test card page, use one of these tokens instead of a card number. Real card numbers never reach BillPay, in the sandbox or in production.

TokenResult
tok_successPaid
tok_insufficient_fundsRefused, INSUFFICIENT_FUNDS
tok_declinedRefused, CUSTOMER_DECLINED
tok_expired_cardRefused, CARD_EXPIRED
tok_timeoutNever answers

A refused try sends the payment back to CREATED, so the customer can try again. They get 3 tries within 30 minutes.

Refunds​

Refund amountResult
Ends in .13, for example 10.13Refused by the provider (REFUND_REFUSED). The money goes back to your balance.
Any other amountCOMPLETED, and PaymentRefunded is sent.

Payouts​

These apply to settlements and withdrawals.

Destination account numberResult
Ends in 0000Refused by the receiving bank.
Ends in 9999Paid, then sent back by the bank (ACCOUNT_CLOSED).
Anything elsePaid.

Webhooks​

Send a signed TestEvent from Developers → Webhooks → Send test in the portal, or with the API:

curl -X POST https://sandbox.api.billpay.et/api/v1/checkout/webhooks/{webhookId}/test \
-H "x-api-key: $BILLPAY_API_KEY"

To receive webhooks on your own computer, use a tunnel such as ngrok. Its inspector at http://localhost:4040 also lets you replay a delivery, which is an easy way to test duplicate events.

Before you go live​

Run each of these at least once:

#TestHowYou should see
1Successful paymentPay with 0911234567CAPTURED, PaymentCaptured, order marked paid
2Refused, then paid0911000000, then 0911234567Still one payment, ending CAPTURED
3Refused 3 times0911001111 three timesFAILED and PaymentFailed with failureCode CUSTOMER_DECLINED
4Customer gives upCancel on the checkout pageLands on your cancelUrl. CANCELLED, no webhook
5Nobody paysCreate a payment, don't open the checkout, wait 30 minutesEXPIRED, picked up by your status check
6Slow customer0911008888Your return page waits, then shows paid
7Duplicate webhookReplay a delivery from ngrok within 5 minutesHandled once, answered 200 both times
8Fake webhookSend a request with a wrong signature400, order unchanged
9Partial refundRefund 10.00COMPLETED and PaymentRefunded
10Refused refundRefund 10.13FAILED, balance restored