{
    "openapi": "3.1.0",
    "info": {
        "title": "Paynet API",
        "version": "1.0",
        "description": "Unified REST API for Armenian payment processors. Accept Idram, Telcell, and all major bank cards with a single integration.\n\n## Authentication\n\nSend your secret key in `X-Paynet-Key: sk_live_...` (or `Authorization: Bearer sk_live_...`). Test keys start with `sk_test_` and make every payment a sandbox payment. Keys are created in the dashboard under API Keys and shown once. CMS plugins authenticate with a connect token in `X-Paynet-Connect` instead; you never need one for your own code.\n\nA key has one of two access levels, chosen when you create it. **Full access** can do everything below. **Payments only** can create and read payments and payment links, but cannot refund or buy units: give that one to a storefront or a contractor, and keep full-access keys on your own server. A payments-only key gets `403 insufficient_scope` on the calls it cannot make. Keys created before this option existed are full access.\n\nPrefer a client app? Import the ready collection, https:\/\/paynet.am\/docs\/postman.json, into Postman, Insomnia or Bruno: every request is drafted and the key is one variable.\n\n## The minimum\n\n```\nPOST \/api\/v1\/payments\n{ \"amount\": 15000, \"order_id\": \"ORD-1\", \"return_url\": \"https:\/\/shop.am\/thanks\" }\n```\n\nRedirect the buyer to `checkout_url`. They pick a payment method there from everything you have turned on for the domain. Add `processor` to pre-select one, `redirect_mode: \"direct\"` (with a processor) to skip the hosted page, `callback_url` to receive the webhook, `customer_email` and `customer_name` so you can see who paid. `domain` is inferred from `return_url` when you omit it; all three URLs must be on a verified domain of yours.\n\n## Payment lifecycle\n\n`pending` (created) -> `processing` (buyer at the provider) -> `completed`, `failed` or `expired` (unpaid after 20 minutes). `completed` becomes `refunded` only on a full refund; partial refunds keep `completed` with `refunded_amount` above zero. A late provider confirmation can move `failed` or `expired` to `completed`, so always act on the latest state you read, not the first webhook you saw. `checkout_url` is valid for 24 hours but the payment itself expires after 20 minutes.\n\n## Webhooks\n\nSent to the payment's `callback_url`, else the domain's webhook URL, on every final status (`transaction.status.updated`, including failed and expired) and on refunds (`payment.refunded`). Header `X-Paynet-Signature` is the lowercase hex HMAC-SHA256 of the raw request body with your webhook secret (dashboard, Domain, Webhook settings); during a secret rotation `X-Paynet-Signature-Next` carries the signature under the new secret for 24 hours. Body: `delivery_id`, `event`, `livemode`, `timestamp`, `transaction` {uuid, order_id, status, amount, refunded_amount, currency, processor, completed_at, created_at}, `refund` (uuid, amount, reason) or null, `receipt` (receipt_id, qr_url) or null.\n\nVerify with the raw bytes and `hash_equals`, dedupe on `delivery_id`, then read the truth back with `GET \/api\/v1\/orders\/{order_id}\/payment` before you mark an order paid. We wait 10 seconds for a 2xx, do not follow redirects, refuse private addresses, and retry three times (after 1, 5 and 30 minutes). If a delivery for a completed or refunded payment fails for good we email you, at most once per domain every 6 hours.\n\n## Errors\n\nEvery error is `{ \"error\": \"<code>\", \"message\": \"...\" }` plus `request_id` (also the `X-Request-Id` header, quote it to support) and `docs_url`, the section of this guide that explains the code.\n\n| Status | Code | Meaning |\n|---|---|---|\n| 401 | `missing_credentials`, `invalid_api_key`, `invalid_connect_token` | No or wrong key |\n| 403 | `domain_required`, `domain_not_registered`, `domain_mismatch` | The store could not be matched to one of your verified domains |\n| 403 | `VERIFICATION_REQUIRED` | Live payments and purchases need a verified business; `verification_url` is included |\n| 402 | `BALANCE_EXHAUSTED` | Your transaction balance is used up beyond the grace floor; `top_up_url` is included |\n| 404 | `not_found`, `order_not_found` | Unknown, another merchant's, or the wrong environment for this key |\n| 409 | `conflict` | The same Idempotency-Key is still being processed |\n| 409 | `not_refundable`, `already_refunded`, `refund_in_progress`, `refund_outcome_unknown`, `refund_declined`, `processor_unavailable` | Refund could not be done now |\n| 422 | `validation_failed` (with `errors`), `no_payment_method_configured`, `amount_limit_exceeded`, `velocity_exceeded`, `refund_not_supported`, `invalid_amount`, `amount_exceeds_remaining`, `below_minimum` | The request is understood but cannot be served |\n| 429 | `rate_limited`, `too_many_attempts` | 60 requests per minute per account (`Retry-After` is set); 120 failed authentications per minute per IP |\n\nSend `Idempotency-Key` on payment creation to retry safely for 24 hours (the replay answers 200 instead of 201). Refunds are not idempotent: on a timeout read the payment back before retrying.\n\n## Sandbox\n\nInstall the Sandbox provider from Providers and send `\"processor\": \"sandbox\"`, or use a `sk_test_` key. No bank is contacted and nothing is counted. On the test checkout, the card number picks the outcome: 4111 1111 1111 1111 approved; 4000 0000 0000 0002 declined by issuer; 4000 0000 0000 0069 insufficient funds; 4000 0000 0000 0119 processor timeout; 4000 0000 0000 0101 3-D Secure failed; 4000 0000 0000 0127 amount limit exceeded; 4000 0000 0000 0200 duplicate transaction; 4000 0000 0000 0259 transaction expired; 4000 0000 0000 0309 processor unavailable; 4000 0000 0000 0341 general failure.\n\n## Domains\n\nEvery request is tied to one of your verified domains: the `Origin` header from a browser, the `domain` field, or (since 22 Aug 2026) the host of `return_url`. Requests sent from this reference page carry our own origin, which is skipped, so the `domain` field (or `return_url`) decides. **Test keys need no domain at all**: a sandbox payment binds to your hosted domain (`m<id>.pay.paynet.am`, created for every account, verified by construction, always offering the sandbox) and may return the buyer anywhere, `localhost` included. The hosted domain also carries your payment links when you have no website. `return_url`, `cancel_url` and `callback_url` must point at a verified domain, so verify your staging hostname in the dashboard before testing from it; `localhost` cannot be verified.\n\n## Build it with an AI assistant\n\nThe whole of this guide, with the sandbox cards and a task list, is available as one plain-text brief at `\/llms.txt` (the **Copy AI prompt** button at the top copies it). Paste it into ChatGPT, Claude, Cursor or Copilot, say which language and framework you use, and the assistant has everything it needs to write a working integration: create the payment, redirect, confirm on return, verify the webhook, refund. Signed in, the brief already names your verified domain. Keep your API key in an environment variable; never paste it into a chat.\n\n## Versioning\n\nThis is API v1 and it stays v1. Changes are additive: new optional fields, new response keys and new endpoints may appear at any time, and your integration must ignore keys it does not know. A field is never removed, renamed or re-typed, an error code never changes meaning, and a webhook payload only ever gains keys. If something ever has to go, it is announced here and by email at least 90 days ahead and keeps working until then.\n\n## Changelog\n\n- **2026-08-24**: test keys need no domain (sandbox payments bind to your hosted domain `m<id>.pay.paynet.am`); every error carries `docs_url`; the reference is also a Postman collection at `\/docs\/postman.json`.\n- **2026-08-23**: \"Try it\" in this reference now works: every request comes pre-filled with example headers and data, a signed-in merchant can pick one of their keys at the top, and a request sent from this page is no longer refused as `domain_not_registered` (the page's own origin is skipped, the `domain` field decides). Every account now starts with a **Default** test key. `\/llms.txt` holds the guide as an AI brief.\n- **2026-08-23**: API keys can be created as payments-only (no refunds, no purchases): `403 insufficient_scope`. `Idempotency-Key` on `POST \/payments\/{uuid}\/refund` makes retries safe: the same key returns the same refund.\n- **2026-08-22**: `processor` and `currency` became optional on `POST \/payments`; `Authorization: Bearer` accepted; the store is inferred from `return_url` when `domain` is absent; `description` is kept with the payment; `payment.refunded` webhooks also go to the payment's `callback_url`; every merchant endpoint is in this reference.\n\n## Server-side helpers (PHP, Node.js)\n\nDrop-in clients for the four calls most integrations need. Keep the secret key in an environment variable.\n\n```php\nfinal class Paynet\n{\n    public function __construct(private string $key, private string $base = 'https:\/\/paynet.am') {}\n\n    \/** @return array{uuid:string, checkout_url:string, status:string} *\/\n    public function createPayment(int $amountAmd, string $orderId, string $returnUrl, array $extra = []): array\n    {\n        return $this->call('POST', '\/api\/v1\/payments', ['amount' => $amountAmd, 'order_id' => $orderId, 'return_url' => $returnUrl] + $extra,\n            ['Idempotency-Key' => $orderId . ':' . ($extra['attempt'] ?? 1)]);\n    }\n\n    public function payment(string $uuid): array { return $this->call('GET', \"\/api\/v1\/payments\/{$uuid}\"); }\n\n    public function paymentForOrder(string $orderId): array { return $this->call('GET', '\/api\/v1\/orders\/' . rawurlencode($orderId) . '\/payment'); }\n\n    public function refund(string $uuid, ?int $amountAmd, string $idempotencyKey, ?string $reason = null): array\n    {\n        return $this->call('POST', \"\/api\/v1\/payments\/{$uuid}\/refund\", array_filter(['amount' => $amountAmd, 'reason' => $reason]), ['Idempotency-Key' => $idempotencyKey]);\n    }\n\n    private function call(string $method, string $path, array $body = [], array $headers = []): array\n    {\n        $ch = curl_init($this->base . $path);\n        $hdr = ['Authorization: Bearer ' . $this->key, 'Accept: application\/json', 'Content-Type: application\/json'];\n        foreach ($headers as $k => $v) { $hdr[] = \"$k: $v\"; }\n        curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $hdr,\n            CURLOPT_POSTFIELDS => $method === 'POST' ? json_encode($body) : null, CURLOPT_TIMEOUT => 15]);\n        $raw = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); curl_close($ch);\n        $data = json_decode((string) $raw, true) ?? [];\n        if ($status >= 400) { throw new RuntimeException(($data['error'] ?? 'http_' . $status) . ': ' . ($data['message'] ?? '')); }\n        return $data;\n    }\n}\n\n\/\/ $paynet = new Paynet(getenv('PAYNET_API_KEY'));\n\/\/ $p = $paynet->createPayment(15000, 'ORD-1', 'https:\/\/shop.am\/thanks', ['customer_email' => $email]);\n\/\/ header('Location: ' . $p['checkout_url']);\n```\n\n```js\nclass Paynet {\n  constructor(key, base = 'https:\/\/paynet.am') { this.key = key; this.base = base; }\n  createPayment(amountAmd, orderId, returnUrl, extra = {}) {\n    return this.call('POST', '\/api\/v1\/payments', { amount: amountAmd, order_id: orderId, return_url: returnUrl, ...extra },\n      { 'Idempotency-Key': `${orderId}:${extra.attempt ?? 1}` });\n  }\n  payment(uuid) { return this.call('GET', `\/api\/v1\/payments\/${uuid}`); }\n  paymentForOrder(orderId) { return this.call('GET', `\/api\/v1\/orders\/${encodeURIComponent(orderId)}\/payment`); }\n  refund(uuid, amountAmd, idempotencyKey, reason) {\n    return this.call('POST', `\/api\/v1\/payments\/${uuid}\/refund`, { amount: amountAmd ?? undefined, reason }, { 'Idempotency-Key': idempotencyKey });\n  }\n  async call(method, path, body, headers = {}) {\n    const r = await fetch(this.base + path, { method, headers: { Authorization: `Bearer ${this.key}`, Accept: 'application\/json', 'Content-Type': 'application\/json', ...headers },\n      body: method === 'POST' ? JSON.stringify(body) : undefined });\n    const data = await r.json().catch(() => ({}));\n    if (!r.ok) throw new Error(`${data.error ?? 'http_' + r.status}: ${data.message ?? ''}`);\n    return data;\n  }\n}\n\n\/\/ const paynet = new Paynet(process.env.PAYNET_API_KEY);\n\/\/ const p = await paynet.createPayment(15000, 'ORD-1', 'https:\/\/shop.am\/thanks', { customer_email: email });\n\/\/ res.redirect(p.checkout_url);\n```\n\n## Verify a webhook (PHP, Node.js)\n\n```php\n\/\/ PHP: raw body, hex HMAC, constant-time compare, then read the truth back.\n$raw    = file_get_contents('php:\/\/input');\n$secret = getenv('PAYNET_WEBHOOK_SECRET');\n$given  = $_SERVER['HTTP_X_PAYNET_SIGNATURE'] ?? '';\n$next   = $_SERVER['HTTP_X_PAYNET_SIGNATURE_NEXT'] ?? '';\n$mine   = hash_hmac('sha256', $raw, $secret);\nif (!hash_equals($mine, $given) && !hash_equals($mine, $next)) { http_response_code(401); exit; }\n$event = json_decode($raw, true);\n\/\/ dedupe on $event['delivery_id'], then:\n$payment = json_decode(file_get_contents(\n    'https:\/\/paynet.am\/api\/v1\/orders\/' . rawurlencode($event['transaction']['order_id']) . '\/payment',\n    false, stream_context_create(['http' => ['header' => \"X-Paynet-Key: \" . getenv('PAYNET_API_KEY')]])\n), true);\nif (($payment['status'] ?? null) === 'completed') { \/* mark the order paid *\/ }\nhttp_response_code(200);\n```\n\n```js\n\/\/ Node.js (Express): keep the raw body for the HMAC, never a re-encoded one.\napp.post('\/webhooks\/paynet', express.raw({ type: '*\/*' }), async (req, res) => {\n  const mine = crypto.createHmac('sha256', process.env.PAYNET_WEBHOOK_SECRET).update(req.body).digest('hex');\n  const ok = [req.get('X-Paynet-Signature'), req.get('X-Paynet-Signature-Next')]\n    .some(h => h && h.length === mine.length && crypto.timingSafeEqual(Buffer.from(h), Buffer.from(mine)));\n  if (!ok) return res.sendStatus(401);\n  const event = JSON.parse(req.body);\n  \/\/ dedupe on event.delivery_id, then confirm:\n  const r = await fetch(`https:\/\/paynet.am\/api\/v1\/orders\/${encodeURIComponent(event.transaction.order_id)}\/payment`,\n    { headers: { 'X-Paynet-Key': process.env.PAYNET_API_KEY } });\n  const payment = await r.json();\n  if (payment.status === 'completed') { \/* mark the order paid *\/ }\n  res.sendStatus(200);\n});\n```\n\n## Testing\n\nThere are two ways in. Install the **Sandbox (Test)** provider from your dashboard and send `\"processor\": \"sandbox\"` - this also works in the CMS plugins, so you can test a real storefront end to end. Or create an API key with the **test** environment, which turns every payment made with it into a sandbox payment. Either way: no bank is contacted, no money moves, nothing is billed or counted as revenue, and the buyer is sent to a test payment page instead of a real bank.\n\nThe card number decides the outcome:\n\n| Card number | Result |\n| --- | --- |\n| `4111 1111 1111 1111` | Approved |\n| `4000 0000 0000 0002` | Declined by issuer |\n| `4000 0000 0000 0069` | Insufficient funds |\n| `4000 0000 0000 0119` | Processor timeout |\n| `4000 0000 0000 0101` | 3-D Secure failed |\n| `4000 0000 0000 0127` | Amount limit exceeded |\n| `4000 0000 0000 0200` | Duplicate transaction |\n| `4000 0000 0000 0259` | Transaction expired |\n| `4000 0000 0000 0309` | Processor unavailable |\n| `4000 0000 0000 0341` | General failure |\n\nAny other 16-digit number is approved. Expiry, CVV and cardholder name are not checked - enter anything.\n\nTest payments appear under the Test tab in your dashboard and fire webhooks with `livemode: false`, so you can prove your integration end to end before going live."
    },
    "servers": [
        {
            "url": "https:\/\/paynet.am\/api"
        }
    ],
    "security": [
        {
            "apiKey": []
        }
    ],
    "paths": {
        "\/v1\/billing\/pricing": {
            "get": {
                "operationId": "billing.pricing",
                "description": "Public, no key needed. Paynet charges exactly two things: a price per completed live payment (free under a small amount) and a price per e-HDM fiscal receipt (free when the receipt belongs to a payment taken through Paynet). Prices are whole AMD.",
                "summary": "Current prices",
                "tags": [
                    "Billing"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "array",
                                    "prefixItems": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "counter": {
                                                    "type": "string",
                                                    "const": "transactions"
                                                },
                                                "unit_price_amd": {
                                                    "type": "integer"
                                                },
                                                "free_when": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "counter",
                                                "unit_price_amd",
                                                "free_when"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "counter": {
                                                    "type": "string",
                                                    "const": "receipts"
                                                },
                                                "unit_price_amd": {
                                                    "type": "integer"
                                                },
                                                "free_when": {
                                                    "type": "string",
                                                    "const": "linked to a Paynet payment"
                                                }
                                            },
                                            "required": [
                                                "counter",
                                                "unit_price_amd",
                                                "free_when"
                                            ]
                                        }
                                    ],
                                    "minItems": 2,
                                    "maxItems": 2,
                                    "additionalItems": false
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/billing\/balances": {
            "get": {
                "operationId": "billing.balances",
                "description": "How many transactions and receipts you have left. Units are counts that never expire. `grace_floor` is how far below zero you may go before new live payments are refused; `blocked` says whether that has happened; `unlimited` accounts consume nothing.",
                "summary": "Your balances",
                "tags": [
                    "Billing"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "counter": {
                                                "type": "string",
                                                "enum": [
                                                    "transactions",
                                                    "receipts"
                                                ]
                                            },
                                            "available": {
                                                "type": "integer"
                                            },
                                            "grace_floor": {
                                                "type": "integer"
                                            },
                                            "blocked": {
                                                "type": "string"
                                            },
                                            "unlimited": {
                                                "type": "boolean"
                                            }
                                        },
                                        "required": [
                                            "counter",
                                            "available",
                                            "grace_floor",
                                            "blocked",
                                            "unlimited"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/billing\/purchases": {
            "post": {
                "operationId": "billing.purchase",
                "description": "Send an `Idempotency-Key` header (any unique string per attempt); a retry with the same key returns the original purchase with 200 instead of 201. Preset quantities can be paid by card via the returned `checkout_url`; any other quantity is paid by bank transfer using `reference`, and is credited when the transfer arrives. Needs a verified business (403 `VERIFICATION_REQUIRED` otherwise) and at least the minimum quantity (422 `below_minimum`).",
                "summary": "Buy transactions or receipts",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "Unique key to prevent duplicate payments. Safe to retry on network failure.",
                        "schema": {},
                        "example": "purchase-2026-10-01-a"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "counter": {
                                        "type": "string",
                                        "description": "What you are buying: transactions or receipts",
                                        "enum": [
                                            "transactions",
                                            "receipts"
                                        ],
                                        "example": "transactions"
                                    },
                                    "quantity": {
                                        "type": "integer",
                                        "description": "How many units. Preset quantities get a card checkout_url; other quantities are paid by bank transfer.",
                                        "example": 500,
                                        "minimum": 1,
                                        "maximum": 1000000
                                    },
                                    "payment_method_id": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Reserved for saved payment methods; leave it out",
                                        "maxLength": 120
                                    }
                                },
                                "required": [
                                    "counter",
                                    "quantity"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/v1\/billing\/ledger": {
            "get": {
                "operationId": "billing.ledger",
                "description": "Every change to your balances, newest first: signup grant, purchases, one row per payment or receipt consumed, adjustments. Cursor-paginated; pass `next_cursor` back as `cursor` to continue.",
                "summary": "Ledger",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "counter",
                        "in": "query",
                        "description": "Only one counter: transactions or receipts",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "transactions",
                                "receipts"
                            ]
                        },
                        "example": "transactions"
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "The next_cursor from the previous page",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Rows per page (1-100, default 50)",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1,
                            "maximum": 100
                        },
                        "example": 50
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "counter": {
                                                        "type": "string",
                                                        "enum": [
                                                            "transactions",
                                                            "receipts"
                                                        ]
                                                    },
                                                    "delta": {
                                                        "type": "integer"
                                                    },
                                                    "event_type": {
                                                        "type": "string"
                                                    },
                                                    "ref_type": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ref_id": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "balance_after": {
                                                        "type": "integer"
                                                    },
                                                    "note": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "counter",
                                                    "delta",
                                                    "event_type",
                                                    "ref_type",
                                                    "ref_id",
                                                    "balance_after",
                                                    "note",
                                                    "created_at"
                                                ]
                                            }
                                        },
                                        "next_cursor": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "next_cursor"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/v1\/billing\/auto-topup\/{counter}": {
            "put": {
                "operationId": "billing.autoTopup",
                "description": "When a counter falls to `threshold_qty`, Paynet prepares a purchase of `refill_qty` and emails you a one-click link to pay it. `counter` in the path is `transactions` or `receipts`.",
                "summary": "Auto top-up settings",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "counter",
                        "in": "path",
                        "required": true,
                        "description": "transactions or receipts",
                        "schema": {
                            "type": "string"
                        },
                        "example": "transactions"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean",
                                        "description": "Turn auto top-up on or off for this counter",
                                        "example": true
                                    },
                                    "threshold_qty": {
                                        "type": "integer",
                                        "description": "When the balance falls to this many units, Paynet prepares the refill",
                                        "example": 50,
                                        "minimum": 0,
                                        "maximum": 1000000
                                    },
                                    "refill_qty": {
                                        "type": "integer",
                                        "description": "How many units each refill buys (at least the minimum purchase)",
                                        "example": 500,
                                        "minimum": 0,
                                        "maximum": 1000000
                                    },
                                    "payment_method_id": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Reserved for saved payment methods; leave it out",
                                        "maxLength": 120
                                    }
                                },
                                "required": [
                                    "enabled",
                                    "threshold_qty",
                                    "refill_qty"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/v1\/payments": {
            "get": {
                "operationId": "payment.index",
                "description": "A paginated list of your payments, newest first. Scoped to the key's environment: a test key lists only sandbox payments, a live key only live ones. Filter by status, processor slug, order_id and a created_at date range.",
                "summary": "List payments",
                "tags": [
                    "Payments"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by status (pending, processing, completed, failed, ...)",
                        "schema": {
                            "$ref": "#\/components\/schemas\/TransactionStatus"
                        },
                        "example": "completed"
                    },
                    {
                        "name": "processor",
                        "in": "query",
                        "description": "Filter by processor slug",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 50
                        },
                        "example": "idram"
                    },
                    {
                        "name": "order_id",
                        "in": "query",
                        "description": "Filter by your order identifier",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        },
                        "example": "ORD-2024-001"
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "Only payments created on\/after this date (YYYY-MM-DD)",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        },
                        "example": "2024-01-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "Only payments created on\/before this date (YYYY-MM-DD)",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        },
                        "example": "2024-01-31"
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Results per page (1\u2013100, default 25)",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1,
                            "maximum": 100
                        },
                        "example": 25
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `PaymentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/PaymentResource"
                                            }
                                        },
                                        "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"
                    }
                }
            },
            "post": {
                "operationId": "payment.create",
                "description": "The minimum is amount (whole AMD), order_id and return_url: the buyer then picks a payment method on the hosted checkout from what you have turned on for the domain. Send processor to pre-select one, and redirect_mode=direct to skip the hosted page and go straight to that provider. Returns 201 Created with the payment details and a checkout URL. If an Idempotency-Key header is provided and the same key was used within the last 24 hours, the original response is returned with HTTP 200 (not 201). Send customer_email and customer_name when you have them: they are optional and never required to take a payment, but they are what lets a merchant see who paid, match repeat buyers, and follow up on an order. Without them a payment is anonymous to everyone but the bank.",
                "summary": "Create a new payment transaction",
                "tags": [
                    "Payments"
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "description": "Unique key to prevent duplicate payments. Safe to retry on network failure.",
                        "schema": {},
                        "example": "order-12345-attempt-1"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CreatePaymentRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Payment created successfully.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "order_id": {
                                            "type": "string"
                                        },
                                        "amount": {
                                            "anyOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "number"
                                                }
                                            ]
                                        },
                                        "refunded_amount": {
                                            "anyOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "number"
                                                }
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "charge": {
                                            "type": "string",
                                            "description": "Additive: what the gateway was really charged when a conversion took place (amount, currency, locked fx); null otherwise."
                                        },
                                        "customer_id": {
                                            "type": "string",
                                            "description": "The buyer's customer id once the payment is paid (or when you named one); never their details."
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "checkout_url": {
                                            "type": "string"
                                        },
                                        "processor": {
                                            "type": "string"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        },
                                        "completed_at": {
                                            "type": "string"
                                        },
                                        "refunded_at": {
                                            "type": "string"
                                        },
                                        "payment_flow": {
                                            "type": "string",
                                            "const": "qr"
                                        },
                                        "qr_code": {
                                            "type": "string"
                                        },
                                        "rrn": {
                                            "type": "string"
                                        },
                                        "redirect_url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "uuid",
                                        "order_id",
                                        "amount",
                                        "refunded_amount",
                                        "currency",
                                        "charge",
                                        "customer_id",
                                        "status",
                                        "checkout_url",
                                        "processor",
                                        "created_at",
                                        "completed_at",
                                        "refunded_at",
                                        "payment_flow",
                                        "qr_code",
                                        "rrn",
                                        "redirect_url"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Conflict - a request with the same idempotency key is already being processed.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "conflict"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Request is being processed. Please retry."
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "Idempotent replay - returns the original creation response.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": [
                                                "array",
                                                "null"
                                            ],
                                            "items": {}
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "402": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Your transaction balance is exhausted. Top up to resume taking payments."
                                        },
                                        "available": {
                                            "type": "string"
                                        },
                                        "grace_floor": {
                                            "type": "string"
                                        },
                                        "top_up_url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message",
                                        "available",
                                        "grace_floor",
                                        "top_up_url"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Complete business verification before taking live payments."
                                        },
                                        "verification_url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message",
                                        "verification_url"
                                    ]
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "fx_rate_unavailable"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Payments in this currency cannot be taken right now because no current official exchange rate is available. Try again later, or charge in AMD."
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/payments\/{uuid}": {
            "get": {
                "operationId": "payment.show",
                "description": "Scoped to the authenticated merchant - a merchant cannot retrieve another merchant's transactions (returns 404, not 403).",
                "summary": "Retrieve a payment by UUID",
                "tags": [
                    "Payments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "description": "The payment UUID returned when the payment was created",
                        "schema": {
                            "type": "string"
                        },
                        "example": "01234567-89ab-cdef-0123-456789abcdef"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Payment details.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "order_id": {
                                            "type": "string"
                                        },
                                        "amount": {
                                            "anyOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "number"
                                                }
                                            ]
                                        },
                                        "refunded_amount": {
                                            "anyOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "number"
                                                }
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "charge": {
                                            "type": "string",
                                            "description": "Additive: what the gateway was really charged when a conversion took place (amount, currency, locked fx); null otherwise."
                                        },
                                        "customer_id": {
                                            "type": "string",
                                            "description": "The buyer's customer id once the payment is paid (or when you named one); never their details."
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "checkout_url": {
                                            "type": "string"
                                        },
                                        "processor": {
                                            "type": "string"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        },
                                        "completed_at": {
                                            "type": "string"
                                        },
                                        "refunded_at": {
                                            "type": "string"
                                        },
                                        "receipt": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "receipt_id": {
                                                    "type": "string"
                                                },
                                                "qr_url": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "receipt_id",
                                                "qr_url"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "uuid",
                                        "order_id",
                                        "amount",
                                        "refunded_amount",
                                        "currency",
                                        "charge",
                                        "customer_id",
                                        "status",
                                        "checkout_url",
                                        "processor",
                                        "created_at",
                                        "completed_at",
                                        "refunded_at",
                                        "receipt"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/payments\/{uuid}\/refund": {
            "post": {
                "operationId": "payment.refund",
                "description": "Body: amount (optional, defaults to the full remaining balance) and reason (optional). Returns the refund object. Send an Idempotency-Key header to make retries safe: the same key on the same payment returns the same refund (200 on replay, 201 when created). Without it a second call is a second refund, so after a timeout read the payment back (GET \/payments\/{uuid}) before retrying. Payments-only API keys get 403 insufficient_scope here.",
                "summary": "Refund a completed payment (full or partial)",
                "tags": [
                    "Payments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "description": "The payment UUID returned when the payment was created",
                        "schema": {
                            "type": "string"
                        },
                        "example": "01234567-89ab-cdef-0123-456789abcdef"
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "description": "Unique key to prevent duplicate payments. Safe to retry on network failure.",
                        "schema": {},
                        "example": "refund-1001-attempt-1"
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "amount": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "description": "Amount in dram to refund. Omit for a full refund of what is left.",
                                        "example": 1000,
                                        "minimum": 0.01
                                    },
                                    "reason": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Why, for your records and the buyer's statement",
                                        "example": "Customer returned one item",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/v1\/orders\/{orderId}\/payment": {
            "get": {
                "operationId": "payment.orderStatus",
                "description": "The \"pull\" half of webhook verification: treat a webhook as a nudge and call this endpoint to learn the real state from us. Scoped to the key or connect token, so a store can only read its own orders. Returns the most decisive payment for the order: a final record (completed, refunded) wins over a stale pending one.",
                "summary": "Payment status by your own order id",
                "tags": [
                    "Payments"
                ],
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Your own order identifier (the one you sent as order_id)",
                        "schema": {
                            "type": "string"
                        },
                        "example": "ORD-2024-001"
                    },
                    {
                        "name": "X-Paynet-Connect",
                        "in": "header",
                        "description": "CMS plugin connect token",
                        "schema": {},
                        "example": "pnct_..."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "order_id": {
                                            "type": "string"
                                        },
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "amount": {
                                            "type": "string"
                                        },
                                        "refunded_amount": {
                                            "anyOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "number"
                                                }
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "charge": {
                                            "type": "string",
                                            "description": "Additive: what the gateway was really charged when it differs from the order; null otherwise."
                                        },
                                        "customer_id": {
                                            "type": "string",
                                            "description": "The buyer's customer id once known; never their details."
                                        },
                                        "processor": {
                                            "type": "string"
                                        },
                                        "is_test": {
                                            "type": "boolean"
                                        },
                                        "completed_at": {
                                            "type": "string"
                                        },
                                        "receipt": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "receipt_id": {
                                                    "type": "string"
                                                },
                                                "qr_url": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "receipt_id",
                                                "qr_url"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "order_id",
                                        "uuid",
                                        "status",
                                        "amount",
                                        "refunded_amount",
                                        "currency",
                                        "charge",
                                        "customer_id",
                                        "processor",
                                        "is_test",
                                        "completed_at",
                                        "receipt"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "order_not_found"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "No payment exists for this order on this store."
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/payment-links": {
            "get": {
                "operationId": "paymentLink.index",
                "description": "Your payment links, newest first, with their status and counters. Paginated.",
                "summary": "List payment links",
                "tags": [
                    "Payment links"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/PaymentLinkResource"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "current_page": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "total",
                                                "per_page",
                                                "current_page"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "paymentLink.store",
                "description": "A hosted payment page you can share anywhere: a fixed amount, or a range the buyer chooses from. The link is paid through the providers of the domain you name. Returns the link with its public URL and QR.",
                "summary": "Create a payment link",
                "tags": [
                    "Payment links"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "domain": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "One of your verified domains, or pay.paynet.am for your hosted page; the link is paid through its providers. Omitted: the domain the request is bound to (the hosted page for a test key with no Origin)",
                                        "example": "shop.example.com"
                                    },
                                    "title": {
                                        "type": "string",
                                        "description": "Shown to the buyer as the page title",
                                        "example": "Yoga class, October",
                                        "maxLength": 255
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Optional text under the title",
                                        "example": "8 sessions, Tuesdays and Thursdays",
                                        "maxLength": 500
                                    },
                                    "amount": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "description": "Fixed price in dram. Omit it to let the buyer enter an amount (bounded by min_amount \/ max_amount).",
                                        "example": 15000,
                                        "minimum": 1
                                    },
                                    "min_amount": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "description": "Smallest amount a buyer may enter when there is no fixed amount",
                                        "minimum": 1
                                    },
                                    "max_amount": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Largest amount a buyer may enter when there is no fixed amount",
                                        "minimum": 1
                                    },
                                    "currency": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Only AMD in v1; the default when omitted",
                                        "enum": [
                                            "AMD"
                                        ],
                                        "example": "AMD"
                                    },
                                    "expires_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The link stops accepting payments after this moment (ISO 8601)"
                                    },
                                    "max_uses": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "How many successful payments the link accepts before it closes",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "title"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "slug": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "description": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "min_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "max_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "payable": {
                                            "type": "boolean"
                                        },
                                        "expires_at": {
                                            "type": "string"
                                        },
                                        "max_uses": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "stats": {
                                            "type": "object",
                                            "properties": {
                                                "views": {
                                                    "type": "integer"
                                                },
                                                "paid": {
                                                    "type": "integer"
                                                },
                                                "conversion": {
                                                    "type": "number"
                                                }
                                            },
                                            "required": [
                                                "views",
                                                "paid",
                                                "conversion"
                                            ]
                                        },
                                        "created_at": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "uuid",
                                        "slug",
                                        "url",
                                        "title",
                                        "description",
                                        "amount",
                                        "min_amount",
                                        "max_amount",
                                        "currency",
                                        "status",
                                        "payable",
                                        "expires_at",
                                        "max_uses",
                                        "stats",
                                        "created_at"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/v1\/payment-links\/{uuid}": {
            "get": {
                "operationId": "paymentLink.show",
                "description": "One payment link by UUID, with its status, counters and public URL. Scoped to your account (404 otherwise).",
                "summary": "Retrieve a payment link",
                "tags": [
                    "Payment links"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "description": "The payment UUID returned when the payment was created",
                        "schema": {
                            "type": "string"
                        },
                        "example": "01234567-89ab-cdef-0123-456789abcdef"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "slug": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "description": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "min_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "max_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "payable": {
                                            "type": "boolean"
                                        },
                                        "expires_at": {
                                            "type": "string"
                                        },
                                        "max_uses": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "stats": {
                                            "type": "object",
                                            "properties": {
                                                "views": {
                                                    "type": "integer"
                                                },
                                                "paid": {
                                                    "type": "integer"
                                                },
                                                "conversion": {
                                                    "type": "number"
                                                }
                                            },
                                            "required": [
                                                "views",
                                                "paid",
                                                "conversion"
                                            ]
                                        },
                                        "created_at": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "uuid",
                                        "slug",
                                        "url",
                                        "title",
                                        "description",
                                        "amount",
                                        "min_amount",
                                        "max_amount",
                                        "currency",
                                        "status",
                                        "payable",
                                        "expires_at",
                                        "max_uses",
                                        "stats",
                                        "created_at"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/payment-links\/{uuid}\/disable": {
            "post": {
                "operationId": "paymentLink.disable",
                "description": "The link stops accepting payments at once; its page tells buyers it is no longer available. Re-enable it from the dashboard.",
                "summary": "Disable a payment link",
                "tags": [
                    "Payment links"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "description": "The payment UUID returned when the payment was created",
                        "schema": {
                            "type": "string"
                        },
                        "example": "01234567-89ab-cdef-0123-456789abcdef"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "uuid": {
                                            "type": "string"
                                        },
                                        "slug": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "description": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "min_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "max_amount": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "currency": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "payable": {
                                            "type": "boolean"
                                        },
                                        "expires_at": {
                                            "type": "string"
                                        },
                                        "max_uses": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "stats": {
                                            "type": "object",
                                            "properties": {
                                                "views": {
                                                    "type": "integer"
                                                },
                                                "paid": {
                                                    "type": "integer"
                                                },
                                                "conversion": {
                                                    "type": "number"
                                                }
                                            },
                                            "required": [
                                                "views",
                                                "paid",
                                                "conversion"
                                            ]
                                        },
                                        "created_at": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "uuid",
                                        "slug",
                                        "url",
                                        "title",
                                        "description",
                                        "amount",
                                        "min_amount",
                                        "max_amount",
                                        "currency",
                                        "status",
                                        "payable",
                                        "expires_at",
                                        "max_uses",
                                        "stats",
                                        "created_at"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "\/v1\/processors": {
            "get": {
                "operationId": "processor.index",
                "description": "The providers you have turned on for the domain, with the names buyers see. Plugins use it to offer one checkout option per method. Pass `?domain=` on server-to-server calls; connect tokens already know their store.",
                "summary": "Payment methods available to a store",
                "tags": [
                    "Payment methods"
                ],
                "parameters": [
                    {
                        "name": "domain",
                        "in": "query",
                        "description": "One of your verified domains. Needed with an API key; connect tokens already know their store.",
                        "schema": {},
                        "example": "shop.example.com"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "processors": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "plugin": {
                                            "type": "object",
                                            "properties": {
                                                "latest_version": {
                                                    "type": "string"
                                                },
                                                "download_url": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "latest_version",
                                                "download_url"
                                            ]
                                        },
                                        "setup": {
                                            "type": "object",
                                            "properties": {
                                                "ready": {
                                                    "type": "boolean"
                                                },
                                                "missing": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "domain",
                                                            "provider"
                                                        ]
                                                    }
                                                },
                                                "links": {
                                                    "type": "object",
                                                    "description": "Deep links so the plugin can send them straight to the right screen\ninstead of \"log in and look around\".",
                                                    "properties": {
                                                        "domains": {
                                                            "type": "string"
                                                        },
                                                        "providers": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "domains",
                                                        "providers"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "ready",
                                                "missing",
                                                "links"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "processors",
                                        "plugin",
                                        "setup"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "apiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Paynet-Key"
            }
        },
        "schemas": {
            "CreatePaymentRequest": {
                "type": "object",
                "description": "Request body for POST \/api\/v1\/payments. Authenticate with the X-Paynet-Key header. return_url, callback_url and domain must belong to one of your verified domains.",
                "properties": {
                    "amount": {
                        "type": "number",
                        "description": "Amount in dram (integer, minimum 1 dram)",
                        "example": 5000,
                        "minimum": 1
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional, AMD when omitted. Any other currency this field allows is charged in AMD at the Central Bank of Armenia rate by payment methods that take dram only, and the buyer sees that amount before paying.",
                        "enum": [
                            "AMD",
                            "USD",
                            "EUR",
                            "RUB"
                        ],
                        "example": "AMD"
                    },
                    "order_id": {
                        "type": "string",
                        "description": "Your own order reference. Reusing it after a failed or expired attempt is fine; GET \/v1\/orders\/{order_id}\/payment returns the most decisive payment for it.",
                        "example": "ORD-1001",
                        "maxLength": 255
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional description, kept with the payment and shown in your dashboard",
                        "example": "Order #1001, 2 items",
                        "maxLength": 500
                    },
                    "return_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Where to redirect the customer after payment",
                        "example": "https:shop.example.com\/checkout\/thank-you",
                        "maxLength": 2048
                    },
                    "cancel_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "description": "Where the customer lands when abandoning payment (the hosted page's\n\"Back to store\" link). Platform-specific: e.g. WooCommerce's\ncancel-order URL restores the cart. Absent -> return_url is used.",
                        "example": "https:shop.example.com\/checkout\/cancelled",
                        "maxLength": 2048
                    },
                    "callback_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "description": "Where we POST the signed webhook once the payment result is final. Omit it if you do not use webhooks.",
                        "example": "https:shop.example.com\/paynet\/webhook",
                        "maxLength": 2048
                    },
                    "customer_email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "description": "Buyer's email. Optional, and never required to take a payment, but it is what lets you see who paid.",
                        "example": "buyer@example.com",
                        "maxLength": 255
                    },
                    "customer_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Buyer's name. Optional, shown with the email on the payment in your dashboard.",
                        "example": "Anna Petrosyan",
                        "maxLength": 255
                    },
                    "customer_phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Buyer's phone. Optional; the same as customer.phone.",
                        "pattern": "^\\+?[0-9 ()\\-]{6,32}$",
                        "example": "+37491123456",
                        "maxLength": 32
                    },
                    "customer_reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Your own id for this buyer. Optional; the same as customer.reference.",
                        "example": "user-4821",
                        "maxLength": 191
                    },
                    "domain": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "One of your verified domains. Send it on server-to-server calls, which carry no Origin header.",
                        "example": "shop.example.com",
                        "maxLength": 255
                    },
                    "processor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional. Omit it and the buyer picks a payment method on the hosted checkout from everything you have turned on for the domain. Send a slug ('arca', 'idram', 'telcell', 'sandbox', ...) to pre-select one; required with redirect_mode=direct."
                    },
                    "redirect_mode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "'direct' -> initiate the processor now and return the bank redirect\nURL (shop -> bank, no hosted checkout). Default\/absent -> hosted checkout.",
                        "enum": [
                            "direct",
                            "hosted"
                        ],
                        "example": "hosted"
                    },
                    "language": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Customer's storefront language. Localizes the hosted checkout and\nthe processor's payment page (where supported). Absent -> default.",
                        "enum": [
                            "en",
                            "hy",
                            "ru"
                        ],
                        "example": "hy"
                    },
                    "metadata": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Optional key-value data kept with the payment and shown in your dashboard. Not returned by the API and not included in webhooks.",
                        "example": {
                            "customer_id": "42"
                        },
                        "items": {
                            "type": "string"
                        }
                    },
                    "customer": {
                        "type": "object",
                        "description": "Optional buyer details in one object. Once a payment is paid, its buyer is kept as a customer and later payments by the same buyer are grouped under the same customer_id. Send only what you have.",
                        "properties": {
                            "id": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "A customer_id Paynet returned earlier on a payment or webhook, to put this payment under that customer.",
                                "example": "cus_01j8z5x3k2q7w9m4n6p0r1s2t3",
                                "maxLength": 40
                            },
                            "reference": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Your own id for this buyer. Payments with the same reference are grouped under one customer.",
                                "example": "user-4821",
                                "maxLength": 191
                            },
                            "email": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "email",
                                "description": "Buyer's email; the same as customer_email.",
                                "example": "buyer@example.com",
                                "maxLength": 255
                            },
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Buyer's name; the same as customer_name.",
                                "example": "Anna Petrosyan",
                                "maxLength": 255
                            },
                            "phone": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Buyer's phone; the same as customer_phone.",
                                "pattern": "^\\+?[0-9 ()\\-]{6,32}$",
                                "example": "+37491123456",
                                "maxLength": 32
                            }
                        }
                    },
                    "items": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Optional order line items - used for fiscal (HDM) receipts and order tracking",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "description": "Line item name as it should appear on the receipt",
                                    "example": "Cotton T-shirt",
                                    "maxLength": 255
                                },
                                "code": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "Your SKU or product code",
                                    "example": "SKU-1001",
                                    "maxLength": 64
                                },
                                "quantity": {
                                    "type": "number",
                                    "description": "Quantity; fractions are allowed for weighed goods",
                                    "example": 2,
                                    "minimum": 0.001,
                                    "maximum": 999999
                                },
                                "price": {
                                    "type": "number",
                                    "description": "Unit price in dram",
                                    "example": 2500,
                                    "minimum": 0,
                                    "maximum": 999999999
                                },
                                "unit": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "Unit of measure shown on the receipt (pcs, kg, ...)",
                                    "example": "pcs",
                                    "maxLength": 32
                                }
                            },
                            "required": [
                                "name",
                                "quantity",
                                "price"
                            ]
                        },
                        "maxItems": 100
                    }
                },
                "required": [
                    "amount",
                    "order_id",
                    "return_url"
                ],
                "title": "CreatePaymentRequest"
            },
            "PaymentLinkResource": {
                "type": "object",
                "properties": {
                    "uuid": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "amount": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "min_amount": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "max_amount": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "currency": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "payable": {
                        "type": "boolean"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "max_uses": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "stats": {
                        "type": "object",
                        "properties": {
                            "views": {
                                "type": "integer"
                            },
                            "paid": {
                                "type": "integer"
                            },
                            "conversion": {
                                "type": "number"
                            }
                        },
                        "required": [
                            "views",
                            "paid",
                            "conversion"
                        ]
                    },
                    "created_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "uuid",
                    "slug",
                    "url",
                    "title",
                    "description",
                    "amount",
                    "min_amount",
                    "max_amount",
                    "currency",
                    "status",
                    "payable",
                    "expires_at",
                    "max_uses",
                    "stats",
                    "created_at"
                ],
                "title": "PaymentLinkResource"
            },
            "PaymentResource": {
                "type": "object",
                "properties": {
                    "uuid": {
                        "type": "string"
                    },
                    "order_id": {
                        "type": "string"
                    },
                    "amount": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "number"
                            }
                        ]
                    },
                    "refunded_amount": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "number"
                            }
                        ]
                    },
                    "currency": {
                        "type": "string"
                    },
                    "charge": {
                        "type": "string",
                        "description": "Additive: what the gateway was really charged when a conversion took place (amount, currency, locked fx); null otherwise."
                    },
                    "customer_id": {
                        "type": "string",
                        "description": "The buyer's customer id once the payment is paid (or when you named one); never their details."
                    },
                    "status": {
                        "type": "string"
                    },
                    "checkout_url": {
                        "type": "string"
                    },
                    "processor": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "completed_at": {
                        "type": "string"
                    },
                    "refunded_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "uuid",
                    "order_id",
                    "amount",
                    "refunded_amount",
                    "currency",
                    "charge",
                    "customer_id",
                    "status",
                    "checkout_url",
                    "processor",
                    "created_at",
                    "completed_at",
                    "refunded_at"
                ],
                "title": "PaymentResource"
            },
            "TransactionStatus": {
                "type": "string",
                "enum": [
                    "pending",
                    "processing",
                    "completed",
                    "failed",
                    "expired",
                    "refunded"
                ],
                "title": "TransactionStatus"
            }
        },
        "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"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        }
    }
}