Testing Settlement Requests
Test settlement quotes, same-currency and cross-currency settlement requests, pagination, idempotency, and cancellation in sandbox.
Use sandbox credentials and https://api-v2.honeycoin.app/api/sandbox/b2b/settlement-requests as {settlementRequestsBaseUrl}. Generate a sandbox bearer token at POST https://api-v2.honeycoin.app/api/sandbox/b2b/auth/generate-bearer-token.
Sandbox uses the exact same request and response contracts as production, completely isolated in the sandbox database, with two intentional differences for fast testing:
- No production feature-flag gate: Sandbox settlement request endpoints are open to all sandbox accounts without requiring production account activation.
- No balance checks: Sandbox accounts do not carry live treasury balances, so
POST /does not enforceINSUFFICIENT_BALANCEin sandbox. All schema checks, currency/country resolution, destination validation, quote matching, quote expiry, single-use quote consumption,externalReferenceuniqueness, andX-Idempotency-Keyrules are enforced identically to production.
End-to-End Checklist
All paths below are relative to {settlementRequestsBaseUrl}.
- Test same-currency bank/momo/SWIFT submission: Call
POST /withsenderCurrency === receiverCurrency, a valid matchingdestination, a uniqueexternalReference, and noquoteId. Confirm201 Created,exchangeRate: 1,quoteId: null, andexpiresAt: null. - Test cross-currency quote generation: Call
POST /quoteswith differingsenderCurrencyandreceiverCurrency(for example,KES→USDC). Savedata.idasquoteIdand checkdata.expiresAt. - Inspect the quote: Call
GET /quotes/{quoteId}and confirmstatus: "active". - Consume the quote on request creation: Call
POST /with the matchingsenderAmount, currencies,settlementMethod: "crypto",destination.type: "crypto",quoteId,externalReference, andX-Idempotency-Key. Confirm201 Createdand a non-nullexpiresAttimestamp. - Confirm single-use quote consumption: Call
GET /quotes/{quoteId}and confirmstatus: "consumed"andsettlementRequestIdmatches the request created in step 4. - List & paginate requests: Call
GET /?status=pending&limit=10and verify filtering andpagination.nextCursor. - Cancel a pending request: Call
POST /{id}/cancelwith{ "reason": "Sandbox test cancel" }andX-Idempotency-Key, then confirmstatus: "cancelled"andcancelledAt.
Example: Cross-Currency Sandbox Flow
1. Generate a Sandbox Quote
curl --request POST \
--url https://api-v2.honeycoin.app/api/sandbox/b2b/settlement-requests/quotes \
--header 'Authorization: Bearer YOUR_SANDBOX_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"senderAmount": 130000,
"senderCurrency": "KES",
"receiverCurrency": "USDC"
}'2. Submit the Sandbox Settlement Request
curl --request POST \
--url https://api-v2.honeycoin.app/api/sandbox/b2b/settlement-requests \
--header 'Authorization: Bearer YOUR_SANDBOX_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: sbx-sr-create-0194f1c2-7b3a' \
--data '{
"senderAmount": 130000,
"senderCurrency": "KES",
"receiverCurrency": "USDC",
"settlementMethod": "crypto",
"quoteId": "QUOTE_ID_FROM_STEP_1",
"externalReference": "sbx-settle-001",
"destination": {
"type": "crypto",
"walletAddress": "0x1234567890abcdef1234567890abcdef12345678",
"chain": "BASE"
}
}'Scenarios to Verify
| Scenario | Setup | Expected Behavior |
|---|---|---|
| Same-currency settlement | POST / with KES → KES, settlementMethod: "bank", no quoteId | Returns 201 Created with exchangeRate: 1, quoteId: null, expiresAt: null |
quoteId on same-currency request | POST / with KES → KES and any quoteId | Returns 400 VALIDATION_ERROR |
Missing quoteId on cross-currency | POST / with KES → USDC and no quoteId | Returns 400 VALIDATION_ERROR |
| Quote parameter mismatch | POST / with a senderAmount or currency different from the quote | Returns 400 VALIDATION_ERROR |
| Reusing a consumed quote | Submit a second POST / with the same quoteId and a new externalReference | Returns 409 Conflict |
Duplicate externalReference | Submit a second POST / with the same externalReference and a new X-Idempotency-Key | Returns 409 Conflict |
Safe retry with X-Idempotency-Key | Re-send the identical POST / with the same X-Idempotency-Key | Replays the original 201 Created response without creating a duplicate |
| Cancel and re-cancel | Call POST /{id}/cancel twice with different X-Idempotency-Key headers | First returns 200 OK (status: "cancelled"); second returns 409 Conflict |
| Strict validation | Pass an unknown top-level field, unknown destination key, or query param on POST / | Returns 400 VALIDATION_ERROR |
Related Guides
Updated about 16 hours ago
