---
updatedAt: 2026-09-30T17:50:34.235Z
---

Fetch the complete documentation index at: https://docs.avvio.xyz/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# Simulate a payment outcome

`POST https://api.avvio.xyz/business/api/v1/checkout/organizations/{orgId}/payments/{paymentId}/simulate`

Force an outcome on a sandbox payment.

Move a simulated payment now, instead of waiting out its timeline. A
test suite cannot sit for sixty seconds waiting for a chargeback, and a
chargeback is the outcome worth rehearsing most.

`chargeback` is `checkout_payment.reversed`: money taken back after
you booked it. `refund` is a full refund. `fail` declines a payment
still in flight.

Safe alongside the timeline: both go through the same status-guarded
transition, so forcing a chargeback and then letting the timeline run
delivers exactly one `checkout_payment.reversed`. `moved` is false when
the transition was refused (a terminal payment, or somebody got there first). That is normal and not an error.

## Parameters

- `orgId` (path, required) — The opaque organization id issued to you, normally CUID-shaped (for example `cmsx…`). It is not an `org_`-prefixed alias. Pass it unchanged in every organization-scoped path.
- `paymentId` (path, required) — The payment id, or the `reference` you created it with. A reference used on more than one of your links is ambiguous and answers `409`; pass the id instead.
- `Idempotency-Key` (header, required) — A unique value per logical operation, 1-255 chars of `A-Z a-z 0-9 _ . : -`. Reuse it to retry. Same key with the same body replays the stored response; same key with a *different* body is a `409`, because answering with the first call's result would hand you a receipt for a payout you did not request. A `4xx` releases the key, so you can fix the body and reuse it. **Reuse it; do not generate one per attempt.** A key minted per attempt defeats replay entirely: every retry looks like a new request, so every retry pays. We also watch for an identical body arriving under a *different* key within 15 minutes and refuse it with `DUPLICATE_REQUEST_DETECTED`. Records are kept for 7 days. That is a retention window only: there is no path where an expired key is re-executed.

## Example

```bash
IDEMPOTENCY_KEY=$(uuidgen)  # new key per call; reuse it only to retry this exact request
curl -s -X POST "$AVVIO_BASE_URL/checkout/organizations/$AVVIO_ORG_ID/payments/$paymentId/simulate" \
  -H "x-api-key: $AVVIO_API_KEY" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "content-type: application/json" \
  -d '{
        "action": "chargeback"
      }'
```

## Responses

- `200` — Where the payment stands, and whether this call moved it.
- `400` — `LIVE_MODE_UNSUPPORTED`: a live key on a sandbox-only operation. These manufacture payments and the events that follow them, so they are refused a live credential whatever organization the path names. Use an `avvio_test_*` key. Also `BAD_REQUEST` when the link cannot take a payment (a draft, a paused or expired link, or one that has already taken the maximum number of simulated payments), `LINK_EXPIRED`, `VALIDATION_ERROR`, `IDEMPOTENCY_KEY_REQUIRED` and `IDEMPOTENCY_KEY_INVALID`.
- `401` — The key was refused. Nothing ran. - `UNAUTHORIZED`: missing, invalid or revoked, or a key on a route that does not accept one. - `KEY_EXPIRED`: the key passed the expiry it was issued with. Issue a new one; an expired key cannot be rotated. - `KEY_IP_NOT_ALLOWED`: the key is pinned to source addresses and this request came from another.
- `403` — A valid key that may not make this write. Nothing was changed. - `FORBIDDEN`: the key belongs to a different organization, **or** your business has not completed verification to accept payments; `detail` says which. - `ACCOUNT_BLOCKED`: API access for your organization is suspended. - `LIVE_KEY_ORG_NOT_APPROVED`: a live key, before we have approved your business verification. Use a test key until then. - `INSUFFICIENT_SCOPE`: a read-only key.
- `404` — No such link or product in this organization, or the id belongs to another one.
- `409` — Either the key was reused with a different body (`IDEMPOTENCY_KEY_CONFLICT`: use a new key), or the first request with this key is still running (`IDEMPOTENCY_KEY_REQUEST_IN_PROGRESS`: back off and retry the same key).
- `429` — Too many requests. The default ceiling is **100 requests per minute per API credential** on a 60-second window. High-volume payout and reconciliation routes declare a 600/minute override, and batch submission a 30/minute ceiling. A separate 2,000/minute per-source-IP abuse ceiling always applies. Obey `Retry-After`; it is in seconds and is authoritative. A 429 means the request was refused before the handler ran. Retry reads normally; retry an idempotent mutation with its same `Idempotency-Key`.

Machine contract: [partner-checkout.openapi.yaml](/partner-checkout.openapi.yaml), operation `simulateCheckoutPaymentOutcome`.
