{
    "openapi": "3.1.0",
    "info": {
        "title": "ChargeNation Retail API",
        "version": "1.0.0",
        "description": "Take a payment \u2014 as a sale, or as a pre-authorisation captured\nlater \u2014 then refund, void, and read transactions.\n\n## Getting set up\n\n### Authentication\n\nA bearer token, created in the merchant portal under\n**Developer \u2192 API keys**. The token carries the merchant;\nthere is no merchant parameter anywhere in this API. Tick\n**Test key** while you build \u2014 a test key can never charge a\nreal card.\n\n### Amounts\n\nInteger minor units: `4995` is $49.95. Sending `49.95` is a\nvalidation error rather than a 49-cent charge.\n\n### Currencies and countries\n\nA charge is in its MID's main currency unless you send\n`currency`, which must be one that MID bills in \u2014 anything else\nis refused with `currency_not_accepted`. With no `mid_id`, we\npick one of your MIDs that bills in the currency you asked\nfor. A MID can also be limited to buyers in certain countries,\nchecked against the billing address (`country_not_accepted`).\n`GET \/mids` lists each MID's `currencies` and `countries`.\nEvery transaction records the currency it was billed in.\n\n## Taking a payment\n\nEvery example goes to `POST \/transactions` with your bearer\ntoken and an `Idempotency-Key`. Amounts are in minor units, so\n`4995` is $49.95.\n\n### A sale \u2014 charge the card now\n\n```http\nPOST \/api\/v1\/transactions\nAuthorization: Bearer YOUR_API_KEY\nIdempotency-Key: order-1001\n\n{\n  \"amount\": 4995,\n  \"card_number\": \"4111111111111111\",\n  \"exp_month\": 12,\n  \"exp_year\": 2030,\n  \"cvv\": \"123\",\n  \"email\": \"ada@example.com\",\n  \"first_name\": \"Ada\",\n  \"last_name\": \"Lovelace\",\n  \"address_line_1\": \"1 Market Street\",\n  \"city\": \"San Francisco\",\n  \"state\": \"CA\",\n  \"postcode\": \"94105\",\n  \"country\": \"US\",\n  \"customer_ip\": \"203.0.113.7\",\n  \"external_ref\": \"ORDER-1001\"\n}\n```\n\nThe response is the transaction: `\"type\": \"sale\"`,\n`\"status\": \"approved\"`. The money is taken. Keep `data.id` to\nrefund it later and `data.card.token` to bill this card again.\n\n**Send `customer_ip`** \u2014 your customer's IP address, as your\ncheckout saw it \u2014 on every charge your customer makes online.\nThe processor's fraud checks use it. Without it no address is\nsent: the request comes from your server, and your server's\naddress would make every customer look like the same person.\n\n### A pre-authorisation \u2014 hold the money, take it later\n\nThe same request with `\"capture\": false`. The issuer holds the\namount on the card but nothing is taken yet \u2014 use it when you\ncharge on dispatch, or when the final amount is not known.\n\n```http\nPOST \/api\/v1\/transactions\nAuthorization: Bearer YOUR_API_KEY\nIdempotency-Key: order-1002-auth\n\n{\n  \"amount\": 12000,\n  \"capture\": false,\n  \"card_token\": \"card_8fK2\u2026\",\n  \"external_ref\": \"ORDER-1002\"\n}\n```\n\nThe response has `\"type\": \"authorize\"` and\n`\"status\": \"approved\"`. Keep `data.id` \u2014 that is what you\ncapture. **Capture within 7 days**: after that the hold is\nvoided automatically, releasing the customer's money, you get\na `transaction.voided` webhook, and a capture is refused with\n`authorization_expired`.\n\n### A capture \u2014 take what the pre-authorisation is holding\n\n```http\nPOST \/api\/v1\/transactions\/{id}\/capture\nAuthorization: Bearer YOUR_API_KEY\nIdempotency-Key: order-1002-capture\n\n{\n  \"amount\": 11500\n}\n```\n\nOmit `amount` to take everything that was authorised, or send\nless and the rest is released. An authorisation is captured\nonce. The response is a new transaction with\n`\"type\": \"capture\"` and `parent_transaction_id` pointing at the\nauthorisation, which moves to `\"status\": \"captured\"`.\n\nFrom here the **capture** is the transaction that holds the\nmoney: refund it with `POST \/transactions\/{capture id}\/refund`.\n\n### Changed your mind?\n\n- **Before capture** \u2014 `POST \/transactions\/{id}\/void` on the\n  authorisation releases the hold. Nothing was taken, nothing\n  is charged.\n- **Before settlement** \u2014 void the sale or capture.\n- **After settlement** \u2014 refund all or part of it.\n\nAuthorisations expire at the card issuer, typically after about\nseven days, so capture promptly.\n\n## Test cards\n\nWith a **test key**, these numbers produce the outcome in their\nrow on **every test MID** \u2014 our simulated gateway and NMI's\nsandbox alike, so the same tests run whichever processor a\nMID is on. Use any future expiry and any security code. On a\nlive MID they are just invalid cards.\n\n| Outcome | Visa | Mastercard | American Express | Discover |\n|---|---|---|---|---|\n| Approved | `4242424242424242` | `5555555555554444` | `378282246310005` | `6011111111111117` |\n| Declined by the issuer | `4000000000000002` | `5100000000000008` | `370000000000002` | `6011000000000004` |\n| Declined \u2014 insufficient funds | `4000000000009995` | `5100000000009991` | `370000000009995` | `6011000000009997` |\n| Declined \u2014 expired card | `4000000000000069` | `5100000000000065` | `370000000000069` | `6011000000000061` |\n| Declined \u2014 wrong security code | `4000000000000127` | `5100000000000123` | `370000000000127` | `6011000000000129` |\n| Error \u2014 rejected by the gateway | `4000000000000119` | `5100000000000115` | `370000000000119` | `6011000000000111` |\n\nOn a simulated test MID, any other valid number is approved \u2014\nand on any card, the cents of the amount still choose a\nfailure: ending `.05` declines, `.10` is insufficient funds,\n`.30` times out and `.51` is rejected by the gateway. On NMI's\nsandbox, any other number gets NMI's own answer.\n\n## Billing a saved card\n\nEvery sale returns a token at `data.card.token`. Send it as\n`card_token` with an amount and nothing else \u2014 the number, its\nexpiry and the billing address are already ours. It works on\nany of your MIDs. `GET \/customers\/{id}` lists a customer's\ncards and their tokens.\n\nThe card behind a token is held by us, encrypted under our own\nkey, and never leaves. You are not storing card data by keeping\na token, and we never hand back more of the number than the\nfirst six and last four digits.\n\n## Billing a new card\n\nA new card needs a billing address. When you send\n`card_number`, also send `email`, `first_name`, `last_name`,\n`address_line_1`, `city`, `postcode` and `country` \u2014 plus\n`state` for US, CA and AU addresses. AVS is checked against it.\nBilling with `customer_id` or `payment_method_id` reuses the\naddress already on file.\n\n## Declines and errors\n\nA decline is a `201`, not an error. The transaction was\ncreated; read `status` and `approved` to see what the processor\nsaid, and `response_message` for why. An HTTP `4xx` means the\nrequest itself was wrong, and nothing was charged.\n\n**`status: pending` means we did not hear back from the\nprocessor** \u2014 a timeout or a dropped connection. The card may\nhave been charged. **Do not retry it with a new key.** We ask\nthe processor within minutes and record what it did; `GET` the\ntransaction to see the outcome. A refund, capture or void with\nno answer returns `422` with code `outcome_unknown`, and nothing\nmore can be done to that transaction until it is resolved.\n\n## Retries and idempotency\n\nEvery write requires an `Idempotency-Key` header (up to 64\ncharacters; a UUID is ideal). Keys belong to your account and\nare honoured for 24 hours:\n\n- **Same key, same request** \u2014 the original response comes\n  back, same status and body, with `Idempotency-Replayed: true`.\n  Nothing is charged twice. A request that timed out can be\n  retried this way safely.\n- **Same key, different request** \u2014 `422`\n  `idempotency_key_reused`. Use a new key for a new request.\n- **While the first is still running** \u2014 `409`\n  `idempotency_key_in_use`. Wait a moment and retry.\n- **After a 5xx** \u2014 the key is released; the retry runs again.\n\nA refund, capture or void is a new request and needs a new key.\n\n## Errors\n\nEvery error has the same shape, with a real HTTP status:\n\n```json\n{ \"error\": { \"code\": \"no_rate\", \"message\": \"\u2026\", \"details\": {} }, \"correlation_id\": \"\u2026\" }\n```\n\n`details` appears on validation errors, listing each field.\nQuote `correlation_id` to support.\n\n| Status | Code | Meaning |\n|---|---|---|\n| 400 | `idempotency_key_required`, `idempotency_key_too_long` | The header is missing or too long |\n| 401 | `unauthenticated` | No valid key |\n| 403 | `forbidden` | The key lacks the ability for this endpoint |\n| 404 | `not_found` | No such record for this key's account and mode |\n| 409 | `idempotency_key_in_use` | The same request is still running |\n| 422 | `validation_failed` | Fields are missing or wrong \u2014 see `details` |\n| 422 | `idempotency_key_reused` | The key was used for a different request |\n| 422 | `card_data_in_url` | Card details were in the URL \u2014 nothing was charged; treat the card as exposed |\n| 422 | `mid_mode_mismatch` | A test key on a live MID, or a live key on a test MID |\n| 422 | `no_mid`, `mid_not_granted` | No MID to bill, or that MID is not yours |\n| 422 | `currency_not_accepted`, `country_not_accepted` | The MID does not take that currency or that buyer's country |\n| 422 | `no_rate` | Live payments are not set up yet on this account |\n| 422 | `merchant_inactive` | The account is suspended |\n| 422 | `authorization_expired` | The authorisation was not captured in time and has been, or is about to be, voided |\n| 422 | `card_removed` | The card was removed and cannot be billed; take the number again |\n| 422 | `payment_intent_unavailable` | The payment was already made, cancelled, closed after five declines, or expired |\n| 422 | `billing_details_required` | A new card needs a billing address; send it when setting up the payment or with the card |\n| 403 | `merchant_unavailable` | The key's merchant account is suspended or closed |\n| 422 | `invalid_card`, `card_not_found`, `card_not_chargeable`, `customer_not_found`, `no_payment_method` | The card or customer could not be used |\n| 422 | `not_refundable`, `already_refunded`, `already_captured`, `not_voidable`, `not_chargebackable`, `already_charged_back` | That action does not apply to this transaction now |\n| 422 | `gateway_refused` | The processor declined a refund, capture or void |\n| 422 | `outcome_unknown` | No answer from the processor about an earlier action \u2014 do not retry |\n| 422 | `transaction_busy` | Another action on this transaction is in progress \u2014 retry shortly |\n| 429 | `rate_limited` | Over 600 sales, captures, refunds and voids a minute on one key \u2014 wait for `Retry-After` seconds |\n| 503 | `card_service_unavailable` | Card details cannot be read right now; nothing was charged |\n| 500 | `server_error` | Ours \u2014 quote the `correlation_id` |\n\nA **declined sale or authorisation is a `201`**, not an error:\nthe transaction exists with `status: declined`. A declined\nrefund, capture or void is a `422` `gateway_refused`.\n\n## Taking payments on your website\n\nOur card form sits in your checkout page, but it is served by\nChargeNation: the card number and security code go from your\ncustomer's browser straight to us and never touch your servers\n\u2014 the lightest PCI scope there is (SAQ A).\n\n**1. A publishable key.** In the portal, **Developer \u2192 API \u2192\nPublishable keys**: give it the web addresses your checkout runs\non (`https:\/\/shop.example.com`). It can show the card form on\nthose sites and complete payments your server set up \u2014 nothing\nelse, so it is safe in page source. Test keys complete test\npayments only.\n\n**2. Your server sets up the payment** with your API key, and\nhands the `client_secret` to the page:\n\n```http\nPOST \/api\/v1\/payment-intents\nAuthorization: Bearer YOUR_API_KEY\nIdempotency-Key: order-1001\n\n{\n  \"amount\": 4995,\n  \"external_ref\": \"ORDER-1001\",\n  \"email\": \"ada@example.com\",\n  \"first_name\": \"Ada\",\n  \"last_name\": \"Lovelace\",\n  \"address_line_1\": \"1 Market Street\",\n  \"city\": \"San Francisco\",\n  \"state\": \"CA\",\n  \"postcode\": \"94105\",\n  \"country\": \"US\"\n}\n```\n\nThe billing details are optional here: anything you leave out,\nsend from the page with the card instead.\n\n**3. The page shows the card form and pays:**\n\n```html\n<div id=\"card\"><\/div>\n<button id=\"pay\">Pay $49.95<\/button>\n<p id=\"message\"><\/p>\n\n<script src=\"https:\/\/pay.chargenation.io\/v1\/chargenation.js\"><\/script>\n<script>\n  const cn = ChargeNation('pk_live_...');\n  const card = cn.card({ style: { fontSize: '16px', color: '#1a1a1a' } });\n  card.mount('#card');\n\n  document.getElementById('pay').addEventListener('click', async () => {\n    const { paymentIntent, error } = await cn.confirmCardPayment(CLIENT_SECRET, { card });\n\n    if (error) {\n      \/\/ Declined, or the card is incomplete: show it, let them try another card.\n      document.getElementById('message').textContent = error.message;\n    } else {\n      \/\/ paymentIntent.status === 'succeeded'\n      window.location = '\/order\/complete';\n    }\n  });\n<\/script>\n```\n\n**4. Fulfil the order from your server**, not from the page: on\nthe `payment_intent.succeeded` webhook, or by checking\n`GET \/payment-intents\/{id}` shows `status: succeeded`.\n\nA payment can be retried with another card after a decline, up\nto five times, and lasts 24 hours. With `\"capture\": false` the\ncard is only held; capture its transaction as usual. The same\ntest cards work in test mode. Style options: `color`,\n`placeholderColor`, `invalidColor`, `backgroundColor`,\n`borderColor`, `fontSize`, `fontFamily`, `borderRadius`,\n`padding`. The form also emits `change` (with `complete` and\n`error`), `focus`, `blur` and `ready`.\n\n## The payment page\n\nNo checkout of your own? Send the shopper to ours. Every payment\nintent comes back with a `checkout_url` \u2014 open it, put it behind\na Pay button, or send it in an email or a text. The shopper sees\nyour name (or logo), the amount and your `description`, enters\ntheir billing address if you did not send it and their card, and\npays. Give `success_url` and they come back to it with\n`?payment_intent=pi_\u2026` added; give `cancel_url` for a Back\nlink. Without `success_url` the page shows its own receipt.\n\n```http\nPOST \/api\/v1\/payment-intents\nAuthorization: Bearer YOUR_API_KEY\nIdempotency-Key: invoice-2041\n\n{\n  \"amount\": 4995,\n  \"description\": \"Invoice 2041\",\n  \"external_ref\": \"INV-2041\",\n  \"success_url\": \"https:\/\/shop.example.com\/thanks\",\n  \"cancel_url\": \"https:\/\/shop.example.com\/cart\"\n}\n```\n\nThe `checkout_url` carries the client secret after a `#`, which\nbrowsers never send to a server, so it is shown once, like the\nsecret. Set your logo and button colour in the portal under\n**Developer \u2192 Payment page**; until then the page uses\nChargeNation's. As with the card form, fulfil the order on the\nwebhook or `GET \/payment-intents\/{id}`, not on the redirect alone.\n\n## Webhooks\n\nWe POST an event to your endpoint when something happens to\nyour money: a payment approved, declined or failed; captured,\nrefunded, voided or charged back; a payout sent. Add endpoints\nin the merchant portal under **Developer \u2192 Webhooks \u2192\nEndpoints**. A test endpoint receives test events only, a live\none live events only.\n\nEvery event has the same envelope. `data.object` is what the\nevent is about \u2014 a transaction in exactly the shape the API\nreturns it, or a payout. For a capture, refund, void or\nchargeback, `data.related` is the transaction it acted on;\notherwise it is `null`. This is a partial refund:\n\n```json\n{\n    \"id\": \"evt_01jcz7k2v4q8m3x9t6r5w1n0ab\",\n    \"type\": \"transaction.refunded\",\n    \"created_at\": \"2026-11-09T18:42:07+00:00\",\n    \"livemode\": true,\n    \"data\": {\n        \"object\": {\n            \"id\": 48377,\n            \"type\": \"refund\",\n            \"status\": \"approved\",\n            \"amount\": 1500,\n            \"currency\": \"USD\",\n            \"refunded_amount\": 0,\n            \"refundable_amount\": 1500,\n            \"approved\": true,\n            \"response_code\": \"100\",\n            \"response_message\": \"Approved\",\n            \"auth_code\": null,\n            \"avs_response_code\": null,\n            \"cvv_response_code\": null,\n            \"processor_transaction_id\": \"10423100007\",\n            \"mid_id\": 3,\n            \"customer_id\": 1207,\n            \"payment_method_id\": 2210,\n            \"parent_transaction_id\": 48213,\n            \"external_ref\": null,\n            \"payment_intent\": null,\n            \"source\": null,\n            \"test\": false,\n            \"processed_at\": \"2026-11-09T18:42:06+00:00\",\n            \"created_at\": \"2026-11-09T18:42:05+00:00\",\n            \"card\": {\n                \"token\": \"card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe\",\n                \"brand\": \"visa\",\n                \"masked\": \"411111\u2022\u2022\u2022\u20221111\",\n                \"bin\": \"411111\",\n                \"last_four\": \"1111\",\n                \"exp_month\": 12,\n                \"exp_year\": 2029\n            }\n        },\n        \"related\": {\n            \"id\": 48213,\n            \"type\": \"sale\",\n            \"status\": \"partially_refunded\",\n            \"amount\": 4995,\n            \"currency\": \"USD\",\n            \"refunded_amount\": 1500,\n            \"refundable_amount\": 3495,\n            \"approved\": true,\n            \"response_code\": \"100\",\n            \"response_message\": \"Approved\",\n            \"auth_code\": \"831207\",\n            \"avs_response_code\": \"Y\",\n            \"cvv_response_code\": \"M\",\n            \"processor_transaction_id\": \"10422981543\",\n            \"mid_id\": 3,\n            \"customer_id\": 1207,\n            \"payment_method_id\": 2210,\n            \"parent_transaction_id\": null,\n            \"external_ref\": \"order-1001\",\n            \"payment_intent\": null,\n            \"source\": null,\n            \"test\": false,\n            \"processed_at\": \"2026-11-07T15:20:44+00:00\",\n            \"created_at\": \"2026-11-07T15:20:43+00:00\",\n            \"card\": {\n                \"token\": \"card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe\",\n                \"brand\": \"visa\",\n                \"masked\": \"411111\u2022\u2022\u2022\u20221111\",\n                \"bin\": \"411111\",\n                \"last_four\": \"1111\",\n                \"exp_month\": 12,\n                \"exp_year\": 2029\n            }\n        }\n    }\n}\n```\n\n**Answer with any 2xx within ten seconds**, before doing any\nslow work of your own. Anything else \u2014 another status, a\nredirect, a timeout \u2014 is retried after 1 and 5 minutes, then\n30 minutes, 2, 6 and 12 hours, then daily: about three days in\nall. After that the endpoint is switched off and your account's\nOwners are emailed; switch it back on under **Endpoints**.\n\n**Expect repeats and any order.** The same event can arrive more\nthan once, and a refund can arrive before the sale it refunds.\nUse the event `id` to skip one you have handled, and the\nobject's `status` rather than the order of arrival.\n\n**Missed some?** `GET \/events` lists every event, newest first,\nand `GET \/events\/{id}` fetches one \u2014 the same bodies your\nendpoint received. Every delivery \u2014 the body we sent, your\nresponse code and any error \u2014 is under **Developer \u2192 Webhooks \u2192\nDeliveries** in the portal, with **Resend**.\n\n## Webhook events\n\n| Event | When | `data.object` | `data.related` |\n|---|---|---|---|\n| `transaction.approved` | A sale or authorisation was approved \u2014 including one that was pending and has now been settled with the processor | The sale or authorisation | \u2014 |\n| `transaction.declined` | A sale or authorisation was declined | The sale or authorisation | \u2014 |\n| `transaction.failed` | A sale or authorisation failed, or never reached the processor | The sale or authorisation | \u2014 |\n| `transaction.captured` | An authorisation was captured | The capture | The authorisation |\n| `transaction.refunded` | A refund went through, in full or in part | The refund | The sale or capture |\n| `transaction.voided` | A payment or authorisation was voided | The void | What was voided |\n| `transaction.charged_back` | A customer disputed a payment | The chargeback | The sale or capture |\n| `payment_intent.succeeded` | A customer paid through the card form, the payment page or a payment link \u2014 sent once, alongside the transaction's own `transaction.approved` | The payment intent | Its transaction |\n| `payout.sent` | We sent you a payout | The payout | \u2014 |\n| `ping` | **Send a test event** in the portal | \u2014 | \u2014 |\n\nChargeNation can switch an event type off for your account. One\nthat is off is not recorded or sent, and is not offered when you\nadd an endpoint. An endpoint set to receive every event gets\nevery type your account has, including ones added later.\n\nA payout:\n\n```json\n{\n    \"id\": \"evt_01jcw3f8r2m6k9t4x7q1z5n8cd\",\n    \"type\": \"payout.sent\",\n    \"created_at\": \"2026-11-05T16:00:02+00:00\",\n    \"livemode\": true,\n    \"data\": {\n        \"object\": {\n            \"id\": 9120,\n            \"amount\": 1284650,\n            \"currency\": \"USD\",\n            \"method\": \"ach\",\n            \"reference\": \"ACH-20261105-0042\",\n            \"statement_period\": \"2026-10\",\n            \"sent_at\": \"2026-11-05T16:00:00+00:00\"\n        },\n        \"related\": null\n    }\n}\n```\n\n## Verifying webhook signatures\n\nEvery request carries a `ChargeNation-Signature` header:\n\n```\nChargeNation-Signature: t=1762713727,v1=1ae0b6757aa86f9cdb868614b92cfe432f3109dae760151b5c773294b6b2b968\n```\n\n`t` is when we signed it, in Unix seconds. `v1` is the\nhex HMAC-SHA256 of `t`, a full stop, and the **raw request\nbody**, keyed with the endpoint's signing secret (`whsec_\u2026`,\nshown once when you add the endpoint or make a new one).\n\n1. Read the raw body before any JSON parsing \u2014 re-encoding it\n   changes the bytes and the signature will not match.\n2. Compute the HMAC of `t + \".\" + body` with your secret.\n3. Compare it with `v1` in constant time.\n4. Reject a `t` more than five minutes from now, so a captured\n   request cannot be replayed later.\n\n**Check your code** with secret `whsec_test`, `t` = `1762713727`\nand body `{\"id\":\"evt_test\",\"type\":\"ping\"}`: the signature is\n`1ae0b6757aa86f9cdb868614b92cfe432f3109dae760151b5c773294b6b2b968`.\n\n```php\n$header = $_SERVER['HTTP_CHARGENATION_SIGNATURE'] ?? '';\nparse_str(str_replace(',', '&', $header), $parts);\n$body = file_get_contents('php:\/\/input');\n$expected = hash_hmac('sha256', $parts['t'].'.'.$body, $secret);\n\n$ok = isset($parts['t'], $parts['v1'])\n    && hash_equals($expected, $parts['v1'])\n    && abs(time() - (int) $parts['t']) <= 300;\n```\n\n```js\n\/\/ Node: express.raw({ type: 'application\/json' }) keeps req.body as the raw bytes\nconst crypto = require('crypto');\nconst parts = Object.fromEntries(req.get('ChargeNation-Signature').split(',').map(p => p.split('=')));\nconst expected = crypto.createHmac('sha256', secret).update(`${parts.t}.`).update(req.body).digest('hex');\n\nconst ok = expected.length === (parts.v1 || '').length\n  && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))\n  && Math.abs(Date.now() \/ 1000 - Number(parts.t)) <= 300;\n```\n\n```python\n# raw_body is the request body, as bytes\nimport hashlib, hmac, time\nparts = dict(p.split('=', 1) for p in header.split(','))\nexpected = hmac.new(secret.encode(), parts['t'].encode() + b'.' + raw_body, hashlib.sha256).hexdigest()\n\nok = hmac.compare_digest(expected, parts.get('v1', '')) and abs(time.time() - int(parts['t'])) <= 300\n```\n\nMaking a new signing secret in the portal replaces the old one\nat once: update your code at the same time.\n\n## Tracing a request\n\nEvery response carries `X-Correlation-Id`. Send your own and we\nwill use it, which is what ties your logs to ours when\nsomething needs explaining."
    },
    "servers": [
        {
            "url": "https:\/\/gateway.chargenation.io\/api\/v1"
        }
    ],
    "security": [
        {
            "http": []
        }
    ],
    "paths": {
        "\/customers": {
            "get": {
                "operationId": "customer.index",
                "description": "Everyone you have billed, newest first. Filter by `email` or by your own\n`external_ref` to find one you already hold rather than creating a\nduplicate.",
                "summary": "List customers",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "email",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "external_ref",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `CustomerResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/CustomerResource"
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "first": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "first",
                                                "last",
                                                "prev",
                                                "next"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "from": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "links": {
                                                    "type": "array",
                                                    "description": "Generated paginator links.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "url": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            }
                                                        },
                                                        "required": [
                                                            "url",
                                                            "label",
                                                            "active"
                                                        ]
                                                    }
                                                },
                                                "path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Base path for paginator generated URLs."
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "description": "Number of items shown per page.",
                                                    "minimum": 0
                                                },
                                                "to": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Number of the last item in the slice.",
                                                    "minimum": 1
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of items being paginated.",
                                                    "minimum": 0
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "from",
                                                "last_page",
                                                "links",
                                                "path",
                                                "per_page",
                                                "to",
                                                "total"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "links",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "customer.store",
                "description": "Optional: billing a new card creates one for you. Worth doing up front if\nyou want to hold your own reference against them before their first\norder.",
                "summary": "Create a customer",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CustomerRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`CustomerResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/CustomerResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/customers\/{customer}": {
            "get": {
                "operationId": "customer.show",
                "description": "Each card carries a `token`. Send it as `card_token` when billing and you\nneed nothing else \u2014 no number, no expiry, no address.",
                "summary": "Fetch one customer, with their stored cards",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "description": "The customer ID",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The cards come with a single customer but not with a list: this is\nwhere an integration looks to find a token to bill again.\n\n\n\n`CustomerResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#\/components\/schemas\/CustomerResource"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "cards"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "patch": {
                "operationId": "customer.update",
                "description": "Send only what changes; send `null` to clear a field. The billing\naddress here is what goes to the processor the next time you bill one\nof their saved cards.",
                "summary": "Update a customer",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "description": "The customer ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CustomerRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`CustomerResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#\/components\/schemas\/CustomerResource"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "cards"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/customers\/{customer}\/cards": {
            "post": {
                "operationId": "customer.storeCard",
                "description": "Stored encrypted under our key, exactly as a card billed for the first\ntime is, and nothing is sent to a processor \u2014 the card is checked the\nfirst time you bill it. Returns the card with its `token`: send it as\n`card_token` to bill it. Never send the security code here; it is not\nstored, ever.",
                "summary": "Save a card without charging it",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "description": "The customer ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/StoreCardRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`PaymentMethodResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/PaymentMethodResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/customers\/{customer}\/cards\/{card}": {
            "delete": {
                "operationId": "customer.removeCard",
                "description": "By its `token`. The card number is wiped and the card can never be\nbilled again; there is no undo. Its brand, last four and history stay,\nand refunds and voids of past payments still work. Removing a card that\nis already removed changes nothing.",
                "summary": "Remove a saved card",
                "tags": [
                    "Customer"
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "description": "The customer ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "card",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`PaymentMethodResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/PaymentMethodResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/events": {
            "get": {
                "operationId": "event.index",
                "description": "Newest first, 25 to a page (`per_page` up to 100). A test key lists test\nevents, a live key live ones. Filter by `type` (for example\n`transaction.refunded`) and by `from` \/ `to` (ISO 8601, UTC). Each item\nis exactly the body your webhook endpoint received.",
                "summary": "List events",
                "tags": [
                    "Event"
                ],
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Events, newest first.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "data": [
                                                {
                                                    "id": "evt_01jcz7k2v4q8m3x9t6r5w1n0ab",
                                                    "type": "transaction.refunded",
                                                    "created_at": "2026-11-09T18:42:07+00:00",
                                                    "livemode": true,
                                                    "data": {
                                                        "object": {
                                                            "id": 48377,
                                                            "type": "refund",
                                                            "status": "approved",
                                                            "amount": 1500,
                                                            "currency": "USD",
                                                            "refunded_amount": 0,
                                                            "refundable_amount": 1500,
                                                            "approved": true,
                                                            "response_code": "100",
                                                            "response_message": "Approved",
                                                            "auth_code": null,
                                                            "avs_response_code": null,
                                                            "cvv_response_code": null,
                                                            "processor_transaction_id": "10423100007",
                                                            "mid_id": 3,
                                                            "customer_id": 1207,
                                                            "payment_method_id": 2210,
                                                            "parent_transaction_id": 48213,
                                                            "external_ref": null,
                                                            "payment_intent": null,
                                                            "source": null,
                                                            "test": false,
                                                            "processed_at": "2026-11-09T18:42:06+00:00",
                                                            "created_at": "2026-11-09T18:42:05+00:00",
                                                            "card": {
                                                                "token": "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe",
                                                                "brand": "visa",
                                                                "masked": "411111\u2022\u2022\u2022\u20221111",
                                                                "bin": "411111",
                                                                "last_four": "1111",
                                                                "exp_month": 12,
                                                                "exp_year": 2029
                                                            }
                                                        },
                                                        "related": {
                                                            "id": 48213,
                                                            "type": "sale",
                                                            "status": "partially_refunded",
                                                            "amount": 4995,
                                                            "currency": "USD",
                                                            "refunded_amount": 1500,
                                                            "refundable_amount": 3495,
                                                            "approved": true,
                                                            "response_code": "100",
                                                            "response_message": "Approved",
                                                            "auth_code": "831207",
                                                            "avs_response_code": "Y",
                                                            "cvv_response_code": "M",
                                                            "processor_transaction_id": "10422981543",
                                                            "mid_id": 3,
                                                            "customer_id": 1207,
                                                            "payment_method_id": 2210,
                                                            "parent_transaction_id": null,
                                                            "external_ref": "order-1001",
                                                            "payment_intent": null,
                                                            "source": null,
                                                            "test": false,
                                                            "processed_at": "2026-11-07T15:20:44+00:00",
                                                            "created_at": "2026-11-07T15:20:43+00:00",
                                                            "card": {
                                                                "token": "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe",
                                                                "brand": "visa",
                                                                "masked": "411111\u2022\u2022\u2022\u20221111",
                                                                "bin": "411111",
                                                                "last_four": "1111",
                                                                "exp_month": 12,
                                                                "exp_year": 2029
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "id": "evt_01jcw3f8r2m6k9t4x7q1z5n8cd",
                                                    "type": "payout.sent",
                                                    "created_at": "2026-11-05T16:00:02+00:00",
                                                    "livemode": true,
                                                    "data": {
                                                        "object": {
                                                            "id": 9120,
                                                            "amount": 1284650,
                                                            "currency": "USD",
                                                            "method": "ach",
                                                            "reference": "ACH-20261105-0042",
                                                            "statement_period": "2026-10",
                                                            "sent_at": "2026-11-05T16:00:00+00:00"
                                                        },
                                                        "related": null
                                                    }
                                                }
                                            ],
                                            "meta": {
                                                "current_page": 1,
                                                "per_page": 25,
                                                "total": 2,
                                                "last_page": 1
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string",
                                                        "examples": [
                                                            "evt_01jcz7k2v4q8m3x9t6r5w1n0ab"
                                                        ]
                                                    },
                                                    "type": {
                                                        "type": "string",
                                                        "examples": [
                                                            "transaction.refunded"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "examples": [
                                                            "2026-11-09T18:42:07+00:00"
                                                        ]
                                                    },
                                                    "livemode": {
                                                        "type": "boolean",
                                                        "examples": [
                                                            true
                                                        ]
                                                    },
                                                    "data": {
                                                        "type": "object",
                                                        "properties": {
                                                            "object": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            48377
                                                                        ]
                                                                    },
                                                                    "type": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "refund"
                                                                        ]
                                                                    },
                                                                    "status": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "approved"
                                                                        ]
                                                                    },
                                                                    "amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            1500
                                                                        ]
                                                                    },
                                                                    "currency": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "USD"
                                                                        ]
                                                                    },
                                                                    "refunded_amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            0
                                                                        ]
                                                                    },
                                                                    "refundable_amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            1500
                                                                        ]
                                                                    },
                                                                    "approved": {
                                                                        "type": "boolean",
                                                                        "examples": [
                                                                            true
                                                                        ]
                                                                    },
                                                                    "response_code": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "100"
                                                                        ]
                                                                    },
                                                                    "response_message": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "Approved"
                                                                        ]
                                                                    },
                                                                    "auth_code": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "avs_response_code": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "cvv_response_code": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "processor_transaction_id": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "10423100007"
                                                                        ]
                                                                    },
                                                                    "mid_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            3
                                                                        ]
                                                                    },
                                                                    "customer_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            1207
                                                                        ]
                                                                    },
                                                                    "payment_method_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            2210
                                                                        ]
                                                                    },
                                                                    "parent_transaction_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            48213
                                                                        ]
                                                                    },
                                                                    "external_ref": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "payment_intent": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "source": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "test": {
                                                                        "type": "boolean",
                                                                        "examples": [
                                                                            false
                                                                        ]
                                                                    },
                                                                    "processed_at": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "2026-11-09T18:42:06+00:00"
                                                                        ]
                                                                    },
                                                                    "created_at": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "2026-11-09T18:42:05+00:00"
                                                                        ]
                                                                    },
                                                                    "card": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "token": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe"
                                                                                ]
                                                                            },
                                                                            "brand": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "visa"
                                                                                ]
                                                                            },
                                                                            "masked": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "411111\u2022\u2022\u2022\u20221111"
                                                                                ]
                                                                            },
                                                                            "bin": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "411111"
                                                                                ]
                                                                            },
                                                                            "last_four": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "1111"
                                                                                ]
                                                                            },
                                                                            "exp_month": {
                                                                                "type": "integer",
                                                                                "examples": [
                                                                                    12
                                                                                ]
                                                                            },
                                                                            "exp_year": {
                                                                                "type": "integer",
                                                                                "examples": [
                                                                                    2029
                                                                                ]
                                                                            }
                                                                        },
                                                                        "required": [
                                                                            "token",
                                                                            "brand",
                                                                            "masked",
                                                                            "bin",
                                                                            "last_four",
                                                                            "exp_month",
                                                                            "exp_year"
                                                                        ]
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "type",
                                                                    "status",
                                                                    "amount",
                                                                    "currency",
                                                                    "refunded_amount",
                                                                    "refundable_amount",
                                                                    "approved",
                                                                    "response_code",
                                                                    "response_message",
                                                                    "auth_code",
                                                                    "avs_response_code",
                                                                    "cvv_response_code",
                                                                    "processor_transaction_id",
                                                                    "mid_id",
                                                                    "customer_id",
                                                                    "payment_method_id",
                                                                    "parent_transaction_id",
                                                                    "external_ref",
                                                                    "payment_intent",
                                                                    "source",
                                                                    "test",
                                                                    "processed_at",
                                                                    "created_at",
                                                                    "card"
                                                                ]
                                                            },
                                                            "related": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            48213
                                                                        ]
                                                                    },
                                                                    "type": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "sale"
                                                                        ]
                                                                    },
                                                                    "status": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "partially_refunded"
                                                                        ]
                                                                    },
                                                                    "amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            4995
                                                                        ]
                                                                    },
                                                                    "currency": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "USD"
                                                                        ]
                                                                    },
                                                                    "refunded_amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            1500
                                                                        ]
                                                                    },
                                                                    "refundable_amount": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            3495
                                                                        ]
                                                                    },
                                                                    "approved": {
                                                                        "type": "boolean",
                                                                        "examples": [
                                                                            true
                                                                        ]
                                                                    },
                                                                    "response_code": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "100"
                                                                        ]
                                                                    },
                                                                    "response_message": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "Approved"
                                                                        ]
                                                                    },
                                                                    "auth_code": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "831207"
                                                                        ]
                                                                    },
                                                                    "avs_response_code": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "Y"
                                                                        ]
                                                                    },
                                                                    "cvv_response_code": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "M"
                                                                        ]
                                                                    },
                                                                    "processor_transaction_id": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "10422981543"
                                                                        ]
                                                                    },
                                                                    "mid_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            3
                                                                        ]
                                                                    },
                                                                    "customer_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            1207
                                                                        ]
                                                                    },
                                                                    "payment_method_id": {
                                                                        "type": "integer",
                                                                        "examples": [
                                                                            2210
                                                                        ]
                                                                    },
                                                                    "parent_transaction_id": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "external_ref": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "order-1001"
                                                                        ]
                                                                    },
                                                                    "payment_intent": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "source": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "test": {
                                                                        "type": "boolean",
                                                                        "examples": [
                                                                            false
                                                                        ]
                                                                    },
                                                                    "processed_at": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "2026-11-07T15:20:44+00:00"
                                                                        ]
                                                                    },
                                                                    "created_at": {
                                                                        "type": "string",
                                                                        "examples": [
                                                                            "2026-11-07T15:20:43+00:00"
                                                                        ]
                                                                    },
                                                                    "card": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "token": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe"
                                                                                ]
                                                                            },
                                                                            "brand": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "visa"
                                                                                ]
                                                                            },
                                                                            "masked": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "411111\u2022\u2022\u2022\u20221111"
                                                                                ]
                                                                            },
                                                                            "bin": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "411111"
                                                                                ]
                                                                            },
                                                                            "last_four": {
                                                                                "type": "string",
                                                                                "examples": [
                                                                                    "1111"
                                                                                ]
                                                                            },
                                                                            "exp_month": {
                                                                                "type": "integer",
                                                                                "examples": [
                                                                                    12
                                                                                ]
                                                                            },
                                                                            "exp_year": {
                                                                                "type": "integer",
                                                                                "examples": [
                                                                                    2029
                                                                                ]
                                                                            }
                                                                        },
                                                                        "required": [
                                                                            "token",
                                                                            "brand",
                                                                            "masked",
                                                                            "bin",
                                                                            "last_four",
                                                                            "exp_month",
                                                                            "exp_year"
                                                                        ]
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "type",
                                                                    "status",
                                                                    "amount",
                                                                    "currency",
                                                                    "refunded_amount",
                                                                    "refundable_amount",
                                                                    "approved",
                                                                    "response_code",
                                                                    "response_message",
                                                                    "auth_code",
                                                                    "avs_response_code",
                                                                    "cvv_response_code",
                                                                    "processor_transaction_id",
                                                                    "mid_id",
                                                                    "customer_id",
                                                                    "payment_method_id",
                                                                    "parent_transaction_id",
                                                                    "external_ref",
                                                                    "payment_intent",
                                                                    "source",
                                                                    "test",
                                                                    "processed_at",
                                                                    "created_at",
                                                                    "card"
                                                                ]
                                                            }
                                                        },
                                                        "required": [
                                                            "object",
                                                            "related"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "type",
                                                    "created_at",
                                                    "livemode",
                                                    "data"
                                                ]
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "examples": [
                                                        1
                                                    ]
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "examples": [
                                                        25
                                                    ]
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "examples": [
                                                        1
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "per_page",
                                                "total",
                                                "last_page"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/events\/{event}": {
            "get": {
                "operationId": "event.show",
                "description": "By its id, `evt_\u2026` \u2014 the `id` in a webhook body.",
                "summary": "Retrieve an event",
                "tags": [
                    "Event"
                ],
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The event, exactly as your endpoint received it.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "examples": [
                                        {
                                            "data": {
                                                "id": "evt_01jcz7k2v4q8m3x9t6r5w1n0ab",
                                                "type": "transaction.refunded",
                                                "created_at": "2026-11-09T18:42:07+00:00",
                                                "livemode": true,
                                                "data": {
                                                    "object": {
                                                        "id": 48377,
                                                        "type": "refund",
                                                        "status": "approved",
                                                        "amount": 1500,
                                                        "currency": "USD",
                                                        "refunded_amount": 0,
                                                        "refundable_amount": 1500,
                                                        "approved": true,
                                                        "response_code": "100",
                                                        "response_message": "Approved",
                                                        "auth_code": null,
                                                        "avs_response_code": null,
                                                        "cvv_response_code": null,
                                                        "processor_transaction_id": "10423100007",
                                                        "mid_id": 3,
                                                        "customer_id": 1207,
                                                        "payment_method_id": 2210,
                                                        "parent_transaction_id": 48213,
                                                        "external_ref": null,
                                                        "payment_intent": null,
                                                        "source": null,
                                                        "test": false,
                                                        "processed_at": "2026-11-09T18:42:06+00:00",
                                                        "created_at": "2026-11-09T18:42:05+00:00",
                                                        "card": {
                                                            "token": "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe",
                                                            "brand": "visa",
                                                            "masked": "411111\u2022\u2022\u2022\u20221111",
                                                            "bin": "411111",
                                                            "last_four": "1111",
                                                            "exp_month": 12,
                                                            "exp_year": 2029
                                                        }
                                                    },
                                                    "related": {
                                                        "id": 48213,
                                                        "type": "sale",
                                                        "status": "partially_refunded",
                                                        "amount": 4995,
                                                        "currency": "USD",
                                                        "refunded_amount": 1500,
                                                        "refundable_amount": 3495,
                                                        "approved": true,
                                                        "response_code": "100",
                                                        "response_message": "Approved",
                                                        "auth_code": "831207",
                                                        "avs_response_code": "Y",
                                                        "cvv_response_code": "M",
                                                        "processor_transaction_id": "10422981543",
                                                        "mid_id": 3,
                                                        "customer_id": 1207,
                                                        "payment_method_id": 2210,
                                                        "parent_transaction_id": null,
                                                        "external_ref": "order-1001",
                                                        "payment_intent": null,
                                                        "source": null,
                                                        "test": false,
                                                        "processed_at": "2026-11-07T15:20:44+00:00",
                                                        "created_at": "2026-11-07T15:20:43+00:00",
                                                        "card": {
                                                            "token": "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe",
                                                            "brand": "visa",
                                                            "masked": "411111\u2022\u2022\u2022\u20221111",
                                                            "bin": "411111",
                                                            "last_four": "1111",
                                                            "exp_month": 12,
                                                            "exp_year": 2029
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string",
                                                    "examples": [
                                                        "evt_01jcz7k2v4q8m3x9t6r5w1n0ab"
                                                    ]
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "examples": [
                                                        "transaction.refunded"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "examples": [
                                                        "2026-11-09T18:42:07+00:00"
                                                    ]
                                                },
                                                "livemode": {
                                                    "type": "boolean",
                                                    "examples": [
                                                        true
                                                    ]
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "object": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        48377
                                                                    ]
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "refund"
                                                                    ]
                                                                },
                                                                "status": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "approved"
                                                                    ]
                                                                },
                                                                "amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        1500
                                                                    ]
                                                                },
                                                                "currency": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "USD"
                                                                    ]
                                                                },
                                                                "refunded_amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        0
                                                                    ]
                                                                },
                                                                "refundable_amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        1500
                                                                    ]
                                                                },
                                                                "approved": {
                                                                    "type": "boolean",
                                                                    "examples": [
                                                                        true
                                                                    ]
                                                                },
                                                                "response_code": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "100"
                                                                    ]
                                                                },
                                                                "response_message": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "Approved"
                                                                    ]
                                                                },
                                                                "auth_code": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "avs_response_code": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "cvv_response_code": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "processor_transaction_id": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "10423100007"
                                                                    ]
                                                                },
                                                                "mid_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        3
                                                                    ]
                                                                },
                                                                "customer_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        1207
                                                                    ]
                                                                },
                                                                "payment_method_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        2210
                                                                    ]
                                                                },
                                                                "parent_transaction_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        48213
                                                                    ]
                                                                },
                                                                "external_ref": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "payment_intent": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "source": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "test": {
                                                                    "type": "boolean",
                                                                    "examples": [
                                                                        false
                                                                    ]
                                                                },
                                                                "processed_at": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "2026-11-09T18:42:06+00:00"
                                                                    ]
                                                                },
                                                                "created_at": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "2026-11-09T18:42:05+00:00"
                                                                    ]
                                                                },
                                                                "card": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "token": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe"
                                                                            ]
                                                                        },
                                                                        "brand": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "visa"
                                                                            ]
                                                                        },
                                                                        "masked": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "411111\u2022\u2022\u2022\u20221111"
                                                                            ]
                                                                        },
                                                                        "bin": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "411111"
                                                                            ]
                                                                        },
                                                                        "last_four": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "1111"
                                                                            ]
                                                                        },
                                                                        "exp_month": {
                                                                            "type": "integer",
                                                                            "examples": [
                                                                                12
                                                                            ]
                                                                        },
                                                                        "exp_year": {
                                                                            "type": "integer",
                                                                            "examples": [
                                                                                2029
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "token",
                                                                        "brand",
                                                                        "masked",
                                                                        "bin",
                                                                        "last_four",
                                                                        "exp_month",
                                                                        "exp_year"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "id",
                                                                "type",
                                                                "status",
                                                                "amount",
                                                                "currency",
                                                                "refunded_amount",
                                                                "refundable_amount",
                                                                "approved",
                                                                "response_code",
                                                                "response_message",
                                                                "auth_code",
                                                                "avs_response_code",
                                                                "cvv_response_code",
                                                                "processor_transaction_id",
                                                                "mid_id",
                                                                "customer_id",
                                                                "payment_method_id",
                                                                "parent_transaction_id",
                                                                "external_ref",
                                                                "payment_intent",
                                                                "source",
                                                                "test",
                                                                "processed_at",
                                                                "created_at",
                                                                "card"
                                                            ]
                                                        },
                                                        "related": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        48213
                                                                    ]
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "sale"
                                                                    ]
                                                                },
                                                                "status": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "partially_refunded"
                                                                    ]
                                                                },
                                                                "amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        4995
                                                                    ]
                                                                },
                                                                "currency": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "USD"
                                                                    ]
                                                                },
                                                                "refunded_amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        1500
                                                                    ]
                                                                },
                                                                "refundable_amount": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        3495
                                                                    ]
                                                                },
                                                                "approved": {
                                                                    "type": "boolean",
                                                                    "examples": [
                                                                        true
                                                                    ]
                                                                },
                                                                "response_code": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "100"
                                                                    ]
                                                                },
                                                                "response_message": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "Approved"
                                                                    ]
                                                                },
                                                                "auth_code": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "831207"
                                                                    ]
                                                                },
                                                                "avs_response_code": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "Y"
                                                                    ]
                                                                },
                                                                "cvv_response_code": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "M"
                                                                    ]
                                                                },
                                                                "processor_transaction_id": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "10422981543"
                                                                    ]
                                                                },
                                                                "mid_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        3
                                                                    ]
                                                                },
                                                                "customer_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        1207
                                                                    ]
                                                                },
                                                                "payment_method_id": {
                                                                    "type": "integer",
                                                                    "examples": [
                                                                        2210
                                                                    ]
                                                                },
                                                                "parent_transaction_id": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "external_ref": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "order-1001"
                                                                    ]
                                                                },
                                                                "payment_intent": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "source": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "test": {
                                                                    "type": "boolean",
                                                                    "examples": [
                                                                        false
                                                                    ]
                                                                },
                                                                "processed_at": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "2026-11-07T15:20:44+00:00"
                                                                    ]
                                                                },
                                                                "created_at": {
                                                                    "type": "string",
                                                                    "examples": [
                                                                        "2026-11-07T15:20:43+00:00"
                                                                    ]
                                                                },
                                                                "card": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "token": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "card_Xq7rT2mVb9LkP4sNw8YcJd3FhZa6GuEe"
                                                                            ]
                                                                        },
                                                                        "brand": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "visa"
                                                                            ]
                                                                        },
                                                                        "masked": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "411111\u2022\u2022\u2022\u20221111"
                                                                            ]
                                                                        },
                                                                        "bin": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "411111"
                                                                            ]
                                                                        },
                                                                        "last_four": {
                                                                            "type": "string",
                                                                            "examples": [
                                                                                "1111"
                                                                            ]
                                                                        },
                                                                        "exp_month": {
                                                                            "type": "integer",
                                                                            "examples": [
                                                                                12
                                                                            ]
                                                                        },
                                                                        "exp_year": {
                                                                            "type": "integer",
                                                                            "examples": [
                                                                                2029
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "token",
                                                                        "brand",
                                                                        "masked",
                                                                        "bin",
                                                                        "last_four",
                                                                        "exp_month",
                                                                        "exp_year"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "id",
                                                                "type",
                                                                "status",
                                                                "amount",
                                                                "currency",
                                                                "refunded_amount",
                                                                "refundable_amount",
                                                                "approved",
                                                                "response_code",
                                                                "response_message",
                                                                "auth_code",
                                                                "avs_response_code",
                                                                "cvv_response_code",
                                                                "processor_transaction_id",
                                                                "mid_id",
                                                                "customer_id",
                                                                "payment_method_id",
                                                                "parent_transaction_id",
                                                                "external_ref",
                                                                "payment_intent",
                                                                "source",
                                                                "test",
                                                                "processed_at",
                                                                "created_at",
                                                                "card"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "object",
                                                        "related"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "type",
                                                "created_at",
                                                "livemode",
                                                "data"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/mids": {
            "get": {
                "operationId": "mid.index",
                "description": "One is your default and is used when you do not name a `mid_id`. A MID\ndecides the descriptor on your customer's statement and the currency the\ncard is charged in. Ask us if you need another.",
                "summary": "List the MIDs you can bill through",
                "tags": [
                    "Mid"
                ],
                "responses": {
                    "200": {
                        "description": "Array of `MidResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/MidResource"
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/payment-intents": {
            "post": {
                "operationId": "paymentIntent.store",
                "description": "Create one on your server for each checkout. Then either hand its\n`client_secret` to your page, where `confirmCardPayment` completes it\nwith the card the shopper types into our card form, or send the shopper\nto its `checkout_url`, our payment page. Either way the card never\ntouches your servers. Valid for 24 hours; a payment can be retried\nwith another card after a decline, up to five times.",
                "summary": "Set up a payment for a shopper's browser",
                "tags": [
                    "PaymentIntent"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/PaymentIntentRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`PaymentIntentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/PaymentIntentResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                ""
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/payment-intents\/{paymentIntent}": {
            "get": {
                "operationId": "paymentIntent.show",
                "description": "Check `status` before you fulfil an order: `succeeded` means the money\nwas taken (or held, with `capture: false`). The webhook for its\ntransaction says the same.",
                "summary": "Fetch a payment intent",
                "tags": [
                    "PaymentIntent"
                ],
                "parameters": [
                    {
                        "name": "paymentIntent",
                        "in": "path",
                        "required": true,
                        "description": "The payment intent public id",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`PaymentIntentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/PaymentIntentResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/payment-intents\/{paymentIntent}\/cancel": {
            "post": {
                "operationId": "paymentIntent.cancel",
                "description": "Only one still waiting for a card. The shopper's browser can no longer\ncomplete it.",
                "summary": "Cancel a payment intent",
                "tags": [
                    "PaymentIntent"
                ],
                "parameters": [
                    {
                        "name": "paymentIntent",
                        "in": "path",
                        "required": true,
                        "description": "The payment intent public id",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`PaymentIntentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/PaymentIntentResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/transactions": {
            "get": {
                "operationId": "transaction.index",
                "description": "Newest first, 25 to a page (`per_page` up to 100). A test key lists\ntest transactions and a live key live ones. Filter by `status`, `type`,\n`mid_id`, `customer_id` or `external_ref`, and by `from` \/ `to` \u2014 dates\nor date-times (ISO 8601, UTC) on when the transaction was processed.",
                "summary": "List transactions",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "mid_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    },
                    {
                        "name": "customer_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    },
                    {
                        "name": "external_ref",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "allOf": [
                                                    {
                                                        "$ref": "#\/components\/schemas\/TransactionResource"
                                                    },
                                                    {
                                                        "type": "object",
                                                        "required": [
                                                            "card"
                                                        ]
                                                    }
                                                ]
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "first": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "first",
                                                "last",
                                                "prev",
                                                "next"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "from": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "links": {
                                                    "type": "array",
                                                    "description": "Generated paginator links.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "url": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            }
                                                        },
                                                        "required": [
                                                            "url",
                                                            "label",
                                                            "active"
                                                        ]
                                                    }
                                                },
                                                "path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Base path for paginator generated URLs."
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "description": "Number of items shown per page.",
                                                    "minimum": 0
                                                },
                                                "to": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Number of the last item in the slice.",
                                                    "minimum": 1
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of items being paginated.",
                                                    "minimum": 0
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "from",
                                                "last_page",
                                                "links",
                                                "path",
                                                "per_page",
                                                "to",
                                                "total"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "links",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "transaction.store",
                "description": "By default this is a **sale** \u2014 the money is taken now.\n\nSend `\"capture\": false` for a **pre-authorisation**: the amount is held\non the card and nothing is taken until you call\n`POST \/transactions\/{id}\/capture`. Void the authorisation instead to\nrelease the hold.\n\nPay with a new card (`card_number` plus a billing address), a card we\nalready hold (`card_token`), or a stored `payment_method_id`.\n\nA decline is still a `201` \u2014 read `status` and `approved`.\n\n**Testing?** With a test key, these card numbers give the outcome in their row on every test MID \u2014 our simulated gateway and NMI's sandbox alike. Any future expiry, any security code. On a live MID they are just invalid cards.\n\n| Outcome | Visa | Mastercard | American Express | Discover |\n|---|---|---|---|---|\n| Approved | `4242424242424242` | `5555555555554444` | `378282246310005` | `6011111111111117` |\n| Declined by the issuer | `4000000000000002` | `5100000000000008` | `370000000000002` | `6011000000000004` |\n| Declined \u2014 insufficient funds | `4000000000009995` | `5100000000009991` | `370000000009995` | `6011000000009997` |\n| Declined \u2014 expired card | `4000000000000069` | `5100000000000065` | `370000000000069` | `6011000000000061` |\n| Declined \u2014 wrong security code | `4000000000000127` | `5100000000000123` | `370000000000127` | `6011000000000129` |\n| Error \u2014 rejected by the gateway | `4000000000000119` | `5100000000000115` | `370000000000119` | `6011000000000111` |\n\nOn a simulated test MID, any other valid number is approved, and an amount ending `.05` declines, `.10` is insufficient funds, `.30` times out and `.51` is rejected. On NMI's sandbox, other numbers get NMI's own answer.",
                "summary": "Take a payment: a sale, or a pre-authorisation",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/BillRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The transaction, approved or declined \u2014 read `status`. Keep\n`card.token`: it bills this card again without the number.\n(Scramble publishes this comment; the card relation is loaded so the\ntoken is in the response.)\n\n\n\n`TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#\/components\/schemas\/TransactionResource"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "card"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/transactions\/{transaction}": {
            "get": {
                "operationId": "transaction.show",
                "summary": "Fetch one transaction, with its state-change history",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "transaction",
                        "in": "path",
                        "required": true,
                        "description": "The transaction ID",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#\/components\/schemas\/TransactionResource"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "card",
                                                        "events"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/transactions\/{transaction}\/refunds": {
            "get": {
                "operationId": "transaction.refunds",
                "description": "Every refund made against a sale or capture, oldest first \u2014 approved,\ndeclined or still waiting on the processor. `refunded_amount` on the\ntransaction itself is the total of the approved ones.",
                "summary": "List a transaction's refunds",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "transaction",
                        "in": "path",
                        "required": true,
                        "description": "The transaction ID",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Array of `TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "allOf": [
                                                    {
                                                        "$ref": "#\/components\/schemas\/TransactionResource"
                                                    },
                                                    {
                                                        "type": "object",
                                                        "required": [
                                                            "card"
                                                        ]
                                                    }
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/transactions\/{transaction}\/capture": {
            "post": {
                "operationId": "transaction.capture",
                "description": "Takes money an authorisation (`\"type\": \"authorize\"`) is holding. Omit\n`amount` to take all of it, or send less and the rest is released.\nEach authorisation is captured once.\n\nReturns the capture \u2014 a new transaction with `\"type\": \"capture\"` and\n`parent_transaction_id` set to the authorisation, which moves to\n`\"status\": \"captured\"`. Refund or void the capture from here on, not\nthe authorisation.",
                "summary": "Capture a pre-authorisation",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "transaction",
                        "in": "path",
                        "required": true,
                        "description": "The transaction ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CaptureRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/TransactionResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/transactions\/{transaction}\/refund": {
            "post": {
                "operationId": "transaction.refund",
                "summary": "Refund all or part of a sale or capture",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "transaction",
                        "in": "path",
                        "required": true,
                        "description": "The transaction ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/RefundRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/TransactionResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/transactions\/{transaction}\/void": {
            "post": {
                "operationId": "transaction.void",
                "summary": "Void a transaction that has not yet settled",
                "tags": [
                    "Transaction"
                ],
                "parameters": [
                    {
                        "name": "transaction",
                        "in": "path",
                        "required": true,
                        "description": "The transaction ID",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique key for this request, up to 64 characters \u2014 a UUID is ideal. Retrying with the same key and the same request returns the original response; the same key on a different request is refused (422 idempotency_key_reused).",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "`TransactionResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/TransactionResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "http": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "BillRequest": {
                "type": "object",
                "properties": {
                    "amount": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "currency": {
                        "type": "string",
                        "enum": [
                            "USD",
                            "AUD",
                            "NZD",
                            "GBP",
                            "EUR",
                            "CAD",
                            "SGD",
                            "HKD"
                        ]
                    },
                    "mid_id": {
                        "type": "integer"
                    },
                    "card_token": {
                        "type": "string",
                        "description": "A card we already hold, or a new one. card_token is the one to\nreach for: it is what a previous sale handed back.",
                        "maxLength": 40
                    },
                    "payment_method_id": {
                        "type": "integer"
                    },
                    "card_number": {
                        "type": "string"
                    },
                    "exp_month": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                    },
                    "exp_year": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "cardholder_name": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "cvv": {
                        "type": "string",
                        "description": "Accepted, forwarded to the processor, and discarded. Never stored.",
                        "maxLength": 4
                    },
                    "capture": {
                        "type": "boolean",
                        "description": "false: authorise only \u2014 hold the amount on the card and take it\nlater with POST \/transactions\/{id}\/capture, or release it with a\nvoid. Defaults to true, a sale."
                    },
                    "customer_id": {
                        "type": "integer"
                    },
                    "customer_ref": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "phone": {
                        "type": "string",
                        "maxLength": 32
                    },
                    "address_line_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 255
                    },
                    "first_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "last_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "address_line_1": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "city": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "postcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32
                    },
                    "country": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "state": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 64
                    },
                    "external_ref": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "customer_ip": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Your customer's IP address, as your checkout saw it. Sent to the\nprocessor for its fraud checks \u2014 strongly recommended for any\ncharge your customer makes online. Without it no address is\nsent, rather than your server's, which would make every one of\nyour customers look like the same person."
                    }
                },
                "required": [
                    "amount"
                ],
                "title": "BillRequest"
            },
            "CaptureRequest": {
                "type": "object",
                "properties": {
                    "amount": {
                        "type": "integer",
                        "description": "In minor units. Omit to capture everything that was authorised;\nless releases the rest.",
                        "minimum": 1
                    }
                },
                "title": "CaptureRequest"
            },
            "CustomerRequest": {
                "type": "object",
                "properties": {
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 255
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32
                    },
                    "first_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "last_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "address_line_1": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "address_line_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "city": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "state": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 64
                    },
                    "postcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32
                    },
                    "country": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    }
                },
                "title": "CustomerRequest"
            },
            "CustomerResource": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "first_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "last_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "address_line_1": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "address_line_2": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "city": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "state": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "postcode": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "country": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cards": {
                        "type": "array",
                        "description": "Only where asked for, so a list of a thousand customers does not\ndrag every card behind it.",
                        "items": {
                            "$ref": "#\/components\/schemas\/PaymentMethodResource"
                        }
                    }
                },
                "required": [
                    "id",
                    "external_ref",
                    "email",
                    "phone",
                    "first_name",
                    "last_name",
                    "address_line_1",
                    "address_line_2",
                    "city",
                    "state",
                    "postcode",
                    "country",
                    "created_at"
                ],
                "title": "CustomerResource"
            },
            "MidResource": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "label": {
                        "type": "string"
                    },
                    "descriptor": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "currency": {
                        "type": "string"
                    },
                    "currencies": {
                        "type": "array",
                        "description": "Every currency it bills in, main one first; send one of these\nas `currency` to bill in it.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "countries": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Billing countries it accepts, or null for any.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "is_default": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "id",
                    "label",
                    "descriptor",
                    "currency",
                    "currencies",
                    "countries",
                    "test",
                    "is_default"
                ],
                "title": "MidResource"
            },
            "PaymentIntentRequest": {
                "type": "object",
                "properties": {
                    "amount": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "currency": {
                        "type": "string",
                        "enum": [
                            "USD",
                            "AUD",
                            "NZD",
                            "GBP",
                            "EUR",
                            "CAD",
                            "SGD",
                            "HKD"
                        ]
                    },
                    "mid_id": {
                        "type": "integer"
                    },
                    "capture": {
                        "type": "boolean",
                        "description": "false: authorise only \u2014 the shopper's card is held, and you\ncapture with POST \/transactions\/{id}\/capture. Defaults to true."
                    },
                    "customer_id": {
                        "type": "integer",
                        "description": "Someone you already hold. Otherwise, the billing details below;\nwhatever you leave out, the shopper's browser sends with the\ncard."
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 255
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32
                    },
                    "first_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "last_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "address_line_1": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "address_line_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "city": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "state": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 64
                    },
                    "postcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32
                    },
                    "country": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Shown to the shopper on the payment page, and kept with the\npayment.",
                        "maxLength": 255
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "success_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "description": "For the payment page: where to send the shopper once they have\npaid (with ?payment_intent=pi_\u2026 added), and where \"Back\" goes.\nWithout success_url the page shows its own receipt.",
                        "maxLength": 2048
                    },
                    "cancel_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "maxLength": 2048
                    }
                },
                "required": [
                    "amount"
                ],
                "title": "PaymentIntentRequest"
            },
            "PaymentIntentResource": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "integer"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "capture": {
                        "type": "boolean"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "customer_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "client_secret": {
                        "type": "string",
                        "description": "Hand this to the shopper's browser for confirmCardPayment. It\nlets the browser pay this amount, once \u2014 keep it out of logs."
                    },
                    "checkout_url": {
                        "type": "string",
                        "description": "Our payment page for this payment: send the shopper here, or\nput it in an email or a text. It carries the client secret, so\nit too is shown once."
                    },
                    "success_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cancel_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "transaction_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The charge that completed it, or the last attempt's."
                    },
                    "attempts": {
                        "type": "integer"
                    },
                    "last_error": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "code": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "message": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
                    "livemode": {
                        "type": "boolean"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "expires_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "status",
                    "amount",
                    "currency",
                    "capture",
                    "description",
                    "external_ref",
                    "customer_id",
                    "success_url",
                    "cancel_url",
                    "transaction_id",
                    "attempts",
                    "last_error",
                    "livemode",
                    "created_at",
                    "expires_at"
                ],
                "title": "PaymentIntentResource"
            },
            "PaymentMethodResource": {
                "type": "object",
                "properties": {
                    "token": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "brand": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "masked": {
                        "type": "string"
                    },
                    "bin": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "last_four": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "exp_month": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "exp_year": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cardholder_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string"
                    },
                    "removed_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Set once the card is removed \u2014 by you, or after going unused\nfor the retention period. A removed card cannot be billed."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "required": [
                    "token",
                    "brand",
                    "masked",
                    "bin",
                    "last_four",
                    "exp_month",
                    "exp_year",
                    "cardholder_name",
                    "status",
                    "removed_at",
                    "created_at"
                ],
                "title": "PaymentMethodResource"
            },
            "RefundRequest": {
                "type": "object",
                "properties": {
                    "amount": {
                        "type": "integer",
                        "description": "Omit for a full refund of whatever remains.",
                        "minimum": 1
                    },
                    "reason": {
                        "type": "string",
                        "maxLength": 1000
                    }
                },
                "title": "RefundRequest"
            },
            "StoreCardRequest": {
                "type": "object",
                "properties": {
                    "card_number": {
                        "type": "string",
                        "maxLength": 23
                    },
                    "exp_month": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                    },
                    "exp_year": {
                        "type": "integer",
                        "minimum": 2000,
                        "maximum": 2100
                    },
                    "cardholder_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    }
                },
                "required": [
                    "card_number",
                    "exp_month",
                    "exp_year"
                ],
                "title": "StoreCardRequest"
            },
            "TransactionEventResource": {
                "type": "object",
                "properties": {
                    "from_status": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "to_status": {
                        "type": "string"
                    },
                    "actor": {
                        "type": "string"
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "required": [
                    "from_status",
                    "to_status",
                    "actor",
                    "reason",
                    "at"
                ],
                "title": "TransactionEventResource"
            },
            "TransactionResource": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "type": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "integer"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "refunded_amount": {
                        "type": "integer"
                    },
                    "refundable_amount": {
                        "type": "integer"
                    },
                    "approved": {
                        "type": "boolean"
                    },
                    "response_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "response_message": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "auth_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "avs_response_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cvv_response_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "processor_transaction_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mid_id": {
                        "type": "integer"
                    },
                    "customer_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "payment_method_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "parent_transaction_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "payment_intent": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The payment intent this charge completed, when a shopper paid\nthrough the card form or the payment page."
                    },
                    "source": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Where the payment came from: api, virtual_terminal,\npayment_link, payment_page, card_form or system. Set on sales and\nauthorisations; null on the captures, refunds and voids after."
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "processed_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "card": {
                        "type": "object",
                        "properties": {
                            "token": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Quote this as card_token to bill the same card again. The\nnumber behind it stays ours."
                            },
                            "brand": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "masked": {
                                "type": "string",
                                "description": "First six and last four is the most PCI DSS permits us to\nshow, and it is what the panel shows, so an integrator\nreconciling against a support call sees the same string."
                            },
                            "bin": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "last_four": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "exp_month": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "exp_year": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "token",
                            "brand",
                            "masked",
                            "bin",
                            "last_four",
                            "exp_month",
                            "exp_year"
                        ]
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "$ref": "#\/components\/schemas\/TransactionEventResource"
                        }
                    }
                },
                "required": [
                    "id",
                    "type",
                    "status",
                    "amount",
                    "currency",
                    "refunded_amount",
                    "refundable_amount",
                    "approved",
                    "response_code",
                    "response_message",
                    "auth_code",
                    "avs_response_code",
                    "cvv_response_code",
                    "processor_transaction_id",
                    "mid_id",
                    "customer_id",
                    "payment_method_id",
                    "parent_transaction_id",
                    "external_ref",
                    "payment_intent",
                    "source",
                    "test",
                    "processed_at",
                    "created_at"
                ],
                "title": "TransactionResource"
            }
        },
        "responses": {
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            },
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        }
    }
}