Sandbox & testing
The sandbox is the same platform, running the same code, with a simulated mobile-money provider instead of a real one. Build and test your whole integration there before going live.
Getting a sandbox account#
FinFort creates your merchant account and sends you a base URL and an API key. (There is no self-service sign-up yet.) Ask us to put you on the industry template that matches your business, so the windows, fees and amounts you test with are the ones you'll sell with.
What is simulated#
- Payments. A charge to a MoMo number succeeds instantly — there is no handset prompt. Hosted checkout shows its "approve on your phone" step, then moves on at once.
- Failures. A MoMo number ending in
0000makes every charge fail. That is how you exercise the failed-downpayment path (status: "FAILED",downpayment.failed, hosted checkout'sFAILED). - Everything else is real: eligibility, limits, schedules, fees, settlement, refunds, webhooks and signatures behave exactly as in production.
Things to know before you test#
- Use a fresh phone number for every test customer. A customer's credit limit is shared across all merchants and tracks them by phone number. New customers start at UGX 3,000,000 of total borrowing; a number you reuse across many test plans will hit
over_customer_limit(which is also a useful thing to test). - You can't fast-forward time. There is no clock control, so due dates, the 3-day grace period and automatic cancellation can't be exercised on demand. To test how your handler reacts to events such as
installment.reminder.dueortransaction.cancelled, build the payload yourself (the events table lists everydatashape) and sign it with the SDK'ssignWebhook.POST /v1/webhook-endpoints/{id}/testsends a real signedwebhook.testevent to check your URL and signature handling. - Your webhook URL must be reachable from the sandbox. If your handler is on your laptop, use a tunnel.
- Reconciliation and collections happen on a schedule, not at once.
A test checklist#
| Scenario | How |
|---|---|
| Happy path | Quote → eligibility → create plan → charge installment 2 → … → transaction.completed |
| Decline: amount | An amount outside your plan's range → 422, amount_out_of_range |
| Decline: your rule | merchantEligible: false with a merchantEligibleReason |
| Decline: limit | Repeat plans for one phone number until over_customer_limit |
| Failed downpayment | A phone number ending 0000 → 201 with status: "FAILED" |
| Retry safety | Send the same create request twice → the same plan, one charge |
| Declined by the customer's balance | Charge an installment for a …0000 number (create the plan with another, then update the customer's phone) |
| Full refund | POST …/refund with a reason |
| Partial refund | POST …/refund with amount and an Idempotency-Key; send it twice |
| Webhook security | Send your endpoint a payload with a wrong, missing or stale signature — it must reject it |
| Hosted checkout | Create a session, open the url, and finish, decline and fail one |
Before you go live#
Nothing in your code needs to change between environments: only the base URL, API key and webhook secret. Make sure that:
- your webhook handler verifies signatures, de-duplicates on
eventId, and is idempotent; - you handle every decline reason with a sensible message and a fallback payment method;
- you store the plan id (
transactionId) andmerchantReferenceagainst your order; - you never log or expose the API key or webhook secret.
Sandbox and live keys#
Keys say where they work: bnpl_test_… for the sandbox, bnpl_live_… for live. A sandbox key sent to live (or the
other way round) is refused with 401 code: "wrong_environment_key". The sandbox never moves real money.
Moving time forward#
POST /v1/sandbox/transactions/{id}/advance with { "days": 14 } moves one of your plans that many days ahead — due
dates, grace periods and late fees — and runs the overdue rules, so you can see reminders, late fees, cancellation and
forfeiture without waiting. Sandbox only (404 live). PHP: $bnpl->sandbox->advance($id, 14); Node:
bnpl.request('POST', …).
SDKs and Postman#
- PHP (CodeIgniter 3, Laravel, plain PHP 7.2+): the
finfort/bnpl-phppackage (sdk-php/in this repository). - Node:
@finfort/bnpl-sdk. - Postman: import
postman/finfort-bnpl.postman_collection.json, setbaseUrlandapiKey.
Test numbers#
In the sandbox and in staging, these mobile-money numbers never move money: their payments are simulated with a fixed outcome, and no SMS is ever sent to them. Any other number is treated as real (in staging, a real MTN or Airtel payment). There are 100 of each, so every tester can use their own.
| Outcome | MTN | Airtel |
|---|---|---|
| Approved at once | 0770000100 – 0770000199 | 0750000100 – 0750000199 |
| Declined by the customer | 0770000200 – 0770000299 | 0750000200 – 0750000299 |
| Not enough money | 0770000300 – 0770000399 | 0750000300 – 0750000399 |
| Approved after about 45 s (the callback path) | 0770000400 – 0770000499 | 0750000400 – 0750000499 |
| Never answered (pending, then failed after 5 min) | 0770000500 – 0770000599 | 0750000500 – 0750000599 |
Test numbers have no registered wallet name, so the ID name check is skipped for them. In staging, only plans paid from test numbers can be moved in time.
