Skip to content

Test payments

Test your Baiyar integration in the sandbox: simulate paid, failed and expired payments, and run webhook scenarios without real money.


The sandbox uses a simulated provider so you can try the payment flow without real money. Make sure the dashboard is set to Sandbox before you start.

With a test key, a pending payment ends the way you tell it:

Terminal window
curl "https://api.baiyar.com/v1/sandbox/payments/$PAYMENT_ID/simulate" \
-H "Authorization: Bearer $BAIYAR_KEY" \
-H "Content-Type: application/json" \
-d '{ "outcome": "paid" }'
outcome Result
paid The payment is paid; payment.succeeded is sent, and settlement follows.
failed The payment fails; payment.failed is sent.
expired The payment expires unpaid; payment.expired is sent.

A live key cannot use this endpoint.

In the dashboard you can do the same: in the sandbox, open a pending payment under Transactions and decide how it ends.

One payment: how to pay, its timeline and, in the sandbox, how it should end.

  • Register your endpoint (public HTTPS; use a tunnel from your laptop) and press Test to receive a webhook.test event.
  • Run the scenarios under Developer Tools → Simulations against your endpoint. The sandbox sends events for a successful, failed or expired payment, events out of order, and the same event twice. These scenarios do not create stored payments. See Webhooks.
  • Verify the signature exactly as in production: it is the same in the sandbox.
  1. Your payment code sends an Idempotency-Key and stores the payment id with your order.
  2. Your webhook handler verifies the signature over the raw body, answers 2xx quickly, ignores a repeated event id, and reads the payment’s current status instead of trusting the order of events.
  3. You handle every error code you can get, by error.code (see Errors).
  4. Live keys are in your secret store, not in the code, and restricted to your server addresses.