Skip to main content
The sandbox environment is a full simulator: it accepts the same requests as production and returns the same response shapes. Use it to test your end-to-end integration without moving any real money. This guide describes the deterministic recipes the simulator uses to drive specific outcomes.
Sandbox does not send webhooks to your configured endpoints — for any event type. A webhook endpoint belongs to the account, not to an environment, so sandbox activity is never delivered to it. Drive a sandbox integration by polling GET /v1/payments/{paymentId} and by forcing terminal outcomes with POST /v1/payments/{paymentId}/simulate. See Webhooks in sandbox.

Selecting sandbox

Send a request with a ypk_test_... key. There is no separate URL — the same https://api.yuvexpay.com base URL serves both environments.

Payment behavior matrix

The terminal status is not reached at creation. POST /v1/payments always returns the non-terminal status — NEW, or PENDING_METHOD_SELECTION for a hosted checkout. A status check runs about 5 seconds later and writes the outcome; in the hosted flow, 5 seconds after the payer selects a method. The one exception is a free order: a headless payment whose coupon covers the whole amount is already FREE in the create response. The outcome is picked from the decimal cents of the payment amount you send, the same way for PIX, CARD and BOLETO. The cents are read before any fee passed to the payer: with passFeeToPayer, an amount of R$ 49.02 is read as .02 whatever total the payer is shown. With line items, a coupon or an order bump, the cents are read from the final amount, after the discount and the payer’s changes on the checkout. So R$ 49.02 simulates a payment the payer never completes, R$ 99.04 an expired one, and any value ending in .01 (R$ 5.01, R$ 49.01, R$ 1000.01) a successful one, whatever the method. Nothing is charged in sandbox: no card is debited and no real boleto is registered.

Card and boleto

A sandbox card payment goes through the hosted checkout like any card payment. The checkout accepts any test card number that passes the Luhn check, for example 4111 1111 1111 1111. The full card number and the security code are never stored, and sandbox never asks for a 3D Secure challenge. A card charged in sandbox is always recorded as credit in methodData.cardFundingType, whatever test card number you use, so debit cannot be produced in sandbox. A sandbox boleto carries a test digitable line and barcode in the valid format. GET /v1/payments/{paymentId}/boleto returns a generated test PDF that says it must not be paid.

Forcing a terminal status

POST /v1/payments/{paymentId}/simulate moves a sandbox payment to a terminal status immediately, whatever its amount and payment method. Use it instead of waiting for the check, and to reach outcomes the cents table cannot produce. It requires the payments:write scope and a ypk_test_ key. A production key is rejected with 403 and error code FORBIDDEN. A production payment id is not visible to a sandbox key at all, so it returns 404.
Any other value is rejected with 400. The response is the updated payment, in the same shape as GET /v1/payments/{paymentId}. X-Idempotency-Key is optional here — honoured when you send it, not required.

Withdrawal behavior matrix

Sandbox withdrawals follow the same convention. The status is reached synchronously, so a GET /v1/withdrawals/{withdrawalId} right after creation already shows it:

Refund behavior matrix

Sandbox refunds work for PIX, CARD and BOLETO payments, through POST /v1/payments/{paymentId}/refund and the REFUNDED simulation. The decimal portion is read from the payment amount, the amount you sent when you created the payment, not from the refund request amount.

Webhooks in sandbox

Sandbox does not send webhooks to your configured endpoints. This holds for every event type in the event table — PAYMENT_PAID included — and for both payments and withdrawals. Sandbox activity is never delivered to an endpoint you registered.
A webhook endpoint belongs to the account, not to an environment: there is no separate sandbox endpoint and no separate sandbox secret. So a sandbox charge that reaches PAID produces no PAYMENT_PAID delivery, and waiting for one will not succeed. Read the resource instead. Poll GET /v1/payments/{paymentId} or GET /v1/withdrawals/{withdrawalId} and read status. A withdrawal is already terminal on the first read; a payment reaches its terminal status about 5 seconds after creation, or immediately if you call /simulate, which is the fastest way to put a charge into the state your handler is waiting for. To exercise your verifier — signature, timestamp skew, header parsing — use the Enviar teste (Send test) button on the endpoint in the dashboard. It delivers a real, correctly signed TEST event to your endpoint with X-Webhook-Event: TEST and a body of {"event":"webhook.test","createdAt":"…","data":{"message":"…","livemode":false}}. That is the one delivery a sandbox-only account receives. See the Webhooks guide for the verification algorithm.

Sandbox idempotency keys

Idempotency keys are scoped per environment. The same key value can be reused in sandbox and production without colliding — they’re separate keyspaces. Within sandbox, the same rules apply as in production: a 24-hour TTL and a payload match on retries.

Limits and isolation

  • Sandbox payments and withdrawals never affect your production balance or reports.
  • Receipts are generated for sandbox payments and withdrawals, and the lookup is scoped to the key’s environment: a ypk_test_ key resolves only sandbox ids and a ypk_live_ key only production ids. The other environment returns 404 even for an id on your own account.
  • Statements are built from the real-money ledger, which sandbox transactions never touch. GET /v1/documents/statements with a sandbox key therefore returns an empty statement with zero balances, not your production ledger.
  • Splits stay inside one environment. A sandbox payment can only split to a company that is in sandbox mode, and a production payment only to a production company; the other direction is always rejected, never silently ignored, with 400 SPLIT_RELATIONSHIP_PENDING when the recipient has not accepted in this environment and 400 SPLIT_ENVIRONMENT_MISMATCH when it had. Consent is per environment, so a recipient that accepted in production still has to accept in sandbox. The invite flow is identical in sandbox but the KYC gate does not apply, so two unverified sandbox companies can exercise the whole cycle. An approved split platform is the one exception to the sandbox-mode rule: it connects a seller in sandbox by sending a ypk_test_ key of its approved company in X-Split-Platform-Key, under the same fee cap as in production and with no notification to the seller, and its production company can then be named in that seller’s sandbox payments. A sandbox split never touches a production balance, statement or report.
  • Coupons belong to one environment: a ypk_test_ key manages sandbox coupons, and a sandbox payment takes only those. A sandbox free order is never charged the free order fee.
  • Webhooks are not delivered — see Webhooks in sandbox.
  • Sandbox keys cannot access production data, and vice versa.

Going live

When your integration is stable:
  1. Take the company out of sandbox with Sair do sandbox (Leave sandbox) in the dashboard (owner or admin only), then create a ypk_live_ key under Desenvolvedores > Chaves de API (Developers > API keys).
  2. Configure your webhook endpoint and store its secret. This is the point at which webhooks start being delivered at all — verify the endpoint with the dashboard’s Enviar teste (Send test) button before opening real traffic.
  3. Swap the API key in your environment variables.
  4. Run a small live transaction end-to-end before opening real traffic.