Skip to main content
Buy Now, Pay Later in one flow: hold the customer’s down-payment in escrow, open a wallet and link a loan to it, disburse into that wallet, then capture the down-payment. This is the production-verified path.
Requires an active customer (KYC). Bearer token from /generate-token; re-token on 401.

Flow

open + approve + activate wallet


fund wallet ─▶ reserve down-payment (escrow hold)


create loan ──linkWalletId──▶ approve ─▶ disburse-to-savings (credits the wallet)


commit the down-payment hold
1

Open the customer's wallet

WALLET=$(curl -s -X POST $BRIDGE_URL/v1/wms/wallets \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d "{\"customerId\":\"$CUSTOMER_ID\",\"productCode\":\"SAV2\"}")
WALLET_ID=$(echo $WALLET | jq -r .id)

curl -s -X POST $BRIDGE_URL/v1/wms/wallets/$WALLET_ID/approve  -H "Authorization: Bearer $TOKEN" -d '{}'
curl -s -X POST $BRIDGE_URL/v1/wms/wallets/$WALLET_ID/activate -H "Authorization: Bearer $TOKEN" -d '{}'
Use a published wallet product code from GET /v1/wms/products.
2

Reserve the down-payment

With the wallet funded (see Collections), place a hold for the down-payment.
RES=$(curl -s -X POST $BRIDGE_URL/v1/wms/wallets/$WALLET_ID/reserve \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "amount": 20000, "currency": "TZS", "reference": "BNPL-ORDER-77", "description": "Down payment" }')
TX_ID=$(echo $RES | jq -r .transactionId)
3

Create the loan, linked to the wallet

Pass linkWalletId so disbursements and repayments route through this wallet.
LOAN=$(curl -s -X POST $BRIDGE_URL/v1/lms/loans \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d "{\"customerId\":\"$CUSTOMER_ID\",\"productCode\":\"DF-001\",\"principal\":100000,\"linkWalletId\":\"$WALLET_ID\"}")
LOAN_ID=$(echo $LOAN | jq -r .loanId)
Use a published loan product code from GET /v1/lms/products.
4

Approve and disburse into the wallet

curl -s -X POST $BRIDGE_URL/v1/lms/loans/$LOAN_ID/approve \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d "{\"approvedOnDate\":\"$(date +%F)\"}"

curl -s -X POST $BRIDGE_URL/v1/lms/loans/$LOAN_ID/disburse-to-savings \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d "{\"disbursedOnDate\":\"$(date +%F)\"}"
5

Capture the down-payment

With the goods delivered / order confirmed, commit the hold.
curl -s -X POST $BRIDGE_URL/v1/wms/transactions/$TX_ID/commit \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "note": "Down payment captured" }'
If the order falls through instead, POST /v1/wms/transactions/$TX_ID/release.

Manage repayments

Servicing a BNPL loan is identical to the Lending recipe — the loan is the system of record whether or not a wallet is linked. Two ways to settle each installment:
1

Collect from the customer

Trigger a mobile collection and wait for COMPLETED — see Payment collections. You get back a gatewayReference (your transactionId).
2

Record the repayment (verified)

Post the collected payment against the loan. Bridge re-verifies it on the gateway before touching the ledger; idempotent on gatewayReference.
curl -s -X POST $BRIDGE_URL/v1/lms/loans/$LOAN_ID/submit-payment \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "gatewayReference": "ORDER_12345", "amount": 35000, "fspId": "CLICKPESA" }'
Already reconciled the payment yourself? Record it directly with /repayments using a receiptNumber as the idempotency key.
3

Track the schedule

curl -s $BRIDGE_URL/v1/lms/loans/$LOAN_ID/schedule -H "Authorization: Bearer $TOKEN" | jq
Watch installments move from due to paid as repayments post.

Auto-sweep (when available)

Because the loan is linked to a wallet, the platform can attach a standing instruction that sweeps each due installment straight from the wallet — so you just keep the wallet funded (via Collections) and never call a repayment endpoint. This auto-sweep is provisioned by the one-call createWalletProductCode shortcut, which is temporarily unavailable pending a platform fix. Until then, settle installments explicitly with submit-payment as above — same result, one extra call.
Disbursed loans can’t be cleanly un-disbursed. If a later step fails after disbursement, resolve forward (release the hold, contact Support) rather than rolling back the loan.