Skip to content

Sandbox simulations

In the sandbox you play the outside world. These endpoints work only with a test key (with a live key they answer 404). Each changes the same records and sends the same webhooks as the real event would, marked "mode": "TEST".

Fund one of your sandbox wallets, as a transfer from another bank would:

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/inflows \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount": "100000.00", "sender_name": "Test Donor" }'

wallet_id picks the wallet (your main wallet by default). Each call is a new transfer.

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/account-numbers/INV-1001/pay \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY"

A one-off number is paid what it still expects. Send {"amount": "…"} to pay less (underpay) or more (overpay). A permanent number needs amount. You hear account_number.paid, .underpaid or .overpaid. Closed and expired numbers refuse payments.

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/checkouts/ORD-77/complete \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY"

…/complete approves the card: the checkout is PAID and you hear payment.succeeded. …/decline declines it: FAILED and payment.failed. Only a pending checkout can be completed or declined (422 CHECKOUT_NOT_PENDING).

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/customers/{customer_id}/pay \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount": "40000.00" }'

Pays a test payer’s permanent number: their wallet is credited and you hear customer.funded. Pay a one-off funding number with POST /merchant/sandbox/funding-accounts/{reference}/pay (its amount unless you send amount).

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/mandates/MND-STU-001/approve \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY"

The mandate becomes ACTIVE (mandate.updated). Then run a debit:

Terminal window
curl -X POST https://api.catholicpay.example/api/v1/merchant/sandbox/mandates/MND-STU-001/debit \
-H "Authorization: Bearer $CATHOLICPAY_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{ "fail": true }'

Its amount unless you send amount; "fail": true makes the debit fail. You hear mandate.debited.

No test card numbers are needed: the card’s result is the one you choose with complete or decline.