{
  "openapi": "3.1.0",
  "info": {
    "title": "SatsRail API",
    "version": "1.0.0",
    "description": "Take bitcoin payments, over Lightning and on-chain, that go straight to the merchant's own wallet. SatsRail asks the wallet for an invoice, watches it, and tells you when it is paid. It never holds the money.\n\n**Base URL.** `https://app.satsrail.com`. Every path starts with `/api/v1`.\n\n**Authentication.** Send your key as `Authorization: Bearer <key>`.\n- A secret key (`sk_live_…`, `sk_test_…`) calls the merchant API, `/api/v1/m/…`. Make one in Settings → API Keys and keep it on your server. Live keys work on every plan once the merchant's account is approved; test keys work before that too, while it is set up or reviewed.\n- A publishable key (`pk_live_…`, `pk_test_…`) calls the public API, `/api/v1/pub/…`, from a web page, and reads the catalog (`GET /api/v1/m/catalog`, `GET /api/v1/m/products`) as a shopper sees it.\n- A point of sale can sign a person in and get a key of its own: `POST /api/v1/m/sessions` for a code the person approves on satsrail.com/device, `POST /api/v1/m/sessions/token` until it is approved, then `POST /api/v1/m/sessions/activate`. No password is ever sent. See the POS guide.\n\n**Live and test.** A key's mode is the mode of everything it makes and reads. Test mode never reaches a wallet. To pay a test invoice, call `POST /api/v1/m/invoices/{id}/simulate_payment`.\n\n**Money.** Amounts named `…_cents` are whole numbers of the currency's smallest unit (2500 is $25.00 for a USD merchant). Amounts named `…_sats` are satoshis.\n\n**Errors.** Every failure answers the same shape, with the HTTP status that fits:\n\n```json\n{\"error\": {\"code\": \"validation_error\", \"message\": \"Validation failed\", \"status\": 422,\n           \"details\": [\"Total amount cents must be greater than 0\"],\n           \"fields\": {\"total_amount_cents\": [\"must be greater than 0\"]},\n           \"request_id\": \"5f0c…\"}}\n```\n\nRead `code`: it doesn't change. `message` is for a person. `details` says more where there is more to say (each refused item, the figures of a `price_changed`, the order a failure left pending), and `fields` maps a `validation_error`'s messages to their fields. Quote `request_id` to support. A 409, a 429 and a 5xx are safe to send again with the same `Idempotency-Key`; any other 4xx answers the same until you change the request.\n\n**Retrying safely.** Send an `Idempotency-Key` header with every request that makes something (an order, a payment request, an invoice). The same key with the same request gets the first answer again for 24 hours (`X-Idempotency-Replayed: true`). The same key with another request answers 422 `idempotency_key_reused`. A request still running answers 409 `idempotency_in_progress`.\n\n**Lists.** `page` and `per_page` (25 by default, 100 at most); `meta` says where you are. Filter with `q[field_predicate]=value`, such as `q[status_eq]=paid` or `q[created_at_gteq]=2026-10-01`. A filter a list doesn't take answers 422 `invalid_filter`.\n\n**Rate limits.** Each key's limits are its merchant's plan's: Free 20 requests a minute and 200 an hour, Starter 100 and 1,000, Pro 300 and 3,000, Pro Plus and Enterprise 1,000 and 10,000 (`GET /api/v1/pub/subscription_plans` answers each plan's `rate_limits`). `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` count the minute; the same three ending `-Hour` count the hour. Asking whether an invoice was paid (`GET …/status`) doesn't count toward the hour; on Free a key asks it at most 12 times a minute. Past a limit: 429 `rate_limit_exceeded`, with `Retry-After`.\n\n**Open invoices.** A merchant has at most so many invoices waiting to be paid at once, live and test counted apart: Free 5, Starter 20, Pro 100, Pro Plus and Enterprise 500 (each plan's `max_open_invoices`). A Lightning invoice is open 15 minutes at most. Past the limit a new invoice answers 429 `open_invoice_limit_reached` with `Retry-After`; an order the request made stays pending, named in `error.details.order_id`, and the same request sent again invoices it once one is paid, expires or is cancelled.\n"
  },
  "servers": [
    {
      "url": "https://app.satsrail.com"
    }
  ],
  "paths": {
    "/api/v1/m/sessions": {
      "delete": {
        "summary": "Sign this device out",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "204": {
            "description": "Done. No body."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_token",
                    "message": "Invalid or revoked API token",
                    "status": 401,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "No key, or one that doesn't work. Codes: `invalid_token`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `not_a_device_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_a_device_key",
                    "message": "Only a key a device signed in for is ended here. End any other key in Settings → API Keys.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Ends the device's key at once. Send the key as `Authorization: Bearer`. Answers 204. Only a key a device signed in for is ended here; any other key answers 422 `not_a_device_key` and is ended in Settings → API Keys."
      },
      "post": {
        "summary": "Start signing a person in on a POS",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "device_code": {
                      "type": "string"
                    },
                    "user_code": {
                      "type": "string"
                    },
                    "verification_uri": {
                      "type": "string"
                    },
                    "verification_uri_complete": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer",
                      "description": "Seconds the session token lasts."
                    },
                    "interval": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "device_code": "Hn0p3Wq7…",
                  "user_code": "BCDF-GHJK",
                  "verification_uri": "https://www.satsrail.com/device",
                  "verification_uri_complete": "https://www.satsrail.com/device?code=BCDF-GHJK",
                  "expires_in": 600,
                  "interval": 5
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "description": "The body is too large. Codes: `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payload_too_large",
                    "message": "A sign-in's body is at most 4096 bytes.",
                    "status": 413,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as text/plain. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unknown_parameter",
                    "message": "Not a field of this call: email, password. It takes device_name.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The request can't be done as sent. Codes: `unknown_parameter`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limit_exceeded",
                    "message": "Rate limit exceeded. Try again in 60 seconds.",
                    "status": 429,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Too many requests. Codes: `rate_limit_exceeded`."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "device_name": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "What the person sees on satsrail.com/device when they approve it (\"Front counter iPad\"). Optional."
                  }
                }
              },
              "example": {
                "device_name": "Front counter iPad"
              }
            }
          }
        },
        "description": "Step one of a device's sign-in, with no key and no password. Send a `device_name` if you like. The answer is a `device_code`, which the device keeps to itself, and a `user_code` to show the person with `verification_uri` (`https://satsrail.com/device`), or `verification_uri_complete` as a QR code.\n\nThe person opens it on their phone or computer, signs in there as they always do, and approves the code, confirming it's them. Meanwhile ask `POST /api/v1/m/sessions/token` every `interval` seconds, for up to `expires_in` seconds (RFC 8628, the device authorization grant).",
        "security": []
      }
    },
    "/api/v1/m/sessions/token": {
      "post": {
        "summary": "Ask whether the person approved the code",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session_token": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "merchants": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "logo_url": {},
                          "currency": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "live_available": {
                            "type": "boolean"
                          },
                          "live_needs_two_factor": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "session_token": "eyJfcmFpbHMiOnsiZGF0YSI6…",
                  "expires_in": 600,
                  "merchants": [
                    {
                      "id": "46525025-e63a-47d3-bc3b-1579896dd502",
                      "name": "Corner Coffee",
                      "logo_url": null,
                      "currency": "usd",
                      "role": "owner",
                      "live_available": true,
                      "live_needs_two_factor": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request couldn't be read. Codes: `authorization_pending`, `slow_down`, `access_denied`, `expired_token`, `invalid_device_code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "authorization_pending",
                    "message": "Waiting for the person to approve the code on the portal.",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "description": "The body is too large. Codes: `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payload_too_large",
                    "message": "A sign-in's body is at most 4096 bytes.",
                    "status": 413,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as text/plain. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unknown_parameter",
                    "message": "Not a field of this call: email. It takes device_code.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The request can't be done as sent. Codes: `unknown_parameter`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limit_exceeded",
                    "message": "Rate limit exceeded. Try again in 60 seconds.",
                    "status": 429,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Too many requests. Codes: `rate_limit_exceeded`."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_code"
                ],
                "properties": {
                  "device_code": {
                    "type": "string",
                    "description": "From `POST /api/v1/m/sessions`. Keep it on the device: it is never shown."
                  }
                }
              },
              "example": {
                "device_code": "Hn0p3Wq7…"
              }
            }
          }
        },
        "description": "Step two. Send the `device_code` every `interval` seconds. Until the person approves the code, the answer is 400 `authorization_pending` (`slow_down` when asked sooner); refused on the portal it is `access_denied`, and `expired_token` once the code ran out or was used.\n\nApproved, it answers once with a `session_token` (10 minutes, one key) and the merchants where the person may run a POS. `live_available` says whether a live key works there; `live_needs_two_factor` says whether it waits on the person adding a passkey."
      }
    },
    "/api/v1/m/sessions/activate": {
      "post": {
        "summary": "Get a key for this device",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "session_token",
                  "merchant_id"
                ],
                "properties": {
                  "session_token": {
                    "type": "string",
                    "description": "From `POST /api/v1/m/sessions/token`. Good for 10 minutes, and for one key."
                  },
                  "merchant_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "One of the `merchants` the sign-in answered."
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "default": "live",
                    "description": "`test` for a key that sells in test mode: no money, on every plan."
                  },
                  "device_name": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "What the merchant sees beside the key (\"Front counter iPad\"). \"POS device\" when left out."
                  }
                }
              },
              "example": {
                "session_token": "eyJfcmFpbHMiOnsiZGF0YSI6…",
                "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                "mode": "test",
                "device_name": "Front counter iPad"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceKey"
                },
                "example": {
                  "api_key": "sk_test_YOUR_SECRET_KEY",
                  "livemode": false,
                  "expires_at": "2026-12-25T03:24:37.224Z",
                  "renewable_until": "2027-02-23T03:24:37.259Z",
                  "device_name": "Front counter iPad",
                  "merchant": {
                    "id": "46525025-e63a-47d3-bc3b-1579896dd502",
                    "name": "Corner Coffee",
                    "currency": "usd"
                  },
                  "location": {
                    "id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "name": "Corner Coffee"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request couldn't be read. Codes: `missing_params`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "missing_params",
                    "message": "Session token and merchant ID are required",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "401": {
            "description": "No key, or one that doesn't work. Codes: `invalid_session`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_session",
                    "message": "Session expired or invalid. Please sign in again.",
                    "status": 401,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key may not do this. Codes: `access_denied`, `no_security_group`, `merchant_not_operational`, `device_sign_in_disabled`, `two_factor_setup_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "two_factor_setup_required",
                    "message": "Signing a device in for live sales as an owner or a manager needs a passkey on your account: add one in Account settings, then sign the device in again. A cashier's account signs in without it, and so does mode \"test\".",
                    "status": 403,
                    "details": {
                      "mode": "live"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payload_too_large",
                    "message": "A sign-in's body is at most 4096 bytes.",
                    "status": 413,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is too large. Codes: `payload_too_large`."
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as text/plain. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `unknown_parameter`, `invalid_argument`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unknown_parameter",
                    "message": "Not a field of this call: devicename. It takes session_token, merchant_id, mode, device_name.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Step three. Send the `session_token` and the chosen `merchant_id`, with `mode` (`live` or `test`) and a `device_name` if you like. The answer's `api_key` belongs to this device alone: send it as the Bearer key from now on.\n\nIt reaches the endpoints a counter needs, at the person's location, within what their security group allows. It lasts 30 days (`expires_at`); renew it up to `renewable_until` with `POST /api/v1/m/sessions/renew`.\n\nA live key for someone above a cashier needs a passkey on their account (403 `two_factor_setup_required`); test keys never do. A refused call makes no key, so the token can be sent again.",
        "security": []
      }
    },
    "/api/v1/m/sessions/renew": {
      "post": {
        "summary": "Keep this device's key",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKey"
                },
                "example": {
                  "object": "api_token",
                  "id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                  "name": "POS — ana@example.com",
                  "token_type": "secret",
                  "livemode": false,
                  "security_group": {
                    "id": "0ee6f8cc-8e23-4d11-82e9-f2e5346ea0da",
                    "name": "admin",
                    "admin": true
                  },
                  "permissions": {
                    "access": "manage",
                    "api_request_logs": "manage",
                    "api_tokens": "manage",
                    "checkout_sessions": "manage",
                    "costs": "manage",
                    "customer_notes": "manage",
                    "customers": "manage",
                    "discounts": "manage",
                    "employees": "manage",
                    "integrations": "manage",
                    "inventory": "manage",
                    "invoices": "manage",
                    "kitchen": "manage",
                    "locations": "manage",
                    "loyalty": "manage",
                    "media_keys": "manage",
                    "merchant_documents": "manage",
                    "onchain_payments": "manage",
                    "orders": "manage",
                    "payment_gateways": "manage",
                    "payment_requests": "manage",
                    "payments": "manage",
                    "pos": "manage",
                    "product_types": "manage",
                    "products": "manage",
                    "quick_charges": "manage",
                    "refund_requests": "manage",
                    "refunds": "manage",
                    "reports": "manage",
                    "security_groups": "manage",
                    "settings": "manage",
                    "stock_counts": "manage",
                    "taxes": "manage",
                    "team": "manage",
                    "timesheets": "manage",
                    "users": "manage",
                    "wallets": "manage",
                    "webhooks": "manage"
                  },
                  "endpoints": [
                    "api_tokens#current",
                    "merchants#show",
                    "catalog#show",
                    "catalog#version",
                    "products#index",
                    "products#show",
                    "product_types#index",
                    "product_types#show",
                    "locations#index",
                    "locations#show",
                    "orders#index",
                    "orders#show",
                    "orders#create",
                    "orders#update",
                    "orders#destroy",
                    "invoices#show",
                    "invoices#generate",
                    "invoices#qr",
                    "invoices#status",
                    "invoices#simulate_payment",
                    "invoices#simulate_expiry",
                    "payment_requests#create",
                    "payment_requests#show",
                    "payment_requests#status",
                    "payments#index",
                    "payments#show",
                    "api_tokens#renew"
                  ],
                  "pos": true,
                  "device_name": "Front counter iPad",
                  "location": {
                    "id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "name": "Corner Coffee"
                  },
                  "created_at": "2026-11-25T03:24:37.259Z",
                  "expires_at": "2026-12-25T03:24:37.344Z",
                  "renewable_until": "2027-02-23T03:24:37.259Z"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "token_expired",
                    "message": "This device's key expired on 2026-12-16. Sign in again (POST /api/v1/m/sessions).",
                    "status": 401,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "No key, or one that doesn't work. Codes: `missing_token`, `invalid_token`, `token_expired`, `token_revoked`."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "merchant_not_operational",
                    "message": "Merchant account is suspended. Contact support for assistance.",
                    "status": 403,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The key may not do this. Codes: `merchant_not_operational`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `not_a_device_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_a_device_key",
                    "message": "Only a key a device signed in for is renewed here. Any other key is replaced in Settings → API Keys.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Moves the device key's end to 30 days from now, never past `renewable_until` (90 days after sign-in). Send the key as the Bearer key; no body. It is the same key, so retrying is harmless, and an ended key is not brought back.\n\nCall it once a day. When `expires_at` reaches `renewable_until`, sign the person in again before a shift. Only a device's key is renewed here (422 `not_a_device_key`)."
      }
    },
    "/api/v1/m/api_token": {
      "get": {
        "summary": "Read the key you are calling with",
        "tags": [
          "API token"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKey"
                },
                "example": {
                  "object": "api_token",
                  "id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                  "name": "POS — ana@example.com",
                  "token_type": "secret",
                  "livemode": false,
                  "security_group": {
                    "id": "0ee6f8cc-8e23-4d11-82e9-f2e5346ea0da",
                    "name": "admin",
                    "admin": true
                  },
                  "permissions": {
                    "access": "manage",
                    "api_request_logs": "manage",
                    "api_tokens": "manage",
                    "checkout_sessions": "manage",
                    "costs": "manage",
                    "customer_notes": "manage",
                    "customers": "manage",
                    "discounts": "manage",
                    "employees": "manage",
                    "integrations": "manage",
                    "inventory": "manage",
                    "invoices": "manage",
                    "kitchen": "manage",
                    "locations": "manage",
                    "loyalty": "manage",
                    "media_keys": "manage",
                    "merchant_documents": "manage",
                    "onchain_payments": "manage",
                    "orders": "manage",
                    "payment_gateways": "manage",
                    "payment_requests": "manage",
                    "payments": "manage",
                    "pos": "manage",
                    "product_types": "manage",
                    "products": "manage",
                    "quick_charges": "manage",
                    "refund_requests": "manage",
                    "refunds": "manage",
                    "reports": "manage",
                    "security_groups": "manage",
                    "settings": "manage",
                    "stock_counts": "manage",
                    "taxes": "manage",
                    "team": "manage",
                    "timesheets": "manage",
                    "users": "manage",
                    "wallets": "manage",
                    "webhooks": "manage"
                  },
                  "endpoints": [
                    "api_tokens#current",
                    "merchants#show",
                    "catalog#show",
                    "catalog#version",
                    "products#index",
                    "products#show",
                    "product_types#index",
                    "product_types#show",
                    "locations#index",
                    "locations#show",
                    "orders#index",
                    "orders#show",
                    "orders#create",
                    "orders#update",
                    "orders#destroy",
                    "invoices#show",
                    "invoices#generate",
                    "invoices#qr",
                    "invoices#status",
                    "invoices#simulate_payment",
                    "invoices#simulate_expiry",
                    "payment_requests#create",
                    "payment_requests#show",
                    "payment_requests#status",
                    "payments#index",
                    "payments#show",
                    "api_tokens#renew"
                  ],
                  "pos": true,
                  "device_name": "Front counter iPad",
                  "location": {
                    "id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "name": "Corner Coffee"
                  },
                  "created_at": "2026-11-25T03:24:37.259Z",
                  "expires_at": "2026-12-25T03:24:37.224Z",
                  "renewable_until": "2027-02-23T03:24:37.259Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key belongs to no merchant: the merchant API (/api/v1/m) takes a merchant's key.",
                    "status": 403,
                    "request_id": "23be5cd1-da34-41cc-872d-32cd03c2ce92"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "What the key may do. `permissions` lists each resource the key reads or manages. For a POS key, `endpoints` lists the calls it reaches, `location` is where it sells and `device_name` is the device. `expires_at` is when it ends. The key itself is never shown."
      }
    },
    "/api/v1/m/api_tokens/{id}/usage": {
      "get": {
        "summary": "Read a key's usage",
        "tags": [
          "API token"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "77af5931-75a5-4e02-88df-c55e3fe6ffce"
          },
          {
            "name": "{}",
            "in": "query",
            "required": false,
            "schema": {
              "type": "null"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string"
                    },
                    "rpm_limit": {
                      "type": "integer",
                      "description": "Effective requests-per-minute limit (per-token override or plan default)"
                    },
                    "monthly_request_count": {
                      "type": "integer",
                      "description": "Number of requests made this billing period"
                    },
                    "last_request_counted_at": {
                      "type": "null"
                    },
                    "last_used_at": {
                      "type": "null"
                    },
                    "created_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "token_type",
                    "rpm_limit",
                    "monthly_request_count",
                    "last_request_counted_at",
                    "last_used_at",
                    "created_at"
                  ]
                },
                "example": {
                  "id": "77af5931-75a5-4e02-88df-c55e3fe6ffce",
                  "name": "Test API Token",
                  "token_type": "secret",
                  "rpm_limit": 100,
                  "monthly_request_count": 0,
                  "last_request_counted_at": null,
                  "last_used_at": null,
                  "created_at": "2026-11-16T22:40:27.977Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage api tokens. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "request_id": "891655e9-5b62-4bed-ad8b-9583b49e80e4",
                    "details": {
                      "resource": "api_tokens",
                      "access": "manage"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "How many requests a key has made this month and its limit per minute."
      }
    },
    "/api/v1/m/merchant": {
      "get": {
        "summary": "Read the merchant",
        "tags": [
          "Merchant"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "client_type": {
                      "type": "string",
                      "description": "erp, privapaid or api: its plan's. Every merchant is erp but a PrivaPaid channel or a merchant on an API plan, which sells through its own integration (no POS and no store modules); what an erp merchant has (the POS, the CRM, the online store) follows its plan, not this."
                    },
                    "email": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "address": {},
                    "city": {},
                    "state": {
                      "type": "string"
                    },
                    "postal_code": {},
                    "status": {
                      "type": "string"
                    },
                    "time_zone": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "conversion_fee_percent": {
                      "type": "number"
                    },
                    "locale": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "tip_options": {
                      "type": "array",
                      "items": {}
                    },
                    "logo_url": {},
                    "images": {
                      "type": "array",
                      "items": {}
                    },
                    "taxes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "string",
                            "description": "A percentage, as a decimal string"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        }
                      },
                      "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
                    },
                    "livemode": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "object": "merchant",
                  "id": "46525025-e63a-47d3-bc3b-1579896dd502",
                  "name": "Corner Coffee",
                  "client_type": "erp",
                  "email": "merchant1@example.com",
                  "phone": "(555) 555-0100",
                  "address": null,
                  "city": null,
                  "state": "CA",
                  "postal_code": null,
                  "status": "active",
                  "time_zone": "UTC",
                  "currency": "usd",
                  "conversion_fee_percent": 0.0,
                  "locale": "en",
                  "created_at": "2026-11-25T03:24:36.294Z",
                  "updated_at": "2026-11-25T03:24:36.936Z",
                  "tip_options": [],
                  "logo_url": null,
                  "images": [],
                  "taxes": [
                    {
                      "id": "48d12b21-375f-4654-b0d3-fe213c974dcf",
                      "name": "Sales tax",
                      "rate": "8.0",
                      "enabled": true
                    }
                  ],
                  "livemode": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "merchant_not_operational",
                    "message": "Merchant account is not yet active. Finish setup in the dashboard: business details, the agreements and a Lightning Address.",
                    "status": 403,
                    "request_id": "97f4beb9-e778-4c38-80fb-2288e07e1fa6"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The merchant the key belongs to. Its name, currency, time zone, tip options and taxes. `wallets` is included for a key that reads wallets."
      }
    },
    "/api/v1/m/catalog": {
      "get": {
        "summary": "Read the whole catalog",
        "tags": [
          "Catalog"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                },
                "example": {
                  "object": "catalog",
                  "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                  "location": {
                    "id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "name": "Corner Coffee",
                    "time_zone": "Etc/UTC"
                  },
                  "catalog_version": "2026-11-25T03:24:36.936612Z",
                  "catalog_refresh_minutes": 30,
                  "product_types": [
                    {
                      "id": "45e77889-3cb2-4226-b870-d25054070962",
                      "name": "Drinks",
                      "position": 0,
                      "color": "#EF4444",
                      "images": [],
                      "products": [
                        {
                          "id": "prod_662969e0e954faca7c1e68b0",
                          "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                          "name": "Latte",
                          "description": null,
                          "price_cents": 450,
                          "currency": "usd",
                          "sku": null,
                          "formatted_price": "$4.50",
                          "image_url": null,
                          "image_medium_url": null,
                          "images": [],
                          "position": 0,
                          "skus": [
                            {
                              "id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                              "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                              "code": null,
                              "barcode": null,
                              "name": "Latte",
                              "price_cents": 450,
                              "default": true,
                              "status": "active",
                              "modifiers": [],
                              "weight_grams": null,
                              "length_mm": null,
                              "width_mm": null,
                              "height_mm": null,
                              "images": [],
                              "choice_name": "Regular",
                              "line_name": "Latte",
                              "sold_out": false,
                              "held_for_pickup": 0
                            }
                          ]
                        }
                      ],
                      "tax_ids": [
                        "48d12b21-375f-4654-b0d3-fe213c974dcf"
                      ]
                    }
                  ],
                  "taxes": [
                    {
                      "id": "48d12b21-375f-4654-b0d3-fe213c974dcf",
                      "name": "Sales tax",
                      "rate": "8.0",
                      "enabled": true
                    }
                  ],
                  "discounts": [],
                  "livemode": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Everything a POS needs to sell, in one call: product types, their products, each product's SKUs with prices and whether they are sold out, taxes and discounts. A POS key gets the catalog of the location it sells at.\n\nKeep the `ETag` and send it back as `If-None-Match`: an unchanged catalog answers 304 with no body. `GET /api/v1/m/catalog/version` is the cheaper way to ask whether it changed.\n\nTo sell an item, send its SKU's `id` as `sku_id` on an order."
      }
    },
    "/api/v1/m/catalog/version": {
      "get": {
        "summary": "Ask whether the catalog changed",
        "tags": [
          "Catalog"
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "catalog_version": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "catalog_version": "2026-11-25T03:24:36.936612Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Answers `catalog_version`, a timestamp that changes whenever the catalog does. Compare it with the one you hold and fetch the catalog again only when it differs."
      }
    },
    "/api/v1/m/products": {
      "get": {
        "summary": "List products",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `name`, `status`, `sku`, `external_ref`, `created_at`, `updated_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "name_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "null"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "sku": {
                            "type": "null"
                          },
                          "price_cents": {
                            "type": "integer",
                            "description": "Its default SKU's price, kept for compatibility: the price a checkout or payment link charges. Each SKU's own is in skus."
                          },
                          "currency": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "image_url": {
                            "type": "null"
                          },
                          "image_medium_url": {
                            "type": "null"
                          },
                          "images": {
                            "type": "array",
                            "items": {}
                          },
                          "access_duration_seconds": {
                            "type": "null"
                          },
                          "product_type_id": {
                            "type": "string",
                            "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                          },
                          "merchant_id": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "formatted_price": {
                            "type": "string",
                            "description": "Its default SKU's price, formatted."
                          },
                          "payment_link_url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                          },
                          "skus": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "location_id": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "null",
                                  "description": "Unique across the merchant's SKUs. The default SKU's is the product's sku."
                                },
                                "barcode": {
                                  "type": "null"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                                },
                                "price_cents": {
                                  "type": "integer",
                                  "description": "What an item of it costs, in the subunits of the merchant's currency. Every price is a SKU's: a product has none of its own."
                                },
                                "default": {
                                  "type": "boolean",
                                  "description": "The product's default SKU: an item naming the product alone is this SKU."
                                },
                                "status": {
                                  "type": "string"
                                },
                                "modifiers": {
                                  "type": "array",
                                  "items": {},
                                  "description": "Labels, up to five, such as Color: Black."
                                },
                                "weight_grams": {
                                  "type": "null",
                                  "description": "Weight in whole grams, or null."
                                },
                                "length_mm": {
                                  "type": "null",
                                  "description": "Length in whole millimetres, or null."
                                },
                                "width_mm": {
                                  "type": "null",
                                  "description": "Width in whole millimetres, or null."
                                },
                                "height_mm": {
                                  "type": "null",
                                  "description": "Height in whole millimetres, or null."
                                },
                                "images": {
                                  "type": "array",
                                  "items": {}
                                }
                              },
                              "required": [
                                "id",
                                "location_id",
                                "code",
                                "barcode",
                                "name",
                                "price_cents",
                                "default",
                                "status",
                                "modifiers",
                                "weight_grams",
                                "length_mm",
                                "width_mm",
                                "height_mm",
                                "images"
                              ]
                            },
                            "description": "Every SKU it has, archived ones included, its default first."
                          },
                          "track_stock": {
                            "type": "boolean"
                          },
                          "lot_tracking": {
                            "type": "string"
                          },
                          "external_ref": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {
                              "internal_note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        },
                        "required": [
                          "object",
                          "livemode",
                          "id",
                          "name",
                          "description",
                          "slug",
                          "sku",
                          "price_cents",
                          "currency",
                          "status",
                          "position",
                          "image_url",
                          "image_medium_url",
                          "images",
                          "access_duration_seconds",
                          "product_type_id",
                          "merchant_id",
                          "created_at",
                          "updated_at",
                          "formatted_price",
                          "payment_link_url",
                          "skus"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 0,
                    "total_pages": 0,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read products. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "products",
                      "access": "read"
                    },
                    "request_id": "4a54d49e-dbf8-49a8-9c0e-2e45ebe06798"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "invalid_argument",
                    "message": "page is a whole number",
                    "status": 422,
                    "request_id": "4d54a6ab-88cf-4a08-96a4-1b9c52d81649"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The merchant's products, in the key's mode. Filter with `q[…]`. A publishable key, which anyone can copy from a web page, is listed what is on sale only, without `metadata`, `external_ref` or archived SKUs."
      },
      "post": {
        "summary": "Create a product",
        "tags": [
          "Products"
        ],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "null"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "null"
                    },
                    "price_cents": {
                      "type": "integer",
                      "description": "Its default SKU's price, kept for compatibility: the price a checkout or payment link charges. Each SKU's own is in skus."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "image_url": {
                      "type": "null"
                    },
                    "image_medium_url": {
                      "type": "null"
                    },
                    "images": {
                      "type": "array",
                      "items": {}
                    },
                    "access_duration_seconds": {
                      "type": "null"
                    },
                    "track_stock": {
                      "type": "boolean"
                    },
                    "lot_tracking": {
                      "type": "string"
                    },
                    "product_type_id": {
                      "type": "string",
                      "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                    },
                    "merchant_id": {
                      "type": "string"
                    },
                    "external_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "formatted_price": {
                      "type": "string",
                      "description": "Its default SKU's price, formatted."
                    },
                    "payment_link_url": {
                      "type": "string",
                      "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "skus": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "location_id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "null",
                            "description": "Unique across the merchant's SKUs. The default SKU's is the product's sku."
                          },
                          "barcode": {
                            "type": "null"
                          },
                          "name": {
                            "type": "string",
                            "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                          },
                          "price_cents": {
                            "type": "integer",
                            "description": "What an item of it costs, in the subunits of the merchant's currency. Every price is a SKU's: a product has none of its own."
                          },
                          "default": {
                            "type": "boolean",
                            "description": "The product's default SKU: an item naming the product alone is this SKU."
                          },
                          "status": {
                            "type": "string"
                          },
                          "modifiers": {
                            "type": "array",
                            "items": {},
                            "description": "Labels, up to five, such as Color: Black."
                          },
                          "weight_grams": {
                            "type": "null",
                            "description": "Weight in whole grams, or null."
                          },
                          "length_mm": {
                            "type": "null",
                            "description": "Length in whole millimetres, or null."
                          },
                          "width_mm": {
                            "type": "null",
                            "description": "Width in whole millimetres, or null."
                          },
                          "height_mm": {
                            "type": "null",
                            "description": "Height in whole millimetres, or null."
                          },
                          "images": {
                            "type": "array",
                            "items": {}
                          }
                        },
                        "required": [
                          "id",
                          "location_id",
                          "code",
                          "barcode",
                          "name",
                          "price_cents",
                          "default",
                          "status",
                          "modifiers",
                          "weight_grams",
                          "length_mm",
                          "width_mm",
                          "height_mm",
                          "images"
                        ]
                      },
                      "description": "Every SKU it has, archived ones included, its default first."
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "name",
                    "description",
                    "slug",
                    "sku",
                    "price_cents",
                    "currency",
                    "status",
                    "position",
                    "image_url",
                    "image_medium_url",
                    "images",
                    "access_duration_seconds",
                    "track_stock",
                    "lot_tracking",
                    "product_type_id",
                    "merchant_id",
                    "external_ref",
                    "created_at",
                    "updated_at",
                    "formatted_price",
                    "payment_link_url",
                    "metadata",
                    "skus"
                  ]
                },
                "example": {
                  "object": "product",
                  "livemode": true,
                  "id": "e8227797-9ca0-4d85-a5dd-f0ad03d2a377",
                  "name": "B",
                  "description": null,
                  "slug": "prod_b59c6bce1a95a1f94999c61d",
                  "sku": null,
                  "price_cents": 1,
                  "currency": "usd",
                  "status": "active",
                  "position": 0,
                  "image_url": null,
                  "image_medium_url": null,
                  "images": [],
                  "access_duration_seconds": null,
                  "track_stock": false,
                  "lot_tracking": "none",
                  "product_type_id": "253880f1-a730-4242-b022-8af04c343798",
                  "merchant_id": "8c352b19-119f-4800-86d4-95184e4e33f6",
                  "external_ref": null,
                  "created_at": "2026-11-16T22:40:29.487Z",
                  "updated_at": "2026-11-16T22:40:29.487Z",
                  "formatted_price": "$0.01",
                  "payment_link_url": "https://www.satsrail.com/pay/prod_b59c6bce1a95a1f94999c61d",
                  "metadata": {},
                  "skus": [
                    {
                      "id": "3a0028e6-6c95-4abb-8e6e-997c3793f76d",
                      "location_id": "a95097f0-fe15-48a3-b2ab-d39dd60ad9b5",
                      "code": null,
                      "barcode": null,
                      "name": "B",
                      "price_cents": 1,
                      "default": true,
                      "status": "active",
                      "modifiers": [],
                      "weight_grams": null,
                      "length_mm": null,
                      "width_mm": null,
                      "height_mm": null,
                      "images": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage products. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "products",
                      "access": "manage"
                    },
                    "request_id": "9606e93f-1d68-418e-a274-bf38c83f5ed8"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fields": {
                          "type": "object",
                          "properties": {
                            "price_cents": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "description": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "name": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "product_type": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "price": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "fields",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "validation_error",
                    "message": "Validation failed",
                    "status": 422,
                    "details": [
                      "Price is not a number",
                      "Price is not a number",
                      "Price can't be blank"
                    ],
                    "fields": {
                      "price_cents": [
                        "is not a number",
                        "can't be blank"
                      ],
                      "description": [
                        "is too long (maximum is 1000 characters)"
                      ],
                      "name": [
                        "can't be blank"
                      ],
                      "product_type": [
                        "must belong to the same merchant"
                      ],
                      "price": [
                        "is not a number"
                      ]
                    },
                    "request_id": "1dee7166-8d7a-4d84-b00e-6e63587b33ca"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "price_cents": {
                        "type": "integer",
                        "description": "Sets the price of the product's default SKU, in the subunits of the merchant's currency. A product has no price of its own: every price is a SKU's, and its other SKUs keep theirs."
                      },
                      "product_type_id": {
                        "type": "string",
                        "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                      },
                      "external_ref": {
                        "type": "string"
                      },
                      "image_url": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "price_cents"
                    ]
                  }
                },
                "required": [
                  "product"
                ]
              },
              "example": {
                "product": {
                  "name": "B",
                  "price_cents": 1,
                  "product_type_id": "40735568-9007-471b-9213-44ea3a8fad61",
                  "external_ref": "ch_fitness-series",
                  "image_url": "https://example.com/image.jpg"
                }
              }
            }
          }
        },
        "description": "Adds a product under a product type. A price sent with it sets the price of its default SKU."
      }
    },
    "/api/v1/m/products/{id}": {
      "get": {
        "summary": "Read a product",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "prod_26c9a8ab8eb367c7d4020355"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "null"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "null"
                    },
                    "price_cents": {
                      "type": "integer",
                      "description": "Its default SKU's price, kept for compatibility: the price a checkout or payment link charges. Each SKU's own is in skus."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "image_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "image_medium_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "alt_text": {
                            "type": "null"
                          },
                          "url": {
                            "type": "string"
                          },
                          "medium_url": {
                            "type": "string"
                          },
                          "thumb_url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "position",
                          "alt_text",
                          "url",
                          "medium_url",
                          "thumb_url"
                        ]
                      }
                    },
                    "access_duration_seconds": {
                      "type": "null"
                    },
                    "track_stock": {
                      "type": "boolean"
                    },
                    "lot_tracking": {
                      "type": "string"
                    },
                    "product_type_id": {
                      "type": "string",
                      "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                    },
                    "merchant_id": {
                      "type": "string"
                    },
                    "external_ref": {
                      "type": "null"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "formatted_price": {
                      "type": "string",
                      "description": "Its default SKU's price, formatted."
                    },
                    "payment_link_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "skus": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "location_id": {
                            "type": "string"
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Unique across the merchant's SKUs. The default SKU's is the product's sku."
                          },
                          "barcode": {
                            "type": "null"
                          },
                          "name": {
                            "type": "string",
                            "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                          },
                          "price_cents": {
                            "type": "integer",
                            "description": "What an item of it costs, in the subunits of the merchant's currency. Every price is a SKU's: a product has none of its own."
                          },
                          "default": {
                            "type": "boolean",
                            "description": "The product's default SKU: an item naming the product alone is this SKU."
                          },
                          "status": {
                            "type": "string"
                          },
                          "modifiers": {
                            "type": "array",
                            "items": {},
                            "description": "Labels, up to five, such as Color: Black."
                          },
                          "weight_grams": {
                            "type": "null",
                            "description": "Weight in whole grams, or null."
                          },
                          "length_mm": {
                            "type": "null",
                            "description": "Length in whole millimetres, or null."
                          },
                          "width_mm": {
                            "type": "null",
                            "description": "Width in whole millimetres, or null."
                          },
                          "height_mm": {
                            "type": "null",
                            "description": "Height in whole millimetres, or null."
                          },
                          "images": {
                            "type": "array",
                            "items": {}
                          }
                        },
                        "required": [
                          "id",
                          "location_id",
                          "code",
                          "barcode",
                          "name",
                          "price_cents",
                          "default",
                          "status",
                          "modifiers",
                          "weight_grams",
                          "length_mm",
                          "width_mm",
                          "height_mm",
                          "images"
                        ]
                      },
                      "description": "Every SKU it has, archived ones included, its default first."
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "name",
                    "description",
                    "slug",
                    "sku",
                    "price_cents",
                    "currency",
                    "status",
                    "position",
                    "image_url",
                    "image_medium_url",
                    "images",
                    "access_duration_seconds",
                    "track_stock",
                    "lot_tracking",
                    "product_type_id",
                    "merchant_id",
                    "external_ref",
                    "created_at",
                    "updated_at",
                    "formatted_price",
                    "payment_link_url",
                    "metadata",
                    "skus"
                  ]
                },
                "example": {
                  "object": "product",
                  "livemode": true,
                  "id": "8aaf900b-6c82-4a25-9633-63600a7321ae",
                  "name": "Product 148",
                  "description": null,
                  "slug": "prod_26c9a8ab8eb367c7d4020355",
                  "sku": null,
                  "price_cents": 5000,
                  "currency": "usd",
                  "status": "active",
                  "position": 0,
                  "image_url": null,
                  "image_medium_url": null,
                  "images": [],
                  "access_duration_seconds": null,
                  "track_stock": false,
                  "lot_tracking": "none",
                  "product_type_id": "9f46155b-6955-419e-9944-fdd1bb4288c4",
                  "merchant_id": "ce4f1495-6eec-42ad-af20-19c0cc842f63",
                  "external_ref": null,
                  "created_at": "2026-11-16T22:40:13.093Z",
                  "updated_at": "2026-11-16T22:40:13.093Z",
                  "formatted_price": "$50.00",
                  "payment_link_url": "https://www.satsrail.com/pay/prod_26c9a8ab8eb367c7d4020355",
                  "metadata": {},
                  "skus": [
                    {
                      "id": "091d3e9f-f072-4ecc-9b8c-7a11967b68c8",
                      "location_id": "c9d55bca-9b97-47f5-b88d-d7149174a7a5",
                      "code": null,
                      "barcode": null,
                      "name": "Product 148",
                      "price_cents": 5000,
                      "default": true,
                      "status": "active",
                      "modifiers": [],
                      "weight_grams": null,
                      "length_mm": null,
                      "width_mm": null,
                      "height_mm": null,
                      "images": []
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One product, by its UUID or its slug."
      },
      "patch": {
        "summary": "Change a product",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "prod_30872901976af5e46cc33fd3"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "product"
                ]
              },
              "example": {
                "product": {
                  "name": "Updated Name",
                  "status": "archived",
                  "description": ""
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "null"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "null"
                    },
                    "price_cents": {
                      "type": "integer",
                      "description": "Its default SKU's price, kept for compatibility: the price a checkout or payment link charges. Each SKU's own is in skus."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "image_url": {
                      "type": "null"
                    },
                    "image_medium_url": {
                      "type": "null"
                    },
                    "images": {
                      "type": "array",
                      "items": {}
                    },
                    "access_duration_seconds": {
                      "type": "null"
                    },
                    "track_stock": {
                      "type": "boolean"
                    },
                    "lot_tracking": {
                      "type": "string"
                    },
                    "product_type_id": {
                      "type": "string",
                      "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                    },
                    "merchant_id": {
                      "type": "string"
                    },
                    "external_ref": {
                      "type": "null"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "formatted_price": {
                      "type": "string",
                      "description": "Its default SKU's price, formatted."
                    },
                    "payment_link_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "skus": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "location_id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "null",
                            "description": "Unique across the merchant's SKUs. The default SKU's is the product's sku."
                          },
                          "barcode": {
                            "type": "null"
                          },
                          "name": {
                            "type": "string",
                            "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                          },
                          "price_cents": {
                            "type": "integer",
                            "description": "What an item of it costs, in the subunits of the merchant's currency. Every price is a SKU's: a product has none of its own."
                          },
                          "default": {
                            "type": "boolean",
                            "description": "The product's default SKU: an item naming the product alone is this SKU."
                          },
                          "status": {
                            "type": "string"
                          },
                          "modifiers": {
                            "type": "array",
                            "items": {},
                            "description": "Labels, up to five, such as Color: Black."
                          },
                          "weight_grams": {
                            "type": "null",
                            "description": "Weight in whole grams, or null."
                          },
                          "length_mm": {
                            "type": "null",
                            "description": "Length in whole millimetres, or null."
                          },
                          "width_mm": {
                            "type": "null",
                            "description": "Width in whole millimetres, or null."
                          },
                          "height_mm": {
                            "type": "null",
                            "description": "Height in whole millimetres, or null."
                          },
                          "images": {
                            "type": "array",
                            "items": {}
                          }
                        },
                        "required": [
                          "id",
                          "location_id",
                          "code",
                          "barcode",
                          "name",
                          "price_cents",
                          "default",
                          "status",
                          "modifiers",
                          "weight_grams",
                          "length_mm",
                          "width_mm",
                          "height_mm",
                          "images"
                        ]
                      },
                      "description": "Every SKU it has, archived ones included, its default first."
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "name",
                    "description",
                    "slug",
                    "sku",
                    "price_cents",
                    "currency",
                    "status",
                    "position",
                    "image_url",
                    "image_medium_url",
                    "images",
                    "access_duration_seconds",
                    "track_stock",
                    "lot_tracking",
                    "product_type_id",
                    "merchant_id",
                    "external_ref",
                    "created_at",
                    "updated_at",
                    "formatted_price",
                    "payment_link_url",
                    "metadata",
                    "skus"
                  ]
                },
                "example": {
                  "object": "product",
                  "livemode": true,
                  "id": "9710f334-1915-4afb-9931-2cdfa2997fec",
                  "name": "Product 140",
                  "description": null,
                  "slug": "prod_30872901976af5e46cc33fd3",
                  "sku": null,
                  "price_cents": 5000,
                  "currency": "usd",
                  "status": "active",
                  "position": 0,
                  "image_url": null,
                  "image_medium_url": null,
                  "images": [],
                  "access_duration_seconds": null,
                  "track_stock": false,
                  "lot_tracking": "none",
                  "product_type_id": "ce802d77-4680-40ec-8457-176619713deb",
                  "merchant_id": "faf82da1-a38e-45f9-a30d-caff55f72446",
                  "external_ref": null,
                  "created_at": "2026-11-16T22:40:10.704Z",
                  "updated_at": "2026-11-16T22:40:10.865Z",
                  "formatted_price": "$50.00",
                  "payment_link_url": "https://www.satsrail.com/pay/prod_30872901976af5e46cc33fd3",
                  "metadata": {},
                  "skus": [
                    {
                      "id": "87f05f28-1cd7-497a-8cb3-e81bf79090a3",
                      "location_id": "ca0b611f-35be-445f-b0c9-cc320669f88e",
                      "code": null,
                      "barcode": null,
                      "name": "Product 140",
                      "price_cents": 5000,
                      "default": true,
                      "status": "active",
                      "modifiers": [],
                      "weight_grams": null,
                      "length_mm": null,
                      "width_mm": null,
                      "height_mm": null,
                      "images": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Changes the fields you send and leaves the rest. A product's price and status are set when it is made and changed after only in the SatsRail portal or over MCP."
      }
    },
    "/api/v1/m/product_types": {
      "get": {
        "summary": "List product types",
        "tags": [
          "Product types"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `name`, `external_ref`, `created_at`, `updated_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "name_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "external_ref": {
                            "type": "null"
                          },
                          "margin_percent": {
                            "type": "null",
                            "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                          },
                          "images": {
                            "type": "array",
                            "items": {}
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "object",
                          "id",
                          "name",
                          "position",
                          "external_ref",
                          "margin_percent",
                          "images",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 0,
                    "total_pages": 0,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read product types. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "product_types",
                      "access": "read"
                    },
                    "request_id": "0d435efc-0b5f-4163-93f5-0dcebecde1bd"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The groups products are filed under, each with its taxes."
      }
    },
    "/api/v1/m/product_types/{id}": {
      "get": {
        "summary": "Read a product type",
        "tags": [
          "Product types"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "4cfb2fbc-b2b1-4bb9-a680-10cdddef60f1"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "external_ref": {
                      "type": "null"
                    },
                    "margin_percent": {
                      "type": "null",
                      "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                    },
                    "images": {
                      "type": "array",
                      "items": {}
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "name",
                    "position",
                    "external_ref",
                    "margin_percent",
                    "images",
                    "created_at",
                    "updated_at"
                  ]
                },
                "example": {
                  "object": "product_type",
                  "id": "91f99a6c-597e-4515-8175-0b8186598c30",
                  "name": "Category 331",
                  "position": 0,
                  "external_ref": null,
                  "margin_percent": null,
                  "images": [],
                  "created_at": "2026-11-16T22:40:00.140Z",
                  "updated_at": "2026-11-16T22:40:00.140Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One product type, with the taxes its products are charged."
      }
    },
    "/api/v1/m/locations": {
      "get": {
        "summary": "List locations",
        "tags": [
          "Locations"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `name`, `city`, `state`, `postal_code`, `is_main`, `archived_at`, `created_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "name_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "address_line_1": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "address_line_2": {
                            "type": "null"
                          },
                          "city": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "type": "string"
                          },
                          "postal_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "country": {
                            "type": "string",
                            "description": "The ISO code of the country asked for or read from the request; null for none."
                          },
                          "latitude": {
                            "type": "null"
                          },
                          "longitude": {
                            "type": "null"
                          },
                          "is_main": {
                            "type": "boolean"
                          },
                          "archived_at": {
                            "type": "null"
                          },
                          "images": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "position": {
                                  "type": "integer"
                                },
                                "alt_text": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "url": {
                                  "type": "string"
                                },
                                "medium_url": {
                                  "type": "string"
                                },
                                "thumb_url": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "position",
                                "alt_text",
                                "url",
                                "medium_url",
                                "thumb_url"
                              ]
                            }
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "object",
                          "id",
                          "name",
                          "address_line_1",
                          "address_line_2",
                          "city",
                          "state",
                          "postal_code",
                          "country",
                          "latitude",
                          "longitude",
                          "is_main",
                          "archived_at",
                          "images",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "location",
                      "id": "13058779-3d91-40b6-9d6b-d8bcebff79d8",
                      "name": "Merchant 17",
                      "address_line_1": null,
                      "address_line_2": null,
                      "city": null,
                      "state": "CA",
                      "postal_code": null,
                      "country": "AQ",
                      "latitude": null,
                      "longitude": null,
                      "is_main": true,
                      "archived_at": null,
                      "images": [],
                      "created_at": "2026-11-16T22:46:55.878Z",
                      "updated_at": "2026-11-16T22:46:55.878Z"
                    },
                    {
                      "object": "location",
                      "id": "d2d71a75-b3a9-4717-947d-84ad802ad367",
                      "name": "Branch",
                      "address_line_1": "12 Main St",
                      "address_line_2": null,
                      "city": "Bucaramanga",
                      "state": "Santander",
                      "postal_code": "680001",
                      "country": "AQ",
                      "latitude": null,
                      "longitude": null,
                      "is_main": false,
                      "archived_at": null,
                      "images": [],
                      "created_at": "2026-11-16T22:46:55.926Z",
                      "updated_at": "2026-11-16T22:46:55.926Z"
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 2,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read locations. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "locations",
                      "access": "read"
                    },
                    "request_id": "12228168-f5b2-4561-be88-01db1c493d89"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Where the merchant sells. Every merchant has a main location."
      }
    },
    "/api/v1/m/locations/{id}": {
      "get": {
        "summary": "Read a location",
        "tags": [
          "Locations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "f114c5a0-e724-4700-9c22-bdb85f628fce"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "address_line_1": {
                      "type": "null"
                    },
                    "address_line_2": {
                      "type": "null"
                    },
                    "city": {
                      "type": "null"
                    },
                    "state": {
                      "type": "string"
                    },
                    "postal_code": {
                      "type": "null"
                    },
                    "country": {
                      "type": "string",
                      "description": "The ISO code of the country asked for or read from the request; null for none."
                    },
                    "latitude": {
                      "type": "null"
                    },
                    "longitude": {
                      "type": "null"
                    },
                    "is_main": {
                      "type": "boolean"
                    },
                    "archived_at": {
                      "type": "null"
                    },
                    "images": {
                      "type": "array",
                      "items": {}
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "name",
                    "address_line_1",
                    "address_line_2",
                    "city",
                    "state",
                    "postal_code",
                    "country",
                    "latitude",
                    "longitude",
                    "is_main",
                    "archived_at",
                    "images",
                    "created_at",
                    "updated_at"
                  ]
                },
                "example": {
                  "object": "location",
                  "id": "f114c5a0-e724-4700-9c22-bdb85f628fce",
                  "name": "Merchant 901",
                  "address_line_1": null,
                  "address_line_2": null,
                  "city": null,
                  "state": "CA",
                  "postal_code": null,
                  "country": "OL",
                  "latitude": null,
                  "longitude": null,
                  "is_main": true,
                  "archived_at": null,
                  "images": [],
                  "created_at": "2026-11-16T22:36:20.372Z",
                  "updated_at": "2026-11-16T22:36:20.372Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One location, with its address."
      }
    },
    "/api/v1/m/orders": {
      "get": {
        "summary": "List orders",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `status`, `currency`, `order_number`, `total_amount_cents`, `location_id`, `created_at`, `updated_at`, `payments_payment_type`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "status_eq": "…"
            }
          },
          {
            "name": "expand",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Adds each record's related records, comma-separated: `invoice`, `payment`, `merchant`."
          },
          {
            "name": "metadata",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Finds by your own metadata, as `metadata[key]=value` (up to five keys, exact values): `metadata[pos_sale_id]=1042`.",
            "example": {
              "pos_sale_id": "1042"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string",
                            "description": "Always \"order\"."
                          },
                          "livemode": {
                            "type": "boolean",
                            "description": "false for a test order, made with a test key. A test order is paid by simulation and moves no money."
                          },
                          "id": {
                            "type": "string",
                            "description": "The order's id."
                          },
                          "order_number": {
                            "type": "string",
                            "description": "A number a person can read out, printed on the receipt."
                          },
                          "total_amount_cents": {
                            "type": "integer",
                            "description": "What the customer pays, tax included, in the currency's smallest unit."
                          },
                          "tax_amount_cents": {
                            "type": "integer",
                            "description": "The tax inside the total."
                          },
                          "discount_amount_cents": {
                            "type": "integer",
                            "description": "What discounts took off."
                          },
                          "total_amount_sats": {
                            "type": "integer",
                            "description": "The total in sats, at the bitcoin price when the order was priced. null until it is priced for bitcoin."
                          },
                          "status": {
                            "type": "string",
                            "description": "Where the order stands. pending: made, no invoice yet. invoice_generated: an invoice is out, waiting to be paid. paid: the money arrived. shipped: paid and handed over. cancelled, expired: closed unpaid. partially_refunded, refunded: paid, then refunded. draft: being built item by item."
                          },
                          "merchant_id": {
                            "type": "string",
                            "description": "The merchant."
                          },
                          "location_id": {
                            "type": "string",
                            "description": "Where it was sold."
                          },
                          "price_list_id": {
                            "description": "The price list it was priced from, if any."
                          },
                          "wallet_id": {
                            "type": "string",
                            "description": "The merchant's wallet the invoice pays to."
                          },
                          "discount_id": {
                            "description": "The merchant's discount on the whole order, if any."
                          },
                          "api_token_id": {
                            "type": "string",
                            "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                          },
                          "created_at": {
                            "type": "string",
                            "description": "When it was made."
                          },
                          "updated_at": {
                            "type": "string",
                            "description": "When it last changed."
                          },
                          "tender_type": {
                            "type": "string",
                            "description": "How it was paid or is to be: bitcoin, cash, card."
                          },
                          "cash_paid_at": {
                            "description": "When cash was recorded for it."
                          },
                          "cash_recorded_by": {
                            "description": "Who recorded the cash."
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "price_cents": {
                                  "type": "integer"
                                },
                                "qty": {
                                  "type": "integer"
                                },
                                "line_total_cents": {
                                  "type": "integer"
                                },
                                "product_id": {
                                  "type": "string",
                                  "description": "One of the merchant's products. Its name and price fill the item when not given."
                                },
                                "sku_id": {
                                  "type": "string",
                                  "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                                },
                                "tax_amount_cents": {
                                  "type": "integer",
                                  "description": "This line's tax."
                                },
                                "tax_details": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "rate": {
                                        "type": "string",
                                        "description": "A percentage, as a decimal string"
                                      },
                                      "amount_cents": {
                                        "type": "integer"
                                      },
                                      "tax_id": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                },
                                "total_amount_sats": {
                                  "type": "integer"
                                },
                                "margin_percent": {
                                  "type": "string",
                                  "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                                },
                                "margin_amount_sats": {
                                  "type": "integer",
                                  "description": "The sats `margin_percent` comes to."
                                },
                                "settlement_amount_sats": {
                                  "type": "integer",
                                  "description": "The sats left after `margin_amount_sats`."
                                },
                                "refund_status": {
                                  "type": "string",
                                  "description": "How far the item has been refunded, worked out from the sales ledger: not_refunded, partially_refunded (a unit, or its share of an amount refunded without naming items) or refunded (every unit, its line total and its taxes); present once the order is paid"
                                },
                                "refunded_qty": {
                                  "type": "integer",
                                  "description": "How many of its units were refunded"
                                },
                                "refunded_cents": {
                                  "type": "integer",
                                  "description": "How much of its line total and taxes was refunded, in the currency's smallest unit"
                                }
                              }
                            },
                            "description": "The lines."
                          },
                          "currency": {
                            "type": "string",
                            "description": "ISO 4217, lowercase. The merchant's."
                          },
                          "customer_email": {
                            "description": "The customer's email address, where the receipt goes"
                          },
                          "customer_name": {},
                          "customer_phone": {},
                          "shipping_address": {},
                          "notes": {},
                          "metadata": {
                            "type": "object",
                            "properties": {
                              "pos_sale_id": {
                                "type": "string"
                              }
                            },
                            "description": "What you sent with it, as you sent it."
                          },
                          "itemized": {
                            "type": "boolean",
                            "description": "true for an order built line by line over MCP and sent as a payment link. false for an order made in one call, items or not."
                          },
                          "subtotal_amount_cents": {
                            "type": "integer",
                            "description": "The lines before tax."
                          },
                          "tax_details": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "rate": {
                                  "type": "string",
                                  "description": "A percentage, as a decimal string"
                                },
                                "amount_cents": {
                                  "type": "integer"
                                }
                              }
                            },
                            "description": "Each tax charged, with its name, rate and amount."
                          },
                          "payment_link_url": {
                            "description": "The order's own payment page, when a link was made for it."
                          },
                          "payment_link_created_at": {},
                          "expires_at": {
                            "description": "When an order sent by payment link stops being payable. null for a counter sale."
                          },
                          "payment_email_sent_at": {
                            "description": "When the order's payment link was last emailed to the customer."
                          },
                          "last_reminder_sent_at": {
                            "description": "When the last payment reminder was emailed."
                          },
                          "reminders": {
                            "type": "object",
                            "properties": {
                              "planned": {
                                "type": "integer"
                              },
                              "sent": {
                                "type": "integer"
                              },
                              "next_at": {}
                            },
                            "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                          },
                          "delivery_status": {
                            "description": "undelivered, shipped or delivered, where the merchant tracks delivery. null otherwise."
                          },
                          "pay_at_pickup_at": {},
                          "pickup_location": {},
                          "shipped_at": {},
                          "delivered_at": {},
                          "delivery_note": {},
                          "receipt_url": {
                            "type": "string",
                            "description": "The customer's receipt, once the order is paid. null before."
                          },
                          "po_number": {
                            "type": "string",
                            "description": "The same as `order_number`, kept for older integrations."
                          },
                          "btc_fiat_price_at_creation": {
                            "type": "string",
                            "description": "A bitcoin's price in the order's currency when it was priced."
                          },
                          "btc_fiat_rate_source": {
                            "type": "string",
                            "description": "Where the bitcoin price the order was priced at came from."
                          },
                          "margin_percent": {
                            "type": "string",
                            "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                          },
                          "margin_amount_sats": {
                            "type": "integer",
                            "description": "The sats `margin_percent` comes to."
                          },
                          "settlement_amount_sats": {
                            "type": "integer",
                            "description": "The sats the merchant receives."
                          },
                          "invoice": {
                            "type": "object",
                            "properties": {
                              "object": {
                                "type": "string"
                              },
                              "livemode": {
                                "type": "boolean"
                              },
                              "id": {
                                "type": "string"
                              },
                              "payment_method": {
                                "type": "string"
                              },
                              "amount_sats": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "paid_at": {
                                "type": "string"
                              },
                              "order_id": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "updated_at": {
                                "type": "string"
                              },
                              "payment_request": {
                                "type": "string"
                              },
                              "payment_hash": {
                                "type": "string"
                              },
                              "expired": {
                                "type": "boolean"
                              },
                              "time_until_expiry": {
                                "type": "integer"
                              },
                              "metadata": {
                                "type": "object",
                                "properties": {
                                  "left_to_pay_cents": {
                                    "type": "integer"
                                  }
                                }
                              }
                            },
                            "description": "The order's latest invoice. Present on create with generate_invoice, and on a read unless expand leaves it out."
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {},
                        "prev_page": {}
                      }
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "order",
                      "livemode": false,
                      "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "order_number": "ORD-5C6E99CC3B503CED",
                      "total_amount_cents": 972,
                      "tax_amount_cents": 72,
                      "discount_amount_cents": 0,
                      "total_amount_sats": 9720,
                      "status": "paid",
                      "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                      "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                      "price_list_id": null,
                      "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                      "discount_id": null,
                      "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                      "created_at": "2026-11-25T03:24:37.603Z",
                      "updated_at": "2026-11-25T03:24:37.958Z",
                      "tender_type": "bitcoin",
                      "cash_paid_at": null,
                      "cash_recorded_by": null,
                      "items": [
                        {
                          "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                          "name": "Latte",
                          "price_cents": 450,
                          "qty": 2,
                          "line_total_cents": 900,
                          "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                          "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                          "tax_amount_cents": 72,
                          "tax_details": [
                            {
                              "name": "Sales tax",
                              "rate": "8.0",
                              "amount_cents": 72,
                              "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                            }
                          ],
                          "total_amount_sats": 9720,
                          "margin_percent": "0.0",
                          "margin_amount_sats": 0,
                          "settlement_amount_sats": 9720,
                          "refund_status": "not_refunded",
                          "refunded_qty": 0,
                          "refunded_cents": 0
                        }
                      ],
                      "currency": "usd",
                      "customer_email": null,
                      "customer_name": null,
                      "customer_phone": null,
                      "shipping_address": null,
                      "notes": null,
                      "metadata": {
                        "pos_sale_id": "1042"
                      },
                      "itemized": false,
                      "subtotal_amount_cents": 900,
                      "tax_details": [
                        {
                          "name": "Sales tax",
                          "rate": "8.0",
                          "amount_cents": 72
                        }
                      ],
                      "payment_link_url": null,
                      "payment_link_created_at": null,
                      "expires_at": null,
                      "payment_email_sent_at": null,
                      "last_reminder_sent_at": null,
                      "reminders": {
                        "planned": 0,
                        "sent": 0,
                        "next_at": null
                      },
                      "delivery_status": null,
                      "pay_at_pickup_at": null,
                      "pickup_location": null,
                      "shipped_at": null,
                      "delivered_at": null,
                      "delivery_note": null,
                      "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "po_number": "ORD-5C6E99CC3B503CED",
                      "btc_fiat_price_at_creation": "100000.0",
                      "btc_fiat_rate_source": "coinbase",
                      "margin_percent": "0.0",
                      "margin_amount_sats": 0,
                      "settlement_amount_sats": 9720,
                      "invoice": {
                        "object": "invoice",
                        "livemode": false,
                        "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                        "payment_method": "lightning",
                        "amount_sats": 9720,
                        "status": "paid",
                        "expires_at": "2026-11-25T04:24:37.889Z",
                        "paid_at": "2026-11-25T03:24:37.943Z",
                        "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                        "created_at": "2026-11-25T03:24:37.895Z",
                        "updated_at": "2026-11-25T03:24:37.944Z",
                        "payment_request": "lntb9720n1test_1599c8f8b540152b6e134CS3SD35GvzVqiWViRITvx0e6llZzW0hMNLKsmzBAjfAZskeSP0",
                        "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                        "expired": false,
                        "time_until_expiry": 3599,
                        "metadata": {
                          "left_to_pay_cents": 972
                        }
                      }
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 1,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            },
                            "feature": {
                              "type": "string"
                            },
                            "plan": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read orders. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "request_id": "6ea01c5c-0713-4bab-9f00-2251f42a0aba",
                    "details": {
                      "resource": "orders",
                      "access": "read",
                      "feature": "api",
                      "plan": "free"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `invalid_filter`, `invalid_argument`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_filter",
                    "message": "status isn't something this list takes. Filter with q[field_predicate]=value (q[status_eq]=paid); page with page and per_page; it also takes expand and metadata.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The key's orders, newest first, each with its invoice. Filter with `q[…]`, find by your own id with `metadata[key]=value`, and add `expand=payment,merchant`. A POS key lists its own location's orders. A parameter the list doesn't take answers 422 `invalid_filter`."
      },
      "post": {
        "summary": "Create an order",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "description": "Always \"order\"."
                    },
                    "livemode": {
                      "type": "boolean",
                      "description": "false for a test order, made with a test key. A test order is paid by simulation and moves no money."
                    },
                    "id": {
                      "type": "string",
                      "description": "The order's id."
                    },
                    "order_number": {
                      "type": "string",
                      "description": "A number a person can read out, printed on the receipt."
                    },
                    "total_amount_cents": {
                      "type": "integer",
                      "description": "What the customer pays, tax included, in the currency's smallest unit."
                    },
                    "tax_amount_cents": {
                      "type": "integer",
                      "description": "The tax inside the total."
                    },
                    "discount_amount_cents": {
                      "type": "integer",
                      "description": "What discounts took off."
                    },
                    "total_amount_sats": {
                      "type": "integer",
                      "description": "The total in sats, at the bitcoin price when the order was priced. null until it is priced for bitcoin."
                    },
                    "status": {
                      "type": "string",
                      "description": "Where the order stands. pending: made, no invoice yet. invoice_generated: an invoice is out, waiting to be paid. paid: the money arrived. shipped: paid and handed over. cancelled, expired: closed unpaid. partially_refunded, refunded: paid, then refunded. draft: being built item by item."
                    },
                    "merchant_id": {
                      "type": "string",
                      "description": "The merchant."
                    },
                    "location_id": {
                      "type": "string",
                      "description": "Where it was sold."
                    },
                    "price_list_id": {
                      "description": "The price list it was priced from, if any."
                    },
                    "wallet_id": {
                      "type": "string",
                      "description": "The merchant's wallet the invoice pays to."
                    },
                    "discount_id": {
                      "description": "The merchant's discount on the whole order, if any."
                    },
                    "api_token_id": {
                      "type": "string",
                      "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "When it was made."
                    },
                    "updated_at": {
                      "type": "string",
                      "description": "When it last changed."
                    },
                    "tender_type": {
                      "type": "string",
                      "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
                    },
                    "cash_paid_at": {
                      "description": "When cash was recorded for it."
                    },
                    "cash_recorded_by": {
                      "description": "Who recorded the cash."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "price_cents": {
                            "type": "integer"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "line_total_cents": {
                            "type": "integer"
                          },
                          "product_id": {
                            "type": "string",
                            "description": "One of the merchant's products. Its name and price fill the item when not given."
                          },
                          "sku_id": {
                            "type": "string",
                            "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                          },
                          "tax_amount_cents": {
                            "type": "integer",
                            "description": "This line's tax."
                          },
                          "tax_details": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "rate": {
                                  "type": "string",
                                  "description": "A percentage, as a decimal string"
                                },
                                "amount_cents": {
                                  "type": "integer"
                                },
                                "tax_id": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      },
                      "description": "The lines."
                    },
                    "currency": {
                      "type": "string",
                      "description": "ISO 4217, lowercase. The merchant's."
                    },
                    "customer_email": {
                      "description": "The customer's email address, where the receipt goes"
                    },
                    "customer_name": {},
                    "customer_phone": {},
                    "shipping_address": {},
                    "notes": {},
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "pos_sale_id": {
                          "type": "string"
                        }
                      },
                      "description": "What you sent with it, as you sent it."
                    },
                    "itemized": {
                      "type": "boolean",
                      "description": "true for an order built line by line over MCP and sent as a payment link. false for an order made in one call, items or not."
                    },
                    "subtotal_amount_cents": {
                      "type": "integer",
                      "description": "The lines before tax."
                    },
                    "tax_details": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "string",
                            "description": "A percentage, as a decimal string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          }
                        }
                      },
                      "description": "Each tax charged, with its name, rate and amount."
                    },
                    "payment_link_url": {
                      "description": "The order's own payment page, when a link was made for it."
                    },
                    "payment_link_created_at": {},
                    "expires_at": {
                      "description": "When an order sent by payment link stops being payable. null for a counter sale."
                    },
                    "payment_email_sent_at": {
                      "description": "When the order's payment link was last emailed to the customer."
                    },
                    "last_reminder_sent_at": {
                      "description": "When the last payment reminder was emailed."
                    },
                    "reminders": {
                      "type": "object",
                      "properties": {
                        "planned": {
                          "type": "integer"
                        },
                        "sent": {
                          "type": "integer"
                        },
                        "next_at": {}
                      },
                      "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                    },
                    "delivery_status": {
                      "description": "undelivered, shipped or delivered, where the merchant tracks delivery. null otherwise."
                    },
                    "pay_at_pickup_at": {},
                    "pickup_location": {},
                    "shipped_at": {},
                    "delivered_at": {},
                    "delivery_note": {},
                    "receipt_url": {
                      "description": "The customer's receipt, once the order is paid. null before."
                    },
                    "po_number": {
                      "type": "string",
                      "description": "The same as `order_number`, kept for older integrations."
                    },
                    "btc_fiat_price_at_creation": {
                      "type": "string",
                      "description": "A bitcoin's price in the order's currency when it was priced."
                    },
                    "btc_fiat_rate_source": {
                      "type": "string",
                      "description": "Where the bitcoin price the order was priced at came from."
                    },
                    "checkout_url": {
                      "description": "The hosted checkout where the customer can pay this order by bitcoin or card, when the merchant takes cards on its own payment gateway; null otherwise."
                    },
                    "invoice": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string"
                        },
                        "livemode": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "payment_method": {
                          "type": "string"
                        },
                        "amount_sats": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "paid_at": {},
                        "order_id": {
                          "type": "string"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        },
                        "payment_request": {
                          "type": "string"
                        },
                        "payment_hash": {
                          "type": "string"
                        },
                        "expired": {
                          "type": "boolean"
                        },
                        "time_until_expiry": {
                          "type": "integer"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "left_to_pay_cents": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "description": "The order's latest invoice. Present on create with generate_invoice, and on a read unless expand leaves it out."
                    }
                  }
                },
                "example": {
                  "object": "order",
                  "livemode": false,
                  "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "order_number": "ORD-5C6E99CC3B503CED",
                  "total_amount_cents": 972,
                  "tax_amount_cents": 72,
                  "discount_amount_cents": 0,
                  "total_amount_sats": 9720,
                  "status": "invoice_generated",
                  "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                  "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                  "price_list_id": null,
                  "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                  "discount_id": null,
                  "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                  "created_at": "2026-11-25T03:24:37.603Z",
                  "updated_at": "2026-11-25T03:24:37.678Z",
                  "tender_type": "bitcoin",
                  "cash_paid_at": null,
                  "cash_recorded_by": null,
                  "items": [
                    {
                      "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                      "name": "Latte",
                      "price_cents": 450,
                      "qty": 2,
                      "line_total_cents": 900,
                      "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                      "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                      "tax_amount_cents": 72,
                      "tax_details": [
                        {
                          "name": "Sales tax",
                          "rate": "8.0",
                          "amount_cents": 72,
                          "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                        }
                      ]
                    }
                  ],
                  "currency": "usd",
                  "customer_email": null,
                  "customer_name": null,
                  "customer_phone": null,
                  "shipping_address": null,
                  "notes": null,
                  "metadata": {
                    "pos_sale_id": "1042"
                  },
                  "itemized": false,
                  "subtotal_amount_cents": 900,
                  "tax_details": [
                    {
                      "name": "Sales tax",
                      "rate": "8.0",
                      "amount_cents": 72
                    }
                  ],
                  "payment_link_url": null,
                  "payment_link_created_at": null,
                  "expires_at": null,
                  "payment_email_sent_at": null,
                  "last_reminder_sent_at": null,
                  "reminders": {
                    "planned": 0,
                    "sent": 0,
                    "next_at": null
                  },
                  "delivery_status": null,
                  "pay_at_pickup_at": null,
                  "pickup_location": null,
                  "shipped_at": null,
                  "delivered_at": null,
                  "delivery_note": null,
                  "receipt_url": null,
                  "po_number": "ORD-5C6E99CC3B503CED",
                  "btc_fiat_price_at_creation": "100000.0",
                  "btc_fiat_rate_source": "coinbase",
                  "checkout_url": null,
                  "invoice": {
                    "object": "invoice",
                    "livemode": false,
                    "id": "3ae8afdb-00c6-48c4-8dcb-7d63f9f13fbb",
                    "payment_method": "lightning",
                    "amount_sats": 9720,
                    "status": "pending",
                    "expires_at": "2026-11-25T04:24:37.641Z",
                    "paid_at": null,
                    "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "created_at": "2026-11-25T03:24:37.655Z",
                    "updated_at": "2026-11-25T03:24:37.655Z",
                    "payment_request": "lntb9720n1test_de140fdd642fbeba395b9PDr1VSAoZWklKqcGBxKXnAtiBayHIeORTd9uCYvTz3CKPUD4fU",
                    "payment_hash": "test_de140fdd642fbeba395b9efdeff04050687499f2ab5c53cf92abb49588f7",
                    "expired": false,
                    "time_until_expiry": 3599,
                    "metadata": {
                      "left_to_pay_cents": 972
                    }
                  }
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_json",
                    "message": "The request body isn't valid JSON. Send a JSON object with Content-Type: application/json.",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The request couldn't be read. Codes: `invalid_json`, `bad_request`, `invalid_idempotency_key`."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "subscription_required",
                    "message": "An active subscription is required to perform this action",
                    "status": 402,
                    "details": {
                      "subscription_status": "canceled"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Payment is needed first. Codes: `subscription_required`."
          },
          "403": {
            "description": "The key may not do this. Codes: `forbidden`, `merchant_not_operational`, `location_archived`, `volume_limit_exceeded`, `aup_acceptance_required`, `verification_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage orders. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "orders",
                      "access": "manage"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "idempotency_in_progress",
                    "message": "A request with this Idempotency-Key is still being processed. Retry shortly: once it is done, its answer is given again.",
                    "status": 409,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "A conflict with what is there now. Codes: `idempotency_in_progress`."
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as application/x-www-form-urlencoded. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `unknown_parameter`, `invalid_argument`, `invalid_amount`, `item_unavailable`, `price_changed`, `invalid_payment_method`, `amount_exceeds_wallet_limits`, `location_mismatch`, `validation_error`, `tax_exempt_not_allowed`, `discount_over_limit`, `price_raise_over_limit`, `open_item_over_limit`, `open_items_off`, `open_item_not_allowed`, `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "item_unavailable",
                    "message": "Some items are not on sale: read the catalog again (GET /api/v1/m/catalog) and ring the sale up from it. error.details says which, by its place in items.",
                    "status": 422,
                    "details": [
                      {
                        "index": 1,
                        "sku_id": "d0542eb8-2fbc-4a28-b6a9-8921c1b88ab4",
                        "reason": "not_found"
                      }
                    ],
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limit_exceeded",
                    "message": "Rate limit exceeded. Please retry after 12 seconds.",
                    "status": 429,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Too many requests. Codes: `rate_limit_exceeded`, `daily_cap_exceeded`, `open_invoice_limit_reached`."
          },
          "502": {
            "description": "The wallet provider couldn't be reached. Codes: `provider_error`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "provider_error",
                    "message": "Payment provider is temporarily unavailable. Please try again.",
                    "status": 502,
                    "details": {
                      "order_id": "e8da24c6-dca4-4da7-8d29-aa6e1e174c05"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "503": {
            "description": "Not available right now. Codes: `service_unavailable`, `price_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "service_unavailable",
                    "message": "Service is temporarily unavailable. Please try again later.",
                    "status": 503,
                    "details": {
                      "order_id": "e8da24c6-dca4-4da7-8d29-aa6e1e174c05"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "The order under `order`, or its fields at the top of the body. `generate_invoice`, `mark_as_paid` and `payment_method` go beside `order` or inside it. A field that isn't listed here answers 422 `unknown_parameter`.",
                "properties": {
                  "order": {
                    "type": "object",
                    "description": "Send `items` and let the server price them, or your own `total_amount_cents`. One of the two is required.",
                    "properties": {
                      "items": {
                        "type": "array",
                        "description": "The lines. A line names a SKU (`sku_id`) or a product (`product_id`, sold as its default SKU) and is priced from the catalog; or it carries its own `name` and `price_cents`.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "sku_id": {
                              "type": "string",
                              "format": "uuid",
                              "description": "A SKU from the catalog. One that left it answers 422 `item_unavailable`."
                            },
                            "product_id": {
                              "type": "string",
                              "description": "A product (its UUID, or the catalog's prod_… id), sold as its default SKU, when no `sku_id` is sent."
                            },
                            "qty": {
                              "type": "integer",
                              "minimum": 1,
                              "default": 1,
                              "description": "How many. A whole number: 1.5 answers 422 `invalid_argument`."
                            },
                            "name": {
                              "type": "string",
                              "description": "The line's name. Taken from the SKU when left out; required for a line with no SKU or product."
                            },
                            "price_cents": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "The unit price, in the order's currency's smallest unit. Taken from the SKU when left out. A cashier's key is held to the merchant's limits on changing it."
                            },
                            "tax_ids": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "description": "The taxes on this line. Left out, the line takes its product type's taxes; `[]` for none."
                            },
                            "discount_ids": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "description": "The merchant's discounts on this line. Needs read access to discounts."
                            }
                          }
                        }
                      },
                      "total_amount_cents": {
                        "type": "integer",
                        "minimum": 1,
                        "description": "Your own total, tax included. Leave it out with items and the server prices them from the catalog; send it, with `tax_amount_cents` and no `tax_ids` or `discount_ids` on the items, and the order charges exactly it. Alone, with no items, it is one amount."
                      },
                      "tax_amount_cents": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "The tax inside your own total."
                      },
                      "discount_amount_cents": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "An amount off the whole order. Not for a cashier's key."
                      },
                      "discount_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "One of the merchant's discounts, on the whole order."
                      },
                      "currency": {
                        "type": "string",
                        "description": "ISO 4217, lowercase. The merchant's own when left out; another answers 422."
                      },
                      "tender_type": {
                        "type": "string",
                        "enum": [
                          "bitcoin",
                          "cash",
                          "card"
                        ],
                        "default": "bitcoin",
                        "description": "`cash` for an order paid in cash (`mark_as_paid`). `card` for one the customer pays by card on the hosted checkout, where the merchant takes cards: the answer's `checkout_url` is the page. Where it takes none, the order is a bitcoin one."
                      },
                      "customer_email": {
                        "type": "string",
                        "format": "email",
                        "description": "Where the receipt goes once paid. In test mode the receipt goes to the key's holder instead."
                      },
                      "location_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Where it is sold. A device's key sells at its own location, and another answers 422 `location_mismatch`."
                      },
                      "price_list_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "One of the merchant's price lists: its prices for the SKUs it names."
                      },
                      "wallet_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "The wallet to be paid to. Left out, the merchant's wallets are tried in their order."
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Your own keys and values (your sale's number, the table). Find the order again with `GET /api/v1/m/orders?metadata[key]=value`."
                      }
                    }
                  },
                  "generate_invoice": {
                    "type": "boolean",
                    "default": false,
                    "description": "Make the invoice in the same call. The answer carries it as `invoice`."
                  },
                  "mark_as_paid": {
                    "type": "boolean",
                    "default": false,
                    "description": "Leaving the API: cash is recorded at the SatsRail POS, into a till. Until then it records a cash order as paid now, answered with a `Deprecation` header; it needs `tender_type: cash` and a key that manages payments."
                  },
                  "expected_total_amount_cents": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The total your screen showed the customer: the price (`total_amount_cents`), or the price with the merchant's bitcoin conversion fee (`amount_due_cents`). The order is made only if it comes to exactly one of them; otherwise 422 `price_changed`, with the figures in `error.details`, and nothing is made. Send it whenever the server prices the items: a price, a discount or a tax can change after you read the catalog."
                  },
                  "payment_method": {
                    "type": "string",
                    "enum": [
                      "lightning",
                      "onchain",
                      "nequi"
                    ],
                    "description": "What the invoice is: `lightning` (the default), `onchain` (live mode), or `nequi` where the merchant takes it. One the merchant can't take answers 422 `invalid_payment_method` and no order is made."
                  }
                }
              },
              "example": {
                "order": {
                  "items": [
                    {
                      "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                      "qty": 2
                    }
                  ],
                  "metadata": {
                    "pos_sale_id": "1042"
                  }
                },
                "expected_total_amount_cents": 972,
                "generate_invoice": true
              }
            }
          }
        },
        "description": "Makes a sale: its items, its total and, with `generate_invoice: true`, the Lightning invoice that pays it. `invoice.payment_request` is the string to show as a QR code.\n\nSend `items` with `sku_id` and `qty` from the catalog, and SatsRail prices them with the catalog's taxes and discounts. Or send your own `total_amount_cents` and `tax_amount_cents`. Send `expected_total_amount_cents`, the total your screen showed, and the order is made only if it comes to that (otherwise 422 `price_changed`).\n\nSend an `Idempotency-Key`. If the invoice can't be made after the order was, the error names the order in `error.details.order_id`, and the same request with the same key invoices it rather than making another.\n\nA field the call doesn't take is refused by name. See the POS guide, *Ring up a sale*."
      }
    },
    "/api/v1/m/orders/{id}": {
      "delete": {
        "summary": "Cancel an order",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "26a5cd25-2063-4768-bace-9f7d92b230ba"
          }
        ],
        "responses": {
          "204": {
            "description": "Done. No body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this. Codes: `forbidden`, `not_a_counter_order`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage orders. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "orders",
                      "access": "manage"
                    },
                    "request_id": "e2caa3f8-a404-4fc4-9eb7-ed00cf14487a"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `payment_in_progress`, `cannot_cancel`, `counter_sale`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payment_in_progress",
                    "message": "Order ORD-C815383054A988AA's bitcoin invoice can still be paid until 2026-11-16 20:11 UTC: wait for it to run out, or for its payment, then cancel",
                    "status": 422,
                    "details": {
                      "expires_at": "2026-11-16T20:11:18.683Z"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Cancels an unpaid order: 204. An open Lightning invoice is cancelled with it and stops counting toward your plan's open invoices at once. A Lightning invoice can't be taken back from the customer's wallet: a payment still made to it is recorded on the cancelled order and flagged for refund (`payment.flagged`). While an on-chain invoice can still be paid, or a payment to it is confirming, the answer is 422 `payment_in_progress`, with `error.details.expires_at`: after that time the invoice can't be paid, and the order can be cancelled or left as it is. A paid order answers 422 `cannot_cancel`. A POS key cancels only orders a POS rang up (403 `not_a_counter_order`)."
      },
      "get": {
        "summary": "Read an order",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "a3c7418e-2611-4669-9236-35a3e9c65a09"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "example": {
                  "object": "order",
                  "livemode": false,
                  "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "order_number": "ORD-5C6E99CC3B503CED",
                  "total_amount_cents": 972,
                  "tax_amount_cents": 72,
                  "discount_amount_cents": 0,
                  "total_amount_sats": 9720,
                  "status": "paid",
                  "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                  "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                  "price_list_id": null,
                  "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                  "discount_id": null,
                  "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                  "created_at": "2026-11-25T03:24:37.603Z",
                  "updated_at": "2026-11-25T03:24:37.958Z",
                  "tender_type": "bitcoin",
                  "cash_paid_at": null,
                  "cash_recorded_by": null,
                  "items": [
                    {
                      "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                      "name": "Latte",
                      "price_cents": 450,
                      "qty": 2,
                      "line_total_cents": 900,
                      "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                      "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                      "tax_amount_cents": 72,
                      "tax_details": [
                        {
                          "name": "Sales tax",
                          "rate": "8.0",
                          "amount_cents": 72,
                          "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                        }
                      ],
                      "total_amount_sats": 9720,
                      "margin_percent": "0.0",
                      "margin_amount_sats": 0,
                      "settlement_amount_sats": 9720,
                      "refund_status": "not_refunded",
                      "refunded_qty": 0,
                      "refunded_cents": 0
                    }
                  ],
                  "currency": "usd",
                  "customer_email": null,
                  "customer_name": null,
                  "customer_phone": null,
                  "shipping_address": null,
                  "notes": null,
                  "metadata": {
                    "pos_sale_id": "1042"
                  },
                  "itemized": false,
                  "subtotal_amount_cents": 900,
                  "tax_details": [
                    {
                      "name": "Sales tax",
                      "rate": "8.0",
                      "amount_cents": 72
                    }
                  ],
                  "payment_link_url": null,
                  "payment_link_created_at": null,
                  "expires_at": null,
                  "payment_email_sent_at": null,
                  "last_reminder_sent_at": null,
                  "reminders": {
                    "planned": 0,
                    "sent": 0,
                    "next_at": null
                  },
                  "delivery_status": null,
                  "pay_at_pickup_at": null,
                  "pickup_location": null,
                  "shipped_at": null,
                  "delivered_at": null,
                  "delivery_note": null,
                  "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "po_number": "ORD-5C6E99CC3B503CED",
                  "btc_fiat_price_at_creation": "100000.0",
                  "btc_fiat_rate_source": "coinbase",
                  "margin_percent": "0.0",
                  "margin_amount_sats": 0,
                  "settlement_amount_sats": 9720,
                  "merchant": {
                    "object": "merchant",
                    "id": "46525025-e63a-47d3-bc3b-1579896dd502",
                    "name": "Corner Coffee",
                    "client_type": "erp",
                    "email": "merchant1@example.com",
                    "phone": "(555) 555-0100",
                    "address": null,
                    "city": null,
                    "state": "CA",
                    "postal_code": null,
                    "status": "active",
                    "time_zone": "UTC",
                    "currency": "usd",
                    "conversion_fee_percent": 0.0,
                    "locale": "en",
                    "created_at": "2026-11-25T03:24:36.294Z",
                    "updated_at": "2026-11-25T03:24:36.936Z",
                    "tip_options": [],
                    "logo_url": null,
                    "images": [],
                    "taxes": [
                      {
                        "id": "48d12b21-375f-4654-b0d3-fe213c974dcf",
                        "name": "Sales tax",
                        "rate": "8.0",
                        "enabled": true
                      }
                    ]
                  },
                  "invoice": {
                    "object": "invoice",
                    "livemode": false,
                    "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                    "payment_method": "lightning",
                    "amount_sats": 9720,
                    "status": "paid",
                    "expires_at": "2026-11-25T04:24:37.889Z",
                    "paid_at": "2026-11-25T03:24:37.943Z",
                    "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "created_at": "2026-11-25T03:24:37.895Z",
                    "updated_at": "2026-11-25T03:24:37.944Z",
                    "payment_request": "lntb9720n1test_1599c8f8b540152b6e134CS3SD35GvzVqiWViRITvx0e6llZzW0hMNLKsmzBAjfAZskeSP0",
                    "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                    "expired": false,
                    "time_until_expiry": 3599,
                    "metadata": {
                      "left_to_pay_cents": 972
                    }
                  },
                  "payment": {
                    "object": "payment",
                    "livemode": false,
                    "id": "87077927-973e-4ace-8d48-4af38e777043",
                    "amount_sats": 9720,
                    "preimage": "3c84016bfd787a4017128f4fc548fbb8c5ca768bac91d31dd479276c6a44eac8",
                    "confirmed_at": "2026-11-25T03:24:37.943Z",
                    "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "invoice_id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                    "created_at": "2026-11-25T03:24:38.007Z",
                    "updated_at": "2026-11-25T03:24:38.007Z",
                    "currency": "usd",
                    "metadata": {},
                    "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                    "settled_at": "2026-11-25T03:24:37.943Z",
                    "usd_value_at_payment": "9.72",
                    "usd_variance_cents": 0,
                    "variance_percentage": "0.0",
                    "btc_fiat_price_at_payment": "100000.0",
                    "fiat_value_at_payment": "9.72",
                    "fiat_variance_cents": 0,
                    "confirmations": 0,
                    "required_confirmations": 1,
                    "flagged_for_review": false,
                    "flag": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One order, with its items, its status, and its merchant, invoice and payment. A paid order carries `receipt_url`, the customer's receipt. `expand=invoice` narrows the answer to the related records you name."
      },
      "patch": {
        "summary": "Change an order",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "ac72cead-6ba1-4e10-926e-6853c906e6f9"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order"
                ],
                "properties": {
                  "order": {
                    "type": "object",
                    "description": "What changes. A pending order with no invoice takes every field below; once invoiced, only `metadata`, and `status` (`paid` in cash, `shipped`). `metadata` replaces what was there: send every key you keep.",
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid",
                          "shipped"
                        ],
                        "description": "`shipped` marks a paid order handed over. `paid` with `tender_type: cash` is leaving the API, as `mark_as_paid` is: cash is recorded at the SatsRail POS. To cancel, `DELETE /api/v1/m/orders/{id}`."
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "The lines, as on `POST /api/v1/m/orders`. They replace the order's lines."
                      },
                      "total_amount_cents": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "tax_amount_cents": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "discount_amount_cents": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "discount_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "tender_type": {
                        "type": "string",
                        "enum": [
                          "bitcoin",
                          "cash",
                          "card"
                        ]
                      },
                      "customer_email": {
                        "type": "string",
                        "format": "email"
                      },
                      "location_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "price_list_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "wallet_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Replaces the order's metadata whole."
                      }
                    }
                  }
                }
              },
              "example": {
                "order": {
                  "items": [
                    {
                      "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                      "qty": 3
                    }
                  ],
                  "metadata": {
                    "pos_sale_id": "1044",
                    "table": "7"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "example": {
                  "object": "order",
                  "livemode": false,
                  "id": "04ddb01d-838e-412b-9291-8a86eab923ee",
                  "order_number": "ORD-5F352EF5499871F0",
                  "total_amount_cents": 1458,
                  "tax_amount_cents": 108,
                  "discount_amount_cents": 0,
                  "total_amount_sats": 14580,
                  "status": "pending",
                  "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                  "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                  "price_list_id": null,
                  "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                  "discount_id": null,
                  "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                  "created_at": "2026-11-25T03:24:38.489Z",
                  "updated_at": "2026-11-25T03:24:38.570Z",
                  "tender_type": "bitcoin",
                  "cash_paid_at": null,
                  "cash_recorded_by": null,
                  "items": [
                    {
                      "id": "ecfe98c6-9a8f-4e91-856d-33013742ecfa",
                      "name": "Latte",
                      "price_cents": 450,
                      "qty": 3,
                      "line_total_cents": 1350,
                      "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                      "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                      "tax_amount_cents": 108,
                      "tax_details": [
                        {
                          "name": "Sales tax",
                          "rate": "8.0",
                          "amount_cents": 108,
                          "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                        }
                      ]
                    }
                  ],
                  "currency": "usd",
                  "customer_email": null,
                  "customer_name": null,
                  "customer_phone": null,
                  "shipping_address": null,
                  "notes": null,
                  "metadata": {
                    "pos_sale_id": "1044",
                    "table": "7"
                  },
                  "itemized": false,
                  "subtotal_amount_cents": 1350,
                  "tax_details": [
                    {
                      "name": "Sales tax",
                      "rate": "8.0",
                      "amount_cents": 108
                    }
                  ],
                  "payment_link_url": null,
                  "payment_link_created_at": null,
                  "expires_at": null,
                  "payment_email_sent_at": null,
                  "last_reminder_sent_at": null,
                  "reminders": {
                    "planned": 0,
                    "sent": 0,
                    "next_at": null
                  },
                  "delivery_status": null,
                  "pay_at_pickup_at": null,
                  "pickup_location": null,
                  "shipped_at": null,
                  "delivered_at": null,
                  "delivery_note": null,
                  "receipt_url": null,
                  "po_number": "ORD-5F352EF5499871F0",
                  "btc_fiat_price_at_creation": "100000.0",
                  "btc_fiat_rate_source": "coinbase"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_json",
                    "message": "The request body isn't valid JSON. Send a JSON object with Content-Type: application/json.",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The request couldn't be read. Codes: `invalid_json`, `bad_request`."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "subscription_required",
                    "message": "An active subscription is required to perform this action",
                    "status": 402,
                    "details": {
                      "subscription_status": "canceled"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Payment is needed first. Codes: `subscription_required`."
          },
          "403": {
            "description": "The key may not do this. Codes: `forbidden`, `not_a_counter_order`, `merchant_not_operational`, `location_archived`, `volume_limit_exceeded`, `aup_acceptance_required`, `verification_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_a_counter_order",
                    "message": "Order ORD-C815383054A988AA wasn't rung up at a POS (it came from a backend, an assistant or a website): a POS key reads it but doesn't change or cancel it. Change it from the dashboard.",
                    "status": 403,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as application/x-www-form-urlencoded. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `unknown_parameter`, `invalid_argument`, `invalid_amount`, `not_editable`, `item_unavailable`, `location_mismatch`, `validation_error`, `tax_exempt_not_allowed`, `invalid_status_transition`, `already_paid`, `payment_in_progress`, `counter_sale`, `customer_order`, `discount_over_limit`, `price_raise_over_limit`, `open_item_over_limit`, `open_items_off`, `open_item_not_allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_editable",
                    "message": "Order ORD-C815383054A988AA is paid: only its metadata can change now, not items",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "price_unavailable",
                    "message": "The bitcoin price can't be read right now, so this can't be priced. Try again in a minute.",
                    "status": 503,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Not available right now. Codes: `price_unavailable`."
          }
        },
        "description": "Changes an order that has no invoice yet, such as an open ticket. New `items` replace the old ones and are priced from the catalog again; read the new total from the answer. `metadata` replaces the old whole. Once invoiced, only `metadata` can change (422 `not_editable`). `status` takes `shipped`; `paid` with `tender_type` `cash` is leaving the API (cash is recorded at the SatsRail POS). To cancel, use DELETE. A POS key changes only orders a POS rang up (403 `not_a_counter_order`)."
      }
    },
    "/api/v1/m/invoices/generate": {
      "post": {
        "summary": "Generate an invoice for an order",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "description": "Always \"invoice\"."
                    },
                    "livemode": {
                      "type": "boolean",
                      "description": "false for a test invoice."
                    },
                    "id": {
                      "type": "string",
                      "description": "The invoice's id: what GET /api/v1/m/invoices/{id}/status asks about."
                    },
                    "payment_method": {
                      "type": "string",
                      "description": "lightning or onchain."
                    },
                    "amount_sats": {
                      "type": "integer",
                      "description": "What the customer pays, in sats."
                    },
                    "status": {
                      "type": "string",
                      "description": "pending: waiting to be paid. paid: the money arrived. expired: it ran out unpaid; make the next one with POST /api/v1/m/invoices/generate. cancelled: its order was cancelled."
                    },
                    "expires_at": {
                      "type": "string",
                      "description": "When it runs out. A Lightning invoice lasts minutes."
                    },
                    "paid_at": {
                      "type": "null",
                      "description": "When it was paid. null until then."
                    },
                    "order_id": {
                      "type": "string",
                      "description": "The order it is for."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "When it was made."
                    },
                    "updated_at": {
                      "type": "string",
                      "description": "When it last changed."
                    },
                    "payment_request": {
                      "type": "string",
                      "description": "What the customer pays: a BOLT11 string for Lightning, a bitcoin: URI for on-chain. Show it as a QR code."
                    },
                    "payment_hash": {
                      "type": "string",
                      "description": "The Lightning invoice's payment hash."
                    },
                    "expired": {
                      "type": "boolean",
                      "description": "true once it ran out."
                    },
                    "time_until_expiry": {
                      "type": "integer",
                      "description": "Seconds left before it runs out."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "left_to_pay_cents": {
                          "type": "integer"
                        }
                      },
                      "description": "The order's metadata."
                    },
                    "order": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string"
                        },
                        "livemode": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "order_number": {
                          "type": "string"
                        },
                        "total_amount_cents": {
                          "type": "integer",
                          "description": "What the customer pays, tax included."
                        },
                        "tax_amount_cents": {
                          "type": "integer",
                          "description": "The tax inside the total."
                        },
                        "discount_amount_cents": {
                          "type": "integer",
                          "description": "What discounts took off."
                        },
                        "total_amount_sats": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "merchant_id": {
                          "type": "string"
                        },
                        "location_id": {
                          "type": "string"
                        },
                        "price_list_id": {
                          "type": "null"
                        },
                        "wallet_id": {
                          "type": "string"
                        },
                        "discount_id": {
                          "type": "null"
                        },
                        "api_token_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        },
                        "tender_type": {
                          "type": "string",
                          "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
                        },
                        "cash_paid_at": {
                          "type": "null"
                        },
                        "cash_recorded_by": {
                          "type": "null"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "price_cents": {
                                "type": "integer"
                              },
                              "qty": {
                                "type": "integer"
                              },
                              "line_total_cents": {
                                "type": "integer"
                              },
                              "product_id": {
                                "type": "string",
                                "description": "One of the merchant's products. Its name and price fill the item when not given."
                              },
                              "sku_id": {
                                "type": "string",
                                "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "price_cents",
                              "qty",
                              "line_total_cents"
                            ]
                          }
                        },
                        "currency": {
                          "type": "string"
                        },
                        "customer_email": {
                          "type": "null"
                        },
                        "customer_name": {
                          "type": "null"
                        },
                        "customer_phone": {
                          "type": "null"
                        },
                        "shipping_address": {
                          "type": "null"
                        },
                        "notes": {
                          "type": "null"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {}
                        },
                        "itemized": {
                          "type": "boolean"
                        },
                        "subtotal_amount_cents": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "tax_details": {
                          "type": "array",
                          "items": {}
                        },
                        "payment_link_url": {
                          "type": "null",
                          "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                        },
                        "payment_link_created_at": {
                          "type": "null"
                        },
                        "expires_at": {
                          "type": "null"
                        },
                        "payment_email_sent_at": {
                          "type": "null",
                          "description": "When the order's payment link was last emailed to the customer."
                        },
                        "last_reminder_sent_at": {
                          "type": "null",
                          "description": "When the last payment reminder was emailed."
                        },
                        "reminders": {
                          "type": "object",
                          "properties": {
                            "planned": {
                              "type": "integer"
                            },
                            "sent": {
                              "type": "integer"
                            },
                            "next_at": {
                              "type": "null"
                            }
                          },
                          "required": [
                            "planned",
                            "sent",
                            "next_at"
                          ],
                          "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                        },
                        "delivery_status": {
                          "type": "null"
                        },
                        "pay_at_pickup_at": {
                          "type": "null"
                        },
                        "pickup_location": {
                          "type": "null"
                        },
                        "shipped_at": {
                          "type": "null"
                        },
                        "delivered_at": {
                          "type": "null"
                        },
                        "delivery_note": {
                          "type": "null"
                        },
                        "receipt_url": {
                          "type": "null",
                          "description": "The customer's receipt page, once paid; null before."
                        },
                        "po_number": {
                          "type": "string",
                          "description": "The same as `order_number`, kept for older integrations."
                        },
                        "btc_fiat_price_at_creation": {
                          "type": "string"
                        },
                        "btc_fiat_rate_source": {
                          "type": "string",
                          "description": "Where the bitcoin price the order was priced at came from."
                        }
                      },
                      "required": [
                        "object",
                        "livemode",
                        "id",
                        "order_number",
                        "total_amount_cents",
                        "tax_amount_cents",
                        "discount_amount_cents",
                        "total_amount_sats",
                        "status",
                        "merchant_id",
                        "location_id",
                        "price_list_id",
                        "wallet_id",
                        "discount_id",
                        "api_token_id",
                        "created_at",
                        "updated_at",
                        "tender_type",
                        "cash_paid_at",
                        "cash_recorded_by",
                        "items",
                        "currency",
                        "customer_email",
                        "customer_name",
                        "customer_phone",
                        "shipping_address",
                        "notes",
                        "metadata",
                        "itemized",
                        "subtotal_amount_cents",
                        "tax_details",
                        "payment_link_url",
                        "payment_link_created_at",
                        "expires_at",
                        "payment_email_sent_at",
                        "last_reminder_sent_at",
                        "reminders",
                        "delivery_status",
                        "pay_at_pickup_at",
                        "pickup_location",
                        "shipped_at",
                        "delivered_at",
                        "delivery_note",
                        "receipt_url",
                        "po_number",
                        "btc_fiat_price_at_creation",
                        "btc_fiat_rate_source"
                      ],
                      "description": "Its order, in short."
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "payment_method",
                    "amount_sats",
                    "status",
                    "expires_at",
                    "paid_at",
                    "order_id",
                    "created_at",
                    "updated_at",
                    "payment_request",
                    "payment_hash",
                    "expired",
                    "time_until_expiry",
                    "metadata",
                    "order"
                  ]
                },
                "example": {
                  "object": "invoice",
                  "livemode": false,
                  "id": "0eb8ab4a-9d5a-47ca-b6d7-33142ebc9d71",
                  "payment_method": "lightning",
                  "amount_sats": 4500,
                  "status": "pending",
                  "expires_at": "2026-11-16T23:39:55.821Z",
                  "paid_at": null,
                  "order_id": "3a8aa82b-7e44-47ac-aacc-44388b4d420a",
                  "created_at": "2026-11-16T22:39:55.828Z",
                  "updated_at": "2026-11-16T22:39:55.828Z",
                  "payment_request": "lntb4500n1test_01d969c5916e0f7cba6ffabQCO7Jj39JZF2pfEJKSoAUhv4xLYZpsdNrUOVOf5a7QLBlHA9",
                  "payment_hash": "test_01d969c5916e0f7cba6ff3a8fadb974f29fb82f318a8afdab272aec0fe47",
                  "expired": false,
                  "time_until_expiry": 3599,
                  "metadata": {
                    "left_to_pay_cents": 450
                  },
                  "order": {
                    "object": "order",
                    "livemode": false,
                    "id": "3a8aa82b-7e44-47ac-aacc-44388b4d420a",
                    "order_number": "ORD-19A5302DA38EF31E",
                    "total_amount_cents": 450,
                    "tax_amount_cents": 0,
                    "discount_amount_cents": 0,
                    "total_amount_sats": 4500,
                    "status": "invoice_generated",
                    "merchant_id": "16f39518-9906-4caa-a33c-27f190c6f6b1",
                    "location_id": "a417ab8d-cb68-4c41-9306-7d69ec8cf27a",
                    "price_list_id": null,
                    "wallet_id": "48349877-bf7e-4efa-817e-a9cb454e75fb",
                    "discount_id": null,
                    "api_token_id": "ac47c39e-2638-44ce-9fde-cb773bb8f5a5",
                    "created_at": "2026-11-16T22:39:55.749Z",
                    "updated_at": "2026-11-16T22:39:55.839Z",
                    "tender_type": "bitcoin",
                    "cash_paid_at": null,
                    "cash_recorded_by": null,
                    "items": [
                      {
                        "id": "082c2740-de41-4bff-a213-dc80452bebc5",
                        "name": "Latte",
                        "price_cents": 450,
                        "qty": 1,
                        "line_total_cents": 450,
                        "product_id": "68094367-7a89-4550-86d1-4bb6d2d615fe",
                        "sku_id": "92ed366a-6251-4782-90ca-09b19d1a7cbf"
                      }
                    ],
                    "currency": "usd",
                    "customer_email": null,
                    "customer_name": null,
                    "customer_phone": null,
                    "shipping_address": null,
                    "notes": null,
                    "metadata": {},
                    "itemized": false,
                    "subtotal_amount_cents": 450,
                    "tax_details": [],
                    "payment_link_url": null,
                    "payment_link_created_at": null,
                    "expires_at": null,
                    "payment_email_sent_at": null,
                    "last_reminder_sent_at": null,
                    "reminders": {
                      "planned": 0,
                      "sent": 0,
                      "next_at": null
                    },
                    "delivery_status": null,
                    "pay_at_pickup_at": null,
                    "pickup_location": null,
                    "shipped_at": null,
                    "delivered_at": null,
                    "delivery_note": null,
                    "receipt_url": null,
                    "po_number": "ORD-19A5302DA38EF31E",
                    "btc_fiat_price_at_creation": "100000.0",
                    "btc_fiat_rate_source": "coinbase"
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                },
                "example": {
                  "object": "invoice",
                  "livemode": false,
                  "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                  "payment_method": "lightning",
                  "amount_sats": 9720,
                  "status": "pending",
                  "expires_at": "2026-11-25T04:24:37.889Z",
                  "paid_at": null,
                  "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "created_at": "2026-11-25T03:24:37.895Z",
                  "updated_at": "2026-11-25T03:24:37.895Z",
                  "payment_request": "lntb9720n1test_1599c8f8b540152b6e134CS3SD35GvzVqiWViRITvx0e6llZzW0hMNLKsmzBAjfAZskeSP0",
                  "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                  "expired": false,
                  "time_until_expiry": 3599,
                  "metadata": {
                    "left_to_pay_cents": 972
                  },
                  "order": {
                    "object": "order",
                    "livemode": false,
                    "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "order_number": "ORD-5C6E99CC3B503CED",
                    "total_amount_cents": 972,
                    "tax_amount_cents": 72,
                    "discount_amount_cents": 0,
                    "total_amount_sats": 9720,
                    "status": "invoice_generated",
                    "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                    "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "price_list_id": null,
                    "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                    "discount_id": null,
                    "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                    "created_at": "2026-11-25T03:24:37.603Z",
                    "updated_at": "2026-11-25T03:24:37.678Z",
                    "tender_type": "bitcoin",
                    "cash_paid_at": null,
                    "cash_recorded_by": null,
                    "items": [
                      {
                        "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                        "name": "Latte",
                        "price_cents": 450,
                        "qty": 2,
                        "line_total_cents": 900,
                        "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                        "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                        "tax_amount_cents": 72,
                        "tax_details": [
                          {
                            "name": "Sales tax",
                            "rate": "8.0",
                            "amount_cents": 72,
                            "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                          }
                        ]
                      }
                    ],
                    "currency": "usd",
                    "customer_email": null,
                    "customer_name": null,
                    "customer_phone": null,
                    "shipping_address": null,
                    "notes": null,
                    "metadata": {
                      "pos_sale_id": "1042"
                    },
                    "itemized": false,
                    "subtotal_amount_cents": 900,
                    "tax_details": [
                      {
                        "name": "Sales tax",
                        "rate": "8.0",
                        "amount_cents": 72
                      }
                    ],
                    "payment_link_url": null,
                    "payment_link_created_at": null,
                    "expires_at": null,
                    "payment_email_sent_at": null,
                    "last_reminder_sent_at": null,
                    "reminders": {
                      "planned": 0,
                      "sent": 0,
                      "next_at": null
                    },
                    "delivery_status": null,
                    "pay_at_pickup_at": null,
                    "pickup_location": null,
                    "shipped_at": null,
                    "delivered_at": null,
                    "delivery_note": null,
                    "receipt_url": null,
                    "po_number": "ORD-5C6E99CC3B503CED",
                    "btc_fiat_price_at_creation": "100000.0",
                    "btc_fiat_rate_source": "coinbase"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request couldn't be read. Codes: `missing_params`, `invalid_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "missing_params",
                    "message": "order_id is required: the order to invoice (POST /api/v1/m/orders answers its id)",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage invoices. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "invoices",
                      "access": "manage"
                    },
                    "request_id": "0d75b855-f779-4f58-9f04-f2b0a306cd1c"
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Order not found",
                    "status": 404,
                    "request_id": "c2aca4e3-931d-4049-91cf-14cfb6a48fee"
                  }
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as text/plain. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `not_invoiceable`, `price_changed`, `invalid_payment_method`, `amount_exceeds_wallet_limits`, `invalid_argument`, `counter_sale`, `customer_order`, `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_invoiceable",
                    "message": "Order ORD-C815383054A988AA is cancelled: it takes no new invoice. Make a new order.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "open_invoice_limit_reached",
                    "message": "The merchant has 5 invoices waiting to be paid, the most its Free plan allows open at once. A new one can be made once one of them is paid, expires (a Lightning invoice within 15 minutes) or is cancelled. A higher plan allows more.",
                    "status": 429,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Too many requests. Codes: `open_invoice_limit_reached`, `rate_limit_exceeded`."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "provider_error",
                    "message": "Payment provider is temporarily unavailable. Please try again.",
                    "status": 502,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The wallet provider couldn't be reached. Codes: `provider_error`."
          },
          "503": {
            "description": "Not available right now. Codes: `service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "service_unavailable",
                    "message": "The wallet couldn't say whether the last invoice was paid, so no new one was made. Try again in a few seconds.",
                    "status": 503,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id"
                ],
                "description": "At the top of the body, or under `invoice`.",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The order to invoice."
                  },
                  "expected_total_amount_cents": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The total your screen shows for the order. The invoice is made only if the order comes to exactly that; otherwise 422 `price_changed` with both figures, and no invoice. For an order changed since you last read it (an open ticket)."
                  },
                  "payment_method": {
                    "type": "string",
                    "enum": [
                      "lightning",
                      "onchain"
                    ],
                    "description": "`lightning` when left out, or the merchant's default."
                  }
                }
              },
              "example": {
                "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518"
              }
            }
          }
        },
        "description": "Invoices `order_id`: an order made without an invoice, or one whose invoice ran out. `201` is a new invoice, at the current rate; `200` is the one the order already has, still payable or paid as it ran out, so nothing is quoted twice.\n\nSend `expected_total_amount_cents` to invoice only if the order still comes to that. If the wallet can't say whether the old invoice was paid, 503 `service_unavailable` with `Retry-After`, and nothing is made. A cancelled or expired order answers 422 `not_invoiceable`."
      }
    },
    "/api/v1/m/invoices/{id}": {
      "get": {
        "summary": "Read an invoice",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "0e6c9922-eee1-49a4-9333-81122ccdb7f9"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                },
                "example": {
                  "object": "invoice",
                  "livemode": false,
                  "id": "3ae8afdb-00c6-48c4-8dcb-7d63f9f13fbb",
                  "payment_method": "lightning",
                  "amount_sats": 9720,
                  "status": "pending",
                  "expires_at": "2026-11-25T04:24:37.641Z",
                  "paid_at": null,
                  "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "created_at": "2026-11-25T03:24:37.655Z",
                  "updated_at": "2026-11-25T03:24:37.655Z",
                  "payment_request": "lntb9720n1test_de140fdd642fbeba395b9PDr1VSAoZWklKqcGBxKXnAtiBayHIeORTd9uCYvTz3CKPUD4fU",
                  "payment_hash": "test_de140fdd642fbeba395b9efdeff04050687499f2ab5c53cf92abb49588f7",
                  "expired": false,
                  "time_until_expiry": 3599,
                  "metadata": {
                    "left_to_pay_cents": 972
                  },
                  "order": {
                    "object": "order",
                    "livemode": false,
                    "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "order_number": "ORD-5C6E99CC3B503CED",
                    "total_amount_cents": 972,
                    "tax_amount_cents": 72,
                    "discount_amount_cents": 0,
                    "total_amount_sats": 9720,
                    "status": "invoice_generated",
                    "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                    "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                    "price_list_id": null,
                    "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                    "discount_id": null,
                    "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                    "created_at": "2026-11-25T03:24:37.603Z",
                    "updated_at": "2026-11-25T03:24:37.678Z",
                    "tender_type": "bitcoin",
                    "cash_paid_at": null,
                    "cash_recorded_by": null,
                    "items": [
                      {
                        "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                        "name": "Latte",
                        "price_cents": 450,
                        "qty": 2,
                        "line_total_cents": 900,
                        "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                        "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                        "tax_amount_cents": 72,
                        "tax_details": [
                          {
                            "name": "Sales tax",
                            "rate": "8.0",
                            "amount_cents": 72,
                            "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                          }
                        ]
                      }
                    ],
                    "currency": "usd",
                    "customer_email": null,
                    "customer_name": null,
                    "customer_phone": null,
                    "shipping_address": null,
                    "notes": null,
                    "metadata": {
                      "pos_sale_id": "1042"
                    },
                    "itemized": false,
                    "subtotal_amount_cents": 900,
                    "tax_details": [
                      {
                        "name": "Sales tax",
                        "rate": "8.0",
                        "amount_cents": 72
                      }
                    ],
                    "payment_link_url": null,
                    "payment_link_created_at": null,
                    "expires_at": null,
                    "payment_email_sent_at": null,
                    "last_reminder_sent_at": null,
                    "reminders": {
                      "planned": 0,
                      "sent": 0,
                      "next_at": null
                    },
                    "delivery_status": null,
                    "pay_at_pickup_at": null,
                    "pickup_location": null,
                    "shipped_at": null,
                    "delivered_at": null,
                    "delivery_note": null,
                    "receipt_url": null,
                    "po_number": "ORD-5C6E99CC3B503CED",
                    "btc_fiat_price_at_creation": "100000.0",
                    "btc_fiat_rate_source": "coinbase"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The invoice, with `payment_request` (a BOLT11 string for Lightning, a `bitcoin:` URI for on-chain), its amount in sats and when it expires."
      }
    },
    "/api/v1/m/invoices/{id}/qr": {
      "get": {
        "summary": "Get the invoice as a QR code",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "0785852c-3673-4507-94d7-452ad32a86d4"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                },
                "example": "<?xml version=\"1.0\" standalone=\"yes\"?><svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" viewBox=\"0 0 150 150\" shape-rendering=\"crispEdges\"><rect width=\"150\" height=\"150\" x=\"0\" y=\"0\" fill=\"#ffffff\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"0\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"6\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"12\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"18\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"24\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"30\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"36\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"42\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"42\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"42\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"42\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"48\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"54\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"60\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"66\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"72\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"78\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"84\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"90\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"42\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"96\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"102\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"108\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"114\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"78\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"120\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"120\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"126\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"48\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"114\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"132\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"60\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"84\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"138\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"0\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"6\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"12\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"18\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"24\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"30\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"36\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"54\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"66\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"72\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"90\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"96\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"102\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"108\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"126\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"132\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"138\" y=\"144\" fill=\"#000000\"/><rect width=\"6\" height=\"6\" x=\"144\" y=\"144\" fill=\"#000000\"/></svg>"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "An SVG image of the invoice's `payment_request`. It needs the Authorization header, so a web page fetches it and can't use it as an image address. You can also draw the QR code yourself from `payment_request`."
      }
    },
    "/api/v1/m/invoices/{id}/status": {
      "get": {
        "summary": "Ask whether an invoice was paid",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "6c629209-0df9-417a-8778-78359445b4d2"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceStatus"
                },
                "examples": {
                  "paid": {
                    "value": {
                      "object": "invoice_status",
                      "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                      "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "livemode": false,
                      "status": "paid",
                      "paid": true,
                      "expired": false,
                      "wallet_reachable": true,
                      "paid_at": "2026-11-25T03:24:37.943Z",
                      "expires_at": "2026-11-25T04:24:37.889Z",
                      "payment_method": "lightning",
                      "amount_sats": 9720,
                      "amount_paid_sats": 9720,
                      "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "payment": {
                        "object": "payment",
                        "livemode": false,
                        "id": "87077927-973e-4ace-8d48-4af38e777043",
                        "amount_sats": 9720,
                        "preimage": "3c84016bfd787a4017128f4fc548fbb8c5ca768bac91d31dd479276c6a44eac8",
                        "confirmed_at": "2026-11-25T03:24:37.943Z",
                        "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                        "invoice_id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                        "created_at": "2026-11-25T03:24:38.007Z",
                        "updated_at": "2026-11-25T03:24:38.007Z",
                        "currency": "usd",
                        "metadata": {},
                        "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                        "settled_at": "2026-11-25T03:24:37.943Z",
                        "usd_value_at_payment": "9.72",
                        "usd_variance_cents": 0,
                        "variance_percentage": "0.0",
                        "btc_fiat_price_at_payment": "100000.0",
                        "fiat_value_at_payment": "9.72",
                        "fiat_variance_cents": 0,
                        "confirmations": 0,
                        "required_confirmations": 1,
                        "flagged_for_review": false,
                        "flag": null,
                        "order": {
                          "object": "order",
                          "livemode": false,
                          "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                          "order_number": "ORD-5C6E99CC3B503CED",
                          "total_amount_cents": 972,
                          "tax_amount_cents": 72,
                          "discount_amount_cents": 0,
                          "total_amount_sats": 9720,
                          "status": "paid",
                          "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                          "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                          "price_list_id": null,
                          "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                          "discount_id": null,
                          "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                          "created_at": "2026-11-25T03:24:37.603Z",
                          "updated_at": "2026-11-25T03:24:37.958Z",
                          "tender_type": "bitcoin",
                          "cash_paid_at": null,
                          "cash_recorded_by": null,
                          "items": [
                            {
                              "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                              "name": "Latte",
                              "price_cents": 450,
                              "qty": 2,
                              "line_total_cents": 900,
                              "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                              "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                              "tax_amount_cents": 72,
                              "tax_details": [
                                {
                                  "name": "Sales tax",
                                  "rate": "8.0",
                                  "amount_cents": 72,
                                  "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                                }
                              ],
                              "total_amount_sats": 9720,
                              "margin_percent": "0.0",
                              "margin_amount_sats": 0,
                              "settlement_amount_sats": 9720,
                              "refund_status": "not_refunded",
                              "refunded_qty": 0,
                              "refunded_cents": 0
                            }
                          ],
                          "currency": "usd",
                          "customer_email": null,
                          "customer_name": null,
                          "customer_phone": null,
                          "shipping_address": null,
                          "notes": null,
                          "metadata": {
                            "pos_sale_id": "1042"
                          },
                          "itemized": false,
                          "subtotal_amount_cents": 900,
                          "tax_details": [
                            {
                              "name": "Sales tax",
                              "rate": "8.0",
                              "amount_cents": 72
                            }
                          ],
                          "payment_link_url": null,
                          "payment_link_created_at": null,
                          "expires_at": null,
                          "payment_email_sent_at": null,
                          "last_reminder_sent_at": null,
                          "reminders": {
                            "planned": 0,
                            "sent": 0,
                            "next_at": null
                          },
                          "delivery_status": null,
                          "pay_at_pickup_at": null,
                          "pickup_location": null,
                          "shipped_at": null,
                          "delivered_at": null,
                          "delivery_note": null,
                          "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                          "po_number": "ORD-5C6E99CC3B503CED",
                          "btc_fiat_price_at_creation": "100000.0",
                          "btc_fiat_rate_source": "coinbase",
                          "margin_percent": "0.0",
                          "margin_amount_sats": 0,
                          "settlement_amount_sats": 9720
                        }
                      }
                    }
                  },
                  "waiting": {
                    "value": {
                      "object": "invoice_status",
                      "id": "3ae8afdb-00c6-48c4-8dcb-7d63f9f13fbb",
                      "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "livemode": false,
                      "status": "pending",
                      "paid": false,
                      "expired": false,
                      "wallet_reachable": true,
                      "paid_at": null,
                      "expires_at": "2026-11-25T04:24:37.641Z",
                      "payment_method": "lightning",
                      "amount_sats": 9720,
                      "amount_paid_sats": null,
                      "receipt_url": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Asks the wallet now. `paid: true` means the money arrived: only then deliver. A paid answer includes the `payment` and `receipt_url`. `expired: true` means it ran out; ask for the next with `POST /api/v1/m/invoices/generate`.\n\nAsk every 2 to 3 seconds while the payment screen is open, every 5 on Free, whose keys ask at most 12 times a minute. These calls don't count toward the hourly rate limit.\n\nIt answers 200 even when the wallet couldn't be asked: then `wallet_reachable` is `false` and `paid: false` means \"not known yet\". Keep asking."
      }
    },
    "/api/v1/m/invoices/{id}/simulate_payment": {
      "post": {
        "summary": "Pay a test invoice",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "94c2c462-0598-4e90-85f7-438b4b0e31be"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceStatus"
                },
                "example": {
                  "object": "invoice_status",
                  "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                  "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "livemode": false,
                  "status": "paid",
                  "paid": true,
                  "expired": false,
                  "wallet_reachable": true,
                  "paid_at": "2026-11-25T03:24:37.943Z",
                  "expires_at": "2026-11-25T04:24:37.889Z",
                  "payment_method": "lightning",
                  "amount_sats": 9720,
                  "amount_paid_sats": 9720,
                  "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "payment": {
                    "object": "payment",
                    "livemode": false,
                    "id": "87077927-973e-4ace-8d48-4af38e777043",
                    "amount_sats": 9720,
                    "preimage": "3c84016bfd787a4017128f4fc548fbb8c5ca768bac91d31dd479276c6a44eac8",
                    "confirmed_at": "2026-11-25T03:24:37.943Z",
                    "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                    "invoice_id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                    "created_at": "2026-11-25T03:24:38.007Z",
                    "updated_at": "2026-11-25T03:24:38.007Z",
                    "currency": "usd",
                    "metadata": {},
                    "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                    "settled_at": "2026-11-25T03:24:37.943Z",
                    "usd_value_at_payment": "9.72",
                    "usd_variance_cents": 0,
                    "variance_percentage": "0.0",
                    "btc_fiat_price_at_payment": "100000.0",
                    "fiat_value_at_payment": "9.72",
                    "fiat_variance_cents": 0,
                    "confirmations": 0,
                    "required_confirmations": 1,
                    "flagged_for_review": false,
                    "flag": null,
                    "order": {
                      "object": "order",
                      "livemode": false,
                      "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "order_number": "ORD-5C6E99CC3B503CED",
                      "total_amount_cents": 972,
                      "tax_amount_cents": 72,
                      "discount_amount_cents": 0,
                      "total_amount_sats": 9720,
                      "status": "paid",
                      "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                      "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                      "price_list_id": null,
                      "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                      "discount_id": null,
                      "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                      "created_at": "2026-11-25T03:24:37.603Z",
                      "updated_at": "2026-11-25T03:24:37.958Z",
                      "tender_type": "bitcoin",
                      "cash_paid_at": null,
                      "cash_recorded_by": null,
                      "items": [
                        {
                          "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                          "name": "Latte",
                          "price_cents": 450,
                          "qty": 2,
                          "line_total_cents": 900,
                          "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                          "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                          "tax_amount_cents": 72,
                          "tax_details": [
                            {
                              "name": "Sales tax",
                              "rate": "8.0",
                              "amount_cents": 72,
                              "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                            }
                          ],
                          "total_amount_sats": 9720,
                          "margin_percent": "0.0",
                          "margin_amount_sats": 0,
                          "settlement_amount_sats": 9720,
                          "refund_status": "not_refunded",
                          "refunded_qty": 0,
                          "refunded_cents": 0
                        }
                      ],
                      "currency": "usd",
                      "customer_email": null,
                      "customer_name": null,
                      "customer_phone": null,
                      "shipping_address": null,
                      "notes": null,
                      "metadata": {
                        "pos_sale_id": "1042"
                      },
                      "itemized": false,
                      "subtotal_amount_cents": 900,
                      "tax_details": [
                        {
                          "name": "Sales tax",
                          "rate": "8.0",
                          "amount_cents": 72
                        }
                      ],
                      "payment_link_url": null,
                      "payment_link_created_at": null,
                      "expires_at": null,
                      "payment_email_sent_at": null,
                      "last_reminder_sent_at": null,
                      "reminders": {
                        "planned": 0,
                        "sent": 0,
                        "next_at": null
                      },
                      "delivery_status": null,
                      "pay_at_pickup_at": null,
                      "pickup_location": null,
                      "shipped_at": null,
                      "delivered_at": null,
                      "delivery_note": null,
                      "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "po_number": "ORD-5C6E99CC3B503CED",
                      "btc_fiat_price_at_creation": "100000.0",
                      "btc_fiat_rate_source": "coinbase",
                      "margin_percent": "0.0",
                      "margin_amount_sats": 0,
                      "settlement_amount_sats": 9720
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this. Codes: `test_mode_only`, `forbidden`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "test_mode_only",
                    "message": "A payment is simulated in test mode only: use a test key (sk_test_…) and a test invoice.",
                    "status": 403,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `invoice_not_payable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invoice_not_payable",
                    "message": "This invoice is expired: generate a new one for the order (POST /api/v1/m/invoices/generate) and pay that.",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Test mode only. Marks a test invoice paid exactly as a real payment would: the order is paid, a payment is recorded, `payment.received` goes to your test webhooks and the receipt exists. Answers what `GET …/status` answers. A live invoice answers 403 `test_mode_only`; one that expired answers 422 `invoice_not_payable`."
      }
    },
    "/api/v1/m/invoices/{id}/simulate_expiry": {
      "post": {
        "summary": "Make a test invoice run out",
        "tags": [
          "Invoices"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "c3f974a7-0510-4bd2-9ed3-c938cc5f8cad"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceStatus"
                },
                "example": {
                  "object": "invoice_status",
                  "id": "3ae8afdb-00c6-48c4-8dcb-7d63f9f13fbb",
                  "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                  "livemode": false,
                  "status": "expired",
                  "paid": false,
                  "expired": true,
                  "wallet_reachable": true,
                  "paid_at": null,
                  "expires_at": "2026-11-25T03:24:37.810Z",
                  "payment_method": "lightning",
                  "amount_sats": 9720,
                  "amount_paid_sats": null,
                  "receipt_url": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this. Codes: `test_mode_only`, `forbidden`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "test_mode_only",
                    "message": "An expiry is simulated in test mode only: use a test key (sk_test_…) and a test invoice.",
                    "status": 403,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Test mode only. The test invoice expires now, as one does when the customer takes too long, so you can try what comes next: ask its status once more, then `POST /api/v1/m/invoices/generate` for a new one. Answers what `GET …/status` answers. A live invoice answers 403 `test_mode_only`."
      }
    },
    "/api/v1/m/payment_requests": {
      "post": {
        "summary": "Ask for a payment of an amount",
        "tags": [
          "Payment requests"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequest"
                },
                "example": {
                  "object": "payment_request",
                  "id": "93ffa20b-f5d8-4408-9bbc-0a46adff730c",
                  "order_id": "d832c0a2-30a1-4353-a7ca-ce55f7821d6b",
                  "livemode": false,
                  "status": "pending",
                  "payment_method": "lightning",
                  "amount_cents": 2500,
                  "currency": "usd",
                  "amount_sats": 25000,
                  "description": "Sale 1043",
                  "metadata": {
                    "pos_sale_id": "1043"
                  },
                  "created_at": "2026-11-25T03:24:38.351Z",
                  "expires_at": "2026-11-25T04:24:38.346Z",
                  "payment_request": "lntb25000n1test_7de963f7a70a4bd5b41b2ukC27ITRmO3R0r3AzUnUQrHDjfgOYfe31MhqofaXt3GGglhwzn",
                  "payment_hash": "test_7de963f7a70a4bd5b41b202143f3b83f793cd4987ac0d4bdc542f7b1b18c"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_json",
                    "message": "The request body isn't valid JSON. Send a JSON object with Content-Type: application/json.",
                    "status": 400,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The request couldn't be read. Codes: `invalid_json`, `bad_request`, `invalid_idempotency_key`."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "subscription_required",
                    "message": "An active subscription is required to perform this action",
                    "status": 402,
                    "details": {
                      "subscription_status": "canceled"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Payment is needed first. Codes: `subscription_required`."
          },
          "403": {
            "description": "The key may not do this. Codes: `forbidden`, `merchant_not_operational`, `location_archived`, `volume_limit_exceeded`, `aup_acceptance_required`, `verification_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage payment requests. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "payment_requests",
                      "access": "manage"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "idempotency_in_progress",
                    "message": "A request with this Idempotency-Key is still being processed. Retry shortly: once it is done, its answer is given again.",
                    "status": 409,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "A conflict with what is there now. Codes: `idempotency_in_progress`."
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "The body is JSON but was sent as application/x-www-form-urlencoded. Send it with the header Content-Type: application/json.",
                    "status": 415,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The body is JSON, sent as something else. Codes: `unsupported_media_type`."
          },
          "422": {
            "description": "The request can't be done as sent. Codes: `unknown_parameter`, `validation_error`, `invalid_argument`, `invalid_amount`, `invalid_payment_method`, `amount_exceeds_wallet_limits`, `open_item_over_limit`, `open_items_off`, `open_item_not_allowed`, `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unknown_parameter",
                    "message": "Not a field of a payment request: currency. It takes amount_cents, payment_method, confirmations, description, customer_email, metadata. The amount is in the merchant's currency (GET /api/v1/m/merchant).",
                    "status": 422,
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "open_invoice_limit_reached",
                    "message": "The merchant has 5 invoices waiting to be paid, the most its Free plan allows open at once. A new one can be made once one of them is paid, expires (a Lightning invoice within 15 minutes) or is cancelled. A higher plan allows more.",
                    "status": 429,
                    "details": {
                      "order_id": "f17eea27-c453-424d-983c-4cecac8fada5"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Too many requests. Codes: `open_invoice_limit_reached`, `rate_limit_exceeded`, `daily_cap_exceeded`."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "provider_error",
                    "message": "Payment provider is temporarily unavailable. Please try again.",
                    "status": 502,
                    "details": {
                      "order_id": "f17eea27-c453-424d-983c-4cecac8fada5"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "The wallet provider couldn't be reached. Codes: `provider_error`."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "service_unavailable",
                    "message": "Service is temporarily unavailable. Please try again later.",
                    "status": 503,
                    "details": {
                      "order_id": "f17eea27-c453-424d-983c-4cecac8fada5"
                    },
                    "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
                  }
                }
              }
            },
            "description": "Not available right now. Codes: `service_unavailable`, `price_unavailable`."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Under `payment_request`, or at the top of the body. A field that isn't listed answers 422 `unknown_parameter`.",
                "properties": {
                  "payment_request": {
                    "type": "object",
                    "required": [
                      "amount_cents"
                    ],
                    "properties": {
                      "amount_cents": {
                        "type": "integer",
                        "minimum": 1,
                        "description": "What to charge, in the merchant's currency's smallest unit. There is no `currency`: it is the merchant's (`GET /api/v1/m/merchant`)."
                      },
                      "payment_method": {
                        "type": "string",
                        "enum": [
                          "lightning",
                          "onchain"
                        ],
                        "default": "lightning",
                        "description": "`lightning` when left out. One the merchant can't take (on-chain in test mode, on-chain with no on-chain wallet) answers 422 `invalid_payment_method` and nothing is made."
                      },
                      "confirmations": {
                        "type": "integer",
                        "minimum": 1,
                        "description": "On-chain only: how many confirmations before it counts as paid. The wallet's own when left out."
                      },
                      "description": {
                        "type": "string",
                        "description": "The line's name on the order and the receipt."
                      },
                      "customer_email": {
                        "type": "string",
                        "format": "email",
                        "description": "Where the receipt goes once paid."
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Your own keys and values, kept on the order and sent in webhooks."
                      }
                    }
                  }
                }
              },
              "example": {
                "payment_request": {
                  "amount_cents": 2500,
                  "payment_method": "lightning",
                  "description": "Sale 1043",
                  "metadata": {
                    "pos_sale_id": "1043"
                  }
                }
              }
            }
          }
        },
        "description": "The shortest way to be paid, for a POS that keeps its own cart: send `amount_cents` in the merchant's currency and get an invoice back. SatsRail makes the order behind it, with one line.\n\nAn amount of your own: a key charges catalog prices unless the merchant lets it charge custom amounts (Settings → API keys). A POS key's payment request is an open item, as the store's rule for open items allows.\n\n`id` is the invoice's id, for `GET /api/v1/m/invoices/{id}/status`; `order_id` is the order. Send an `Idempotency-Key`: a provider's failure names the order in `error.details.order_id`, and the same request invoices it."
      }
    },
    "/api/v1/m/payment_requests/{id}": {
      "get": {
        "summary": "Read a payment request",
        "tags": [
          "Payment requests"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bb929bab-24f9-451f-86f1-8f531df7a023"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "description": "Always \"payment_request\"."
                    },
                    "id": {
                      "type": "string",
                      "description": "The invoice's id: ask GET /api/v1/m/invoices/{id}/status whether it was paid."
                    },
                    "order_id": {
                      "type": "string",
                      "description": "The order made behind the request: read it for the receipt once paid."
                    },
                    "livemode": {
                      "type": "boolean",
                      "description": "false for a test request."
                    },
                    "status": {
                      "type": "string",
                      "description": "pending, paid, expired or cancelled: the invoice's."
                    },
                    "payment_method": {
                      "type": "string",
                      "description": "lightning or onchain."
                    },
                    "amount_cents": {
                      "type": "integer",
                      "description": "What was asked, in the merchant's currency's smallest unit."
                    },
                    "currency": {
                      "type": "string",
                      "description": "The merchant's currency."
                    },
                    "amount_sats": {
                      "type": "integer",
                      "description": "What the customer pays, in sats."
                    },
                    "description": {
                      "type": "string",
                      "description": "The line's name, as you sent it."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {},
                      "description": "What you sent with it."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "When it was made."
                    },
                    "expires_at": {
                      "type": "string",
                      "description": "When the invoice runs out."
                    },
                    "payment_request": {
                      "type": "string",
                      "description": "What the customer pays: a BOLT11 string, or a bitcoin: URI. Show it as a QR code."
                    },
                    "payment_hash": {
                      "type": "string",
                      "description": "The Lightning invoice's payment hash."
                    },
                    "paid_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "When it was paid. null until then."
                    },
                    "amount_paid_sats": {
                      "type": "null",
                      "description": "What arrived, in sats. null until paid."
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "order_id",
                    "livemode",
                    "status",
                    "payment_method",
                    "amount_cents",
                    "currency",
                    "amount_sats",
                    "description",
                    "metadata",
                    "created_at",
                    "expires_at",
                    "payment_request",
                    "payment_hash",
                    "paid_at",
                    "amount_paid_sats"
                  ]
                },
                "example": {
                  "object": "payment_request",
                  "id": "bb929bab-24f9-451f-86f1-8f531df7a023",
                  "order_id": "474959c2-ef20-4dc0-bd2d-9381166259de",
                  "livemode": true,
                  "status": "paid",
                  "payment_method": "lightning",
                  "amount_cents": 10000,
                  "currency": "usd",
                  "amount_sats": 10000,
                  "description": "Item 1",
                  "metadata": {},
                  "created_at": "2026-11-16T22:39:07.042Z",
                  "expires_at": "2026-11-16T23:39:07.040Z",
                  "payment_request": "lnbc2070n1pj9q...",
                  "payment_hash": "63a3aff19f9f3b44e4b39d76a8f81389684905cd5c9f05afac2c84604d7ab72e",
                  "paid_at": "2026-11-16T22:39:07.039Z",
                  "amount_paid_sats": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The payment request, with the invoice's string, its amount and its status."
      }
    },
    "/api/v1/m/payment_requests/{id}/status": {
      "get": {
        "summary": "Ask whether a payment request was paid",
        "tags": [
          "Payment requests"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "6c16ad44-67f6-496f-a70e-3dadd5118761"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceStatus"
                },
                "example": {
                  "object": "invoice_status",
                  "id": "93ffa20b-f5d8-4408-9bbc-0a46adff730c",
                  "order_id": "d832c0a2-30a1-4353-a7ca-ce55f7821d6b",
                  "livemode": false,
                  "status": "pending",
                  "paid": false,
                  "expired": false,
                  "wallet_reachable": true,
                  "paid_at": null,
                  "expires_at": "2026-11-25T04:24:38.346Z",
                  "payment_method": "lightning",
                  "amount_sats": 25000,
                  "amount_paid_sats": null,
                  "receipt_url": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The same question as `GET /api/v1/m/invoices/{id}/status`, with the same id and the same answer: it asks the wallet now, and `paid: true` means the money arrived."
      }
    },
    "/api/v1/m/payments": {
      "get": {
        "summary": "List payments",
        "tags": [
          "Payments"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "x"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `order_id`, `amount_sats`, `currency`, `confirmed_at`, `created_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "order_id_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "amount_sats": {
                            "type": "integer"
                          },
                          "preimage": {
                            "type": "string",
                            "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                          },
                          "confirmed_at": {
                            "type": "string"
                          },
                          "order_id": {
                            "type": "string"
                          },
                          "invoice_id": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {}
                          },
                          "payment_hash": {
                            "type": "string"
                          },
                          "settled_at": {
                            "type": "string"
                          },
                          "usd_value_at_payment": {
                            "type": "string",
                            "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                            "deprecated": true
                          },
                          "usd_variance_cents": {
                            "type": "integer",
                            "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents.",
                            "deprecated": true
                          },
                          "variance_percentage": {
                            "type": "string",
                            "description": "`fiat_variance_cents` as a percent of what the payment was charged."
                          },
                          "btc_fiat_price_at_payment": {
                            "type": "string",
                            "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                          },
                          "fiat_value_at_payment": {
                            "type": "string",
                            "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                          },
                          "fiat_variance_cents": {
                            "type": "integer",
                            "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                          },
                          "confirmations": {
                            "type": "integer"
                          },
                          "required_confirmations": {
                            "type": "integer"
                          },
                          "flagged_for_review": {
                            "type": "boolean"
                          },
                          "flag": {},
                          "order": {
                            "type": "object",
                            "properties": {
                              "object": {
                                "type": "string"
                              },
                              "livemode": {
                                "type": "boolean"
                              },
                              "id": {
                                "type": "string"
                              },
                              "order_number": {
                                "type": "string"
                              },
                              "total_amount_cents": {
                                "type": "integer",
                                "description": "What the customer pays, tax included."
                              },
                              "tax_amount_cents": {
                                "type": "integer",
                                "description": "The tax inside the total."
                              },
                              "discount_amount_cents": {
                                "type": "integer",
                                "description": "What discounts took off."
                              },
                              "total_amount_sats": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string"
                              },
                              "merchant_id": {
                                "type": "string"
                              },
                              "location_id": {
                                "type": "string"
                              },
                              "price_list_id": {},
                              "wallet_id": {
                                "type": "string"
                              },
                              "discount_id": {},
                              "api_token_id": {
                                "type": "string",
                                "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "updated_at": {
                                "type": "string"
                              },
                              "tender_type": {
                                "type": "string",
                                "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
                              },
                              "cash_paid_at": {},
                              "cash_recorded_by": {},
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "price_cents": {
                                      "type": "integer"
                                    },
                                    "qty": {
                                      "type": "integer"
                                    },
                                    "line_total_cents": {
                                      "type": "integer"
                                    },
                                    "product_id": {
                                      "type": "string",
                                      "description": "One of the merchant's products. Its name and price fill the item when not given."
                                    },
                                    "sku_id": {
                                      "type": "string",
                                      "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                                    },
                                    "tax_amount_cents": {
                                      "type": "integer",
                                      "description": "The tax inside the total."
                                    },
                                    "tax_details": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "name": {
                                            "type": "string"
                                          },
                                          "rate": {
                                            "type": "string",
                                            "description": "A percentage, as a decimal string"
                                          },
                                          "amount_cents": {
                                            "type": "integer"
                                          },
                                          "tax_id": {
                                            "type": "string"
                                          }
                                        }
                                      }
                                    },
                                    "total_amount_sats": {
                                      "type": "integer"
                                    },
                                    "margin_percent": {
                                      "type": "string",
                                      "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                                    },
                                    "margin_amount_sats": {
                                      "type": "integer",
                                      "description": "The sats `margin_percent` comes to."
                                    },
                                    "settlement_amount_sats": {
                                      "type": "integer",
                                      "description": "The sats left after `margin_amount_sats`."
                                    },
                                    "refund_status": {
                                      "type": "string"
                                    },
                                    "refunded_qty": {
                                      "type": "integer",
                                      "description": "How many of its units were refunded"
                                    },
                                    "refunded_cents": {
                                      "type": "integer"
                                    }
                                  }
                                }
                              },
                              "currency": {
                                "type": "string"
                              },
                              "customer_email": {},
                              "customer_name": {},
                              "customer_phone": {},
                              "shipping_address": {},
                              "notes": {},
                              "metadata": {
                                "type": "object",
                                "properties": {
                                  "pos_sale_id": {
                                    "type": "string"
                                  }
                                }
                              },
                              "itemized": {
                                "type": "boolean"
                              },
                              "subtotal_amount_cents": {
                                "type": "integer"
                              },
                              "tax_details": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "rate": {
                                      "type": "string",
                                      "description": "A percentage, as a decimal string"
                                    },
                                    "amount_cents": {
                                      "type": "integer"
                                    }
                                  }
                                }
                              },
                              "payment_link_url": {
                                "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                              },
                              "payment_link_created_at": {},
                              "expires_at": {},
                              "payment_email_sent_at": {
                                "description": "When the order's payment link was last emailed to the customer."
                              },
                              "last_reminder_sent_at": {
                                "description": "When the last payment reminder was emailed."
                              },
                              "reminders": {
                                "type": "object",
                                "properties": {
                                  "planned": {
                                    "type": "integer"
                                  },
                                  "sent": {
                                    "type": "integer"
                                  },
                                  "next_at": {}
                                },
                                "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                              },
                              "delivery_status": {},
                              "pay_at_pickup_at": {},
                              "pickup_location": {},
                              "shipped_at": {},
                              "delivered_at": {},
                              "delivery_note": {},
                              "receipt_url": {
                                "type": "string",
                                "description": "The customer's receipt page, once paid; null before."
                              },
                              "po_number": {
                                "type": "string",
                                "description": "The same as `order_number`, kept for older integrations."
                              },
                              "btc_fiat_price_at_creation": {
                                "type": "string"
                              },
                              "btc_fiat_rate_source": {
                                "type": "string",
                                "description": "Where the bitcoin price the order was priced at came from."
                              },
                              "margin_percent": {
                                "type": "string",
                                "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                              },
                              "margin_amount_sats": {
                                "type": "integer",
                                "description": "The sats `margin_percent` comes to."
                              },
                              "settlement_amount_sats": {
                                "type": "integer",
                                "description": "The sats left after `margin_amount_sats`."
                              }
                            }
                          },
                          "invoice": {
                            "type": "object",
                            "properties": {
                              "object": {
                                "type": "string"
                              },
                              "livemode": {
                                "type": "boolean"
                              },
                              "id": {
                                "type": "string"
                              },
                              "payment_method": {
                                "type": "string"
                              },
                              "amount_sats": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "paid_at": {
                                "type": "string"
                              },
                              "order_id": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "updated_at": {
                                "type": "string"
                              },
                              "payment_request": {
                                "type": "string"
                              },
                              "payment_hash": {
                                "type": "string"
                              },
                              "expired": {
                                "type": "boolean"
                              },
                              "time_until_expiry": {
                                "type": "integer"
                              },
                              "metadata": {
                                "type": "object",
                                "properties": {
                                  "left_to_pay_cents": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {},
                        "prev_page": {}
                      }
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "payment",
                      "livemode": false,
                      "id": "87077927-973e-4ace-8d48-4af38e777043",
                      "amount_sats": 9720,
                      "preimage": "3c84016bfd787a4017128f4fc548fbb8c5ca768bac91d31dd479276c6a44eac8",
                      "confirmed_at": "2026-11-25T03:24:37.943Z",
                      "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                      "invoice_id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                      "created_at": "2026-11-25T03:24:38.007Z",
                      "updated_at": "2026-11-25T03:24:38.007Z",
                      "currency": "usd",
                      "metadata": {},
                      "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                      "settled_at": "2026-11-25T03:24:37.943Z",
                      "usd_value_at_payment": "9.72",
                      "usd_variance_cents": 0,
                      "variance_percentage": "0.0",
                      "btc_fiat_price_at_payment": "100000.0",
                      "fiat_value_at_payment": "9.72",
                      "fiat_variance_cents": 0,
                      "confirmations": 0,
                      "required_confirmations": 1,
                      "flagged_for_review": false,
                      "flag": null,
                      "order": {
                        "object": "order",
                        "livemode": false,
                        "id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                        "order_number": "ORD-5C6E99CC3B503CED",
                        "total_amount_cents": 972,
                        "tax_amount_cents": 72,
                        "discount_amount_cents": 0,
                        "total_amount_sats": 9720,
                        "status": "paid",
                        "merchant_id": "46525025-e63a-47d3-bc3b-1579896dd502",
                        "location_id": "778e189c-f0ef-4819-81a2-d622404773dc",
                        "price_list_id": null,
                        "wallet_id": "246228f9-e146-4021-810e-28bc9137d332",
                        "discount_id": null,
                        "api_token_id": "98d1b220-78cc-427d-9312-66998d0a6be2",
                        "created_at": "2026-11-25T03:24:37.603Z",
                        "updated_at": "2026-11-25T03:24:37.958Z",
                        "tender_type": "bitcoin",
                        "cash_paid_at": null,
                        "cash_recorded_by": null,
                        "items": [
                          {
                            "id": "b0b536ea-652d-41a4-8255-d5b6757a5668",
                            "name": "Latte",
                            "price_cents": 450,
                            "qty": 2,
                            "line_total_cents": 900,
                            "product_id": "02354c22-f2c9-46eb-be54-a75c2f20cc1a",
                            "sku_id": "690fab45-c850-4ca7-8601-3e1c04abef46",
                            "tax_amount_cents": 72,
                            "tax_details": [
                              {
                                "name": "Sales tax",
                                "rate": "8.0",
                                "amount_cents": 72,
                                "tax_id": "48d12b21-375f-4654-b0d3-fe213c974dcf"
                              }
                            ],
                            "total_amount_sats": 9720,
                            "margin_percent": "0.0",
                            "margin_amount_sats": 0,
                            "settlement_amount_sats": 9720,
                            "refund_status": "not_refunded",
                            "refunded_qty": 0,
                            "refunded_cents": 0
                          }
                        ],
                        "currency": "usd",
                        "customer_email": null,
                        "customer_name": null,
                        "customer_phone": null,
                        "shipping_address": null,
                        "notes": null,
                        "metadata": {
                          "pos_sale_id": "1042"
                        },
                        "itemized": false,
                        "subtotal_amount_cents": 900,
                        "tax_details": [
                          {
                            "name": "Sales tax",
                            "rate": "8.0",
                            "amount_cents": 72
                          }
                        ],
                        "payment_link_url": null,
                        "payment_link_created_at": null,
                        "expires_at": null,
                        "payment_email_sent_at": null,
                        "last_reminder_sent_at": null,
                        "reminders": {
                          "planned": 0,
                          "sent": 0,
                          "next_at": null
                        },
                        "delivery_status": null,
                        "pay_at_pickup_at": null,
                        "pickup_location": null,
                        "shipped_at": null,
                        "delivered_at": null,
                        "delivery_note": null,
                        "receipt_url": "https://www.satsrail.com/receipt/7c44f73c-4c3c-4467-b9c0-f493681b1518",
                        "po_number": "ORD-5C6E99CC3B503CED",
                        "btc_fiat_price_at_creation": "100000.0",
                        "btc_fiat_rate_source": "coinbase",
                        "margin_percent": "0.0",
                        "margin_amount_sats": 0,
                        "settlement_amount_sats": 9720
                      },
                      "invoice": {
                        "object": "invoice",
                        "livemode": false,
                        "id": "ec0b67ab-99ac-4d5f-a6b2-0c9972c60240",
                        "payment_method": "lightning",
                        "amount_sats": 9720,
                        "status": "paid",
                        "expires_at": "2026-11-25T04:24:37.889Z",
                        "paid_at": "2026-11-25T03:24:37.943Z",
                        "order_id": "7c44f73c-4c3c-4467-b9c0-f493681b1518",
                        "created_at": "2026-11-25T03:24:37.895Z",
                        "updated_at": "2026-11-25T03:24:37.944Z",
                        "payment_request": "lntb9720n1test_1599c8f8b540152b6e134CS3SD35GvzVqiWViRITvx0e6llZzW0hMNLKsmzBAjfAZskeSP0",
                        "payment_hash": "test_1599c8f8b540152b6e134522d1c3502d69fd9b13df95023e413812177b62",
                        "expired": false,
                        "time_until_expiry": 3599,
                        "metadata": {
                          "left_to_pay_cents": 972
                        }
                      }
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 1,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read payments. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "payments",
                      "access": "read"
                    },
                    "request_id": "2f9f93ab-ad80-4b17-b1cb-c80faf40114d"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "invalid_filter",
                    "message": "order_id isn't something this list takes. Filter with q[field_predicate]=value (q[status_eq]=paid); page with page and per_page.",
                    "status": 422,
                    "request_id": "9ee6e01a-3cf7-4613-8e00-0c7661adee6e"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Money that arrived, newest first, in the key's mode."
      }
    },
    "/api/v1/m/payments/{id}": {
      "get": {
        "summary": "Read a payment",
        "tags": [
          "Payments"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "b84d3a9b-3f91-4fa2-9271-bc6dfc6c8b89"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "amount_sats": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "preimage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                    },
                    "confirmed_at": {
                      "type": "string"
                    },
                    "order_id": {
                      "type": "string"
                    },
                    "invoice_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "payment_hash": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settled_at": {
                      "type": "string"
                    },
                    "usd_value_at_payment": {
                      "type": "string",
                      "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                      "deprecated": true
                    },
                    "fiat_value_at_payment": {
                      "type": "string",
                      "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                    },
                    "confirmations": {
                      "type": "integer"
                    },
                    "required_confirmations": {
                      "type": "integer"
                    },
                    "flagged_for_review": {
                      "type": "boolean"
                    },
                    "flag": {
                      "type": "null"
                    },
                    "payment_method": {
                      "type": "string",
                      "description": "Present for an on-chain or a card payment; absent for Lightning"
                    },
                    "gateway": {
                      "type": "string",
                      "description": "Card: the merchant's payment gateway that took it"
                    },
                    "external_id": {
                      "type": "string",
                      "description": "Card: the processor's id for the payment (a Stripe PaymentIntent id)"
                    },
                    "card_brand": {
                      "type": "string",
                      "description": "Card: the brand, as the processor names it (visa, mastercard, amex…)"
                    },
                    "card_last4": {
                      "type": "string",
                      "description": "Card: the card's last four digits"
                    },
                    "order": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string"
                        },
                        "livemode": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "order_number": {
                          "type": "string"
                        },
                        "total_amount_cents": {
                          "type": "integer",
                          "description": "What the customer pays, tax included."
                        },
                        "tax_amount_cents": {
                          "type": "integer",
                          "description": "The tax inside the total."
                        },
                        "discount_amount_cents": {
                          "type": "integer",
                          "description": "What discounts took off."
                        },
                        "total_amount_sats": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string"
                        },
                        "merchant_id": {
                          "type": "string"
                        },
                        "location_id": {
                          "type": "string"
                        },
                        "price_list_id": {
                          "type": "null"
                        },
                        "wallet_id": {
                          "type": "string"
                        },
                        "discount_id": {
                          "type": "null"
                        },
                        "api_token_id": {
                          "type": "null",
                          "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        },
                        "tender_type": {
                          "type": "string",
                          "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
                        },
                        "cash_paid_at": {
                          "type": "null"
                        },
                        "cash_recorded_by": {
                          "type": "null"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "price_cents": {
                                "type": "integer"
                              },
                              "qty": {
                                "type": "integer"
                              },
                              "line_total_cents": {
                                "type": "integer"
                              },
                              "refund_status": {
                                "type": "string"
                              },
                              "refunded_qty": {
                                "type": "integer",
                                "description": "How many of its units were refunded"
                              },
                              "refunded_cents": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "price_cents",
                              "qty",
                              "line_total_cents",
                              "refund_status",
                              "refunded_qty",
                              "refunded_cents"
                            ]
                          }
                        },
                        "currency": {
                          "type": "string"
                        },
                        "customer_email": {
                          "type": "null"
                        },
                        "customer_name": {
                          "type": "null"
                        },
                        "customer_phone": {
                          "type": "null"
                        },
                        "shipping_address": {
                          "type": "null"
                        },
                        "notes": {
                          "type": "null"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {}
                        },
                        "itemized": {
                          "type": "boolean"
                        },
                        "subtotal_amount_cents": {
                          "type": "null"
                        },
                        "tax_details": {
                          "type": "array",
                          "items": {}
                        },
                        "payment_link_url": {
                          "type": "null",
                          "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                        },
                        "payment_link_created_at": {
                          "type": "null"
                        },
                        "expires_at": {
                          "type": "null"
                        },
                        "payment_email_sent_at": {
                          "type": "null",
                          "description": "When the order's payment link was last emailed to the customer."
                        },
                        "last_reminder_sent_at": {
                          "type": "null",
                          "description": "When the last payment reminder was emailed."
                        },
                        "reminders": {
                          "type": "object",
                          "properties": {
                            "planned": {
                              "type": "integer"
                            },
                            "sent": {
                              "type": "integer"
                            },
                            "next_at": {
                              "type": "null"
                            }
                          },
                          "required": [
                            "planned",
                            "sent",
                            "next_at"
                          ],
                          "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                        },
                        "delivery_status": {
                          "type": "null"
                        },
                        "pay_at_pickup_at": {
                          "type": "null"
                        },
                        "pickup_location": {
                          "type": "null"
                        },
                        "shipped_at": {
                          "type": "null"
                        },
                        "delivered_at": {
                          "type": "null"
                        },
                        "delivery_note": {
                          "type": "null"
                        },
                        "receipt_url": {
                          "type": "string",
                          "description": "The customer's receipt page, once paid; null before."
                        },
                        "po_number": {
                          "type": "string",
                          "description": "The same as `order_number`, kept for older integrations."
                        },
                        "btc_fiat_price_at_creation": {
                          "type": "string"
                        },
                        "btc_fiat_rate_source": {
                          "type": "string",
                          "description": "Where the bitcoin price the order was priced at came from."
                        }
                      },
                      "required": [
                        "object",
                        "livemode",
                        "id",
                        "order_number",
                        "total_amount_cents",
                        "tax_amount_cents",
                        "discount_amount_cents",
                        "total_amount_sats",
                        "status",
                        "merchant_id",
                        "location_id",
                        "price_list_id",
                        "wallet_id",
                        "discount_id",
                        "api_token_id",
                        "created_at",
                        "updated_at",
                        "tender_type",
                        "cash_paid_at",
                        "cash_recorded_by",
                        "items",
                        "currency",
                        "customer_email",
                        "customer_name",
                        "customer_phone",
                        "shipping_address",
                        "notes",
                        "metadata",
                        "itemized",
                        "subtotal_amount_cents",
                        "tax_details",
                        "payment_link_url",
                        "payment_link_created_at",
                        "expires_at",
                        "payment_email_sent_at",
                        "last_reminder_sent_at",
                        "reminders",
                        "delivery_status",
                        "pay_at_pickup_at",
                        "pickup_location",
                        "shipped_at",
                        "delivered_at",
                        "delivery_note",
                        "receipt_url",
                        "po_number",
                        "btc_fiat_price_at_creation",
                        "btc_fiat_rate_source"
                      ]
                    },
                    "usd_variance_cents": {
                      "type": "integer",
                      "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents.",
                      "deprecated": true
                    },
                    "variance_percentage": {
                      "type": "string",
                      "description": "`fiat_variance_cents` as a percent of what the payment was charged."
                    },
                    "btc_fiat_price_at_payment": {
                      "type": "string",
                      "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                    },
                    "fiat_variance_cents": {
                      "type": "integer",
                      "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                    },
                    "invoice": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string"
                        },
                        "livemode": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "payment_method": {
                          "type": "string"
                        },
                        "amount_sats": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "paid_at": {
                          "type": "null"
                        },
                        "order_id": {
                          "type": "string"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        },
                        "payment_request": {
                          "type": "string"
                        },
                        "payment_hash": {
                          "type": "string"
                        },
                        "expired": {
                          "type": "boolean"
                        },
                        "time_until_expiry": {
                          "type": "integer"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {}
                        }
                      },
                      "required": [
                        "object",
                        "livemode",
                        "id",
                        "payment_method",
                        "amount_sats",
                        "status",
                        "expires_at",
                        "paid_at",
                        "order_id",
                        "created_at",
                        "updated_at",
                        "payment_request",
                        "payment_hash",
                        "expired",
                        "time_until_expiry",
                        "metadata"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "amount_sats",
                    "preimage",
                    "confirmed_at",
                    "order_id",
                    "invoice_id",
                    "created_at",
                    "updated_at",
                    "currency",
                    "metadata",
                    "payment_hash",
                    "settled_at",
                    "usd_value_at_payment",
                    "fiat_value_at_payment",
                    "confirmations",
                    "required_confirmations",
                    "flagged_for_review",
                    "flag",
                    "order"
                  ]
                },
                "example": {
                  "object": "payment",
                  "livemode": true,
                  "id": "b84d3a9b-3f91-4fa2-9271-bc6dfc6c8b89",
                  "amount_sats": 10000,
                  "preimage": "preimage_7d5c269f5cc96762fec63c38313e25e5_173",
                  "confirmed_at": "2026-11-16T22:39:17.546Z",
                  "order_id": "17bd3b10-8981-43df-8fd3-6bf630cc68a1",
                  "invoice_id": "f48ac7e2-24cf-4a9f-ae36-a9dcebd4a336",
                  "created_at": "2026-11-16T22:39:17.549Z",
                  "updated_at": "2026-11-16T22:39:17.549Z",
                  "currency": "usd",
                  "metadata": {},
                  "payment_hash": "7b48206687930a0552ee9f3d2ecd379188d44086cee249c9b0b2c06f95c7685c",
                  "settled_at": "2026-11-16T22:39:17.546Z",
                  "usd_value_at_payment": "10.0",
                  "fiat_value_at_payment": "10.0",
                  "confirmations": 0,
                  "required_confirmations": 1,
                  "flagged_for_review": false,
                  "flag": null,
                  "payment_method": "card",
                  "gateway": "stripe",
                  "external_id": "pi_api",
                  "card_brand": "visa",
                  "card_last4": "4242",
                  "order": {
                    "object": "order",
                    "livemode": true,
                    "id": "17bd3b10-8981-43df-8fd3-6bf630cc68a1",
                    "order_number": "ORD-1794868757-583",
                    "total_amount_cents": 10000,
                    "tax_amount_cents": 0,
                    "discount_amount_cents": 0,
                    "total_amount_sats": 100000,
                    "status": "paid",
                    "merchant_id": "7fb50c13-ad54-4f96-b32d-20a7182003cb",
                    "location_id": "37eca82e-f433-43be-9c9c-c970b01f65b1",
                    "price_list_id": null,
                    "wallet_id": "109fd61f-75a0-46ba-a849-8ea9996bfddb",
                    "discount_id": null,
                    "api_token_id": null,
                    "created_at": "2026-11-16T22:39:17.524Z",
                    "updated_at": "2026-11-16T22:39:17.524Z",
                    "tender_type": "bitcoin",
                    "cash_paid_at": null,
                    "cash_recorded_by": null,
                    "items": [
                      {
                        "id": "9dd69d76-83ce-43d8-9e13-72cbf6681ff3",
                        "name": "Item 1",
                        "price_cents": 10000,
                        "qty": 1,
                        "line_total_cents": 10000,
                        "refund_status": "not_refunded",
                        "refunded_qty": 0,
                        "refunded_cents": 0
                      }
                    ],
                    "currency": "usd",
                    "customer_email": null,
                    "customer_name": null,
                    "customer_phone": null,
                    "shipping_address": null,
                    "notes": null,
                    "metadata": {},
                    "itemized": false,
                    "subtotal_amount_cents": null,
                    "tax_details": [],
                    "payment_link_url": null,
                    "payment_link_created_at": null,
                    "expires_at": null,
                    "payment_email_sent_at": null,
                    "last_reminder_sent_at": null,
                    "reminders": {
                      "planned": 0,
                      "sent": 0,
                      "next_at": null
                    },
                    "delivery_status": null,
                    "pay_at_pickup_at": null,
                    "pickup_location": null,
                    "shipped_at": null,
                    "delivered_at": null,
                    "delivery_note": null,
                    "receipt_url": "https://www.satsrail.com/receipt/17bd3b10-8981-43df-8fd3-6bf630cc68a1",
                    "po_number": "ORD-1794868757-583",
                    "btc_fiat_price_at_creation": "100000.0",
                    "btc_fiat_rate_source": "coinbase"
                  },
                  "usd_variance_cents": -9000,
                  "variance_percentage": "-90.0",
                  "btc_fiat_price_at_payment": "100000.0",
                  "fiat_variance_cents": -9000,
                  "invoice": {
                    "object": "invoice",
                    "livemode": true,
                    "id": "f48ac7e2-24cf-4a9f-ae36-a9dcebd4a336",
                    "payment_method": "lightning",
                    "amount_sats": 10000,
                    "status": "paid",
                    "expires_at": "2026-11-16T23:39:17.533Z",
                    "paid_at": null,
                    "order_id": "17bd3b10-8981-43df-8fd3-6bf630cc68a1",
                    "created_at": "2026-11-16T22:39:17.536Z",
                    "updated_at": "2026-11-16T22:39:17.536Z",
                    "payment_request": "lnbc2640n1pj9q...",
                    "payment_hash": "7b48206687930a0552ee9f3d2ecd379188d44086cee249c9b0b2c06f95c7685c",
                    "expired": false,
                    "time_until_expiry": 3599,
                    "metadata": {}
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One payment, with its amount and when it was confirmed."
      }
    },
    "/api/v1/m/sales": {
      "get": {
        "summary": "List sales",
        "tags": [
          "Sales"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "description": "sale (a paid order) or refund (a refund of one, its amounts, items and taxes negated)"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string",
                            "description": "The sale's id: its order's id, or a refund sale's refund's"
                          },
                          "order_id": {
                            "type": "string",
                            "description": "The order's id: the same as id for a sale; a refund sale's id is its refund's. It still names the sale after the order is deleted"
                          },
                          "original_sale_id": {
                            "type": "null",
                            "description": "A refund sale's: the sale it refunds"
                          },
                          "order_number": {
                            "type": "string"
                          },
                          "merchant_id": {
                            "type": "string"
                          },
                          "location_id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "description": "paid, shipped, partially_refunded or refunded: the order's when the sale was written (a sale is never edited); a refund sale's is the order's once it is taken"
                          },
                          "current_status": {
                            "type": "string",
                            "description": "Where the order stands by its refund sales: the status, or partially_refunded or refunded"
                          },
                          "source": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Where it was sold: checkout, payment_link, order_link, quick_charge, pos, api, mcp or storefront"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "ordered_at": {
                            "type": "string",
                            "description": "When the order was created (placed at the POS or anywhere else); a refund sale copies its order's"
                          },
                          "sold_at": {
                            "type": "string",
                            "description": "When the payment confirmed, or the refund was made"
                          },
                          "subtotal_cents": {
                            "type": "integer"
                          },
                          "discount_cents": {
                            "type": "integer"
                          },
                          "discount_id": {
                            "type": "null"
                          },
                          "discount_name": {
                            "type": "null"
                          },
                          "tax_cents": {
                            "type": "integer"
                          },
                          "tax_details": {
                            "type": "array",
                            "items": {}
                          },
                          "conversion_fee_percent": {
                            "type": "string"
                          },
                          "conversion_fee_cents": {
                            "type": "integer"
                          },
                          "total_cents": {
                            "type": "integer",
                            "description": "The order's total, in the currency's smallest unit"
                          },
                          "amount_due_cents": {
                            "type": "integer",
                            "description": "What the customer was charged, conversion fee included"
                          },
                          "refunded_cents": {
                            "type": "integer",
                            "description": "What its refund sales returned; 0 on a refund sale"
                          },
                          "payment_method": {
                            "type": "string",
                            "description": "How it was paid: lightning, onchain, cash or card (a card payment on the merchant's own payment gateway: no sats, the amount charged in the sale's currency)"
                          },
                          "custom_method_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A custom payment (a way the merchant named itself, recorded by the cashier at the POS): the method's name as it was when the payment was taken, such as Zelle"
                          },
                          "payment_id": {
                            "type": "string"
                          },
                          "amount_sats": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Sats received (null for cash)"
                          },
                          "btc_price_at_order": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A bitcoin's price in the merchant's currency (`currency`) when the order was priced in sats."
                          },
                          "btc_price_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                          },
                          "btc_usd_price_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A bitcoin's price in US dollars when it was paid, whatever the merchant's currency."
                          },
                          "fiat_value_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                          },
                          "usd_value_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                            "deprecated": true
                          },
                          "fiat_variance_cents": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                          },
                          "usd_variance_cents": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents.",
                            "deprecated": true
                          },
                          "variance_percentage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "`fiat_variance_cents` as a percent of what the payment was charged."
                          },
                          "payment_hash": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "preimage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                          },
                          "wallet_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "wallet_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "api_token_id": {
                            "type": "null",
                            "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                          },
                          "customer_id": {
                            "type": "null",
                            "description": "The storefront customer who placed the order"
                          },
                          "customer_name": {
                            "type": "null",
                            "description": "The customer's name: a sale keeps their name and email only"
                          },
                          "customer_email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "delivery_status": {
                            "type": "null"
                          },
                          "shipped_at": {
                            "type": "null"
                          },
                          "delivered_at": {
                            "type": "null"
                          },
                          "margin_percent": {
                            "type": "null",
                            "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                          },
                          "margin_amount_sats": {
                            "type": "null",
                            "description": "The sats `margin_percent` comes to."
                          },
                          "settlement_amount_sats": {
                            "type": "null",
                            "description": "The sats left after `margin_amount_sats`."
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {}
                          },
                          "receipt_url": {
                            "type": "string",
                            "description": "The public receipt, which keeps working after the order is deleted (null on a refund sale)"
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "original_sale_item_id": {
                                  "type": "null",
                                  "description": "A refund sale's line: the line it refunds"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                                },
                                "qty": {
                                  "type": "integer"
                                },
                                "price_cents": {
                                  "type": "integer"
                                },
                                "line_total_cents": {
                                  "type": "integer"
                                },
                                "tax_rate": {
                                  "type": "null"
                                },
                                "tax_amount_cents": {
                                  "type": "integer",
                                  "description": "The tax inside the total."
                                },
                                "taxes": {
                                  "type": "array",
                                  "items": {},
                                  "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
                                },
                                "discount_amount_cents": {
                                  "type": "integer",
                                  "description": "What discounts took off."
                                },
                                "discounts": {
                                  "type": "array",
                                  "items": {}
                                },
                                "product_id": {
                                  "type": "null",
                                  "description": "One of the merchant's products. Its name and price fill the item when not given."
                                },
                                "sku_id": {
                                  "type": "null",
                                  "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                                },
                                "product_sku": {
                                  "type": "null"
                                },
                                "sku_modifiers": {
                                  "type": "array",
                                  "items": {}
                                },
                                "product_type_id": {
                                  "type": "null",
                                  "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                                },
                                "product_type_name": {
                                  "type": "null"
                                },
                                "total_amount_sats": {
                                  "type": "null"
                                },
                                "margin_amount_sats": {
                                  "type": "null",
                                  "description": "The sats `margin_percent` comes to."
                                },
                                "settlement_amount_sats": {
                                  "type": "null",
                                  "description": "The sats left after `margin_amount_sats`."
                                },
                                "refund_status": {
                                  "type": "string",
                                  "description": "How far the item has been refunded, worked out from the sales ledger: not_refunded, partially_refunded (a unit, or its share of an amount refunded without naming items) or refunded (every unit, its line total and its taxes), as the sale's refund sales tell; null on a refund sale's line"
                                },
                                "refunded_qty": {
                                  "type": "integer",
                                  "description": "How many of its units were refunded"
                                },
                                "refunded_cents": {
                                  "type": "integer",
                                  "description": "How much of its line total and taxes was refunded, in the currency's smallest unit"
                                }
                              },
                              "required": [
                                "id",
                                "original_sale_item_id",
                                "name",
                                "qty",
                                "price_cents",
                                "line_total_cents",
                                "tax_rate",
                                "tax_amount_cents",
                                "taxes",
                                "discount_amount_cents",
                                "discounts",
                                "product_id",
                                "sku_id",
                                "product_sku",
                                "sku_modifiers",
                                "product_type_id",
                                "product_type_name",
                                "total_amount_sats",
                                "margin_amount_sats",
                                "settlement_amount_sats",
                                "refund_status",
                                "refunded_qty",
                                "refunded_cents"
                              ]
                            }
                          },
                          "payments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "The payment's id; on a refund sale, the refund's"
                                },
                                "kind": {
                                  "type": "string",
                                  "description": "sale (a paid order) or refund (a refund of one, its amounts, items and taxes negated)"
                                },
                                "payment_method": {
                                  "type": "string",
                                  "description": "lightning, onchain, cash, card, external_card, nequi, store_credit or custom (a payment method the merchant named itself, custom_method_name) on a payment; the refund's method (cash, bitcoin, card, bank_transfer …) on a refund"
                                },
                                "amount_cents": {
                                  "type": "integer",
                                  "description": "What it settled of the sale's amount due: a sale's payments add up to it. A payment that came after the order was paid settles 0; negative on a refund sale"
                                },
                                "paid_at": {
                                  "type": "string"
                                },
                                "amount_sats": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "description": "Sats received (null for cash and card)"
                                },
                                "btc_price_at_payment": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                                },
                                "fiat_value_at_payment": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                                },
                                "fiat_variance_cents": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                                },
                                "payment_hash": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "preimage": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                                },
                                "txid": {
                                  "type": "null",
                                  "description": "On-chain: the transaction"
                                },
                                "vout": {
                                  "type": "null",
                                  "description": "On-chain: the output"
                                },
                                "card_brand": {
                                  "type": "null",
                                  "description": "Card: the brand, as the processor names it (visa, mastercard, amex…)"
                                },
                                "card_last4": {
                                  "type": "null",
                                  "description": "Card: the card's last four digits"
                                },
                                "approval_code": {
                                  "type": "null",
                                  "description": "A card charged on the merchant's own terminal (external_card): the approval code its receipt printed, if the cashier typed it in"
                                },
                                "terminal_transaction_number": {
                                  "type": "null",
                                  "description": "External card: the terminal's transaction number, to match its end-of-day batch"
                                },
                                "terminal_tip_cents": {
                                  "type": "null",
                                  "description": "External card: the tip the customer added on the terminal, beside amount_cents and never in it"
                                },
                                "custom_method_name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "A custom payment (a way the merchant named itself, recorded by the cashier at the POS): the method's name as it was when the payment was taken, such as Zelle"
                                },
                                "custom_reference": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Custom payment: the reference the cashier typed (a check's number, a confirmation code), if any"
                                },
                                "refunded_payment_id": {
                                  "type": "null",
                                  "description": "On a refund: the payment it returned"
                                }
                              },
                              "required": [
                                "id",
                                "kind",
                                "payment_method",
                                "amount_cents",
                                "paid_at",
                                "amount_sats",
                                "btc_price_at_payment",
                                "fiat_value_at_payment",
                                "fiat_variance_cents",
                                "payment_hash",
                                "preimage",
                                "txid",
                                "vout",
                                "card_brand",
                                "card_last4",
                                "approval_code",
                                "terminal_transaction_number",
                                "terminal_tip_cents",
                                "custom_method_name",
                                "custom_reference",
                                "refunded_payment_id"
                              ]
                            },
                            "description": "Every payment that paid it, cash, card or bitcoin, in the order they came; on a refund sale, its one row: the money it returned. The payment fields above are the first payment's, kept for the clients that read them"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "object",
                          "kind",
                          "livemode",
                          "id",
                          "order_id",
                          "original_sale_id",
                          "order_number",
                          "merchant_id",
                          "location_id",
                          "status",
                          "current_status",
                          "source",
                          "currency",
                          "ordered_at",
                          "sold_at",
                          "subtotal_cents",
                          "discount_cents",
                          "discount_id",
                          "discount_name",
                          "tax_cents",
                          "tax_details",
                          "conversion_fee_percent",
                          "conversion_fee_cents",
                          "total_cents",
                          "amount_due_cents",
                          "refunded_cents",
                          "payment_method",
                          "custom_method_name",
                          "payment_id",
                          "amount_sats",
                          "btc_price_at_order",
                          "btc_price_at_payment",
                          "btc_usd_price_at_payment",
                          "fiat_value_at_payment",
                          "usd_value_at_payment",
                          "fiat_variance_cents",
                          "usd_variance_cents",
                          "variance_percentage",
                          "payment_hash",
                          "preimage",
                          "wallet_id",
                          "wallet_name",
                          "api_token_id",
                          "customer_id",
                          "customer_name",
                          "customer_email",
                          "delivery_status",
                          "shipped_at",
                          "delivered_at",
                          "margin_percent",
                          "margin_amount_sats",
                          "settlement_amount_sats",
                          "metadata",
                          "receipt_url",
                          "items",
                          "payments",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "sale",
                      "kind": "sale",
                      "livemode": true,
                      "id": "86b752b0-2c75-44a5-9b1f-541d27023e7d",
                      "order_id": "86b752b0-2c75-44a5-9b1f-541d27023e7d",
                      "original_sale_id": null,
                      "order_number": "ORD-1794868817-603",
                      "merchant_id": "4055f693-88fe-4aba-859a-2d4172185393",
                      "location_id": "2bce2788-6350-41ee-a64f-fe06e668bdb2",
                      "status": "paid",
                      "current_status": "paid",
                      "source": "api",
                      "currency": "usd",
                      "ordered_at": "2026-11-16T22:40:17.015Z",
                      "sold_at": "2026-11-16T22:40:17.042Z",
                      "subtotal_cents": 10000,
                      "discount_cents": 0,
                      "discount_id": null,
                      "discount_name": null,
                      "tax_cents": 0,
                      "tax_details": [],
                      "conversion_fee_percent": "0.0",
                      "conversion_fee_cents": 0,
                      "total_cents": 10000,
                      "amount_due_cents": 10000,
                      "refunded_cents": 0,
                      "payment_method": "lightning",
                      "custom_method_name": null,
                      "payment_id": "abe7a6c1-c1dc-41eb-af97-89c7e33bf299",
                      "amount_sats": 123456,
                      "btc_price_at_order": "100000.0",
                      "btc_price_at_payment": "100000.0",
                      "btc_usd_price_at_payment": "100000.0",
                      "fiat_value_at_payment": "123.46",
                      "usd_value_at_payment": "123.46",
                      "fiat_variance_cents": 2346,
                      "usd_variance_cents": 2346,
                      "variance_percentage": "23.46",
                      "payment_hash": "97fbc35c56c03c99bc39ba8a6c041b495a0a30c3beb1f8a7102d0f2f59904ac1",
                      "preimage": "preimage_5cac37f7e9c6d4151f67473b143f1aad_179",
                      "wallet_id": "0ef8b61f-5705-44fa-8aaf-3675704bdd78",
                      "wallet_name": "Wallet 1726",
                      "api_token_id": null,
                      "customer_id": null,
                      "customer_name": null,
                      "customer_email": "ada@example.com",
                      "delivery_status": null,
                      "shipped_at": null,
                      "delivered_at": null,
                      "margin_percent": null,
                      "margin_amount_sats": null,
                      "settlement_amount_sats": null,
                      "metadata": {},
                      "receipt_url": "https://www.satsrail.com/receipt/86b752b0-2c75-44a5-9b1f-541d27023e7d",
                      "items": [
                        {
                          "id": "475d84f6-8d6b-45d8-beea-b72e32801b63",
                          "original_sale_item_id": null,
                          "name": "Beans",
                          "qty": 2,
                          "price_cents": 5000,
                          "line_total_cents": 10000,
                          "tax_rate": null,
                          "tax_amount_cents": 0,
                          "taxes": [],
                          "discount_amount_cents": 0,
                          "discounts": [],
                          "product_id": null,
                          "sku_id": null,
                          "product_sku": null,
                          "sku_modifiers": [],
                          "product_type_id": null,
                          "product_type_name": null,
                          "total_amount_sats": null,
                          "margin_amount_sats": null,
                          "settlement_amount_sats": null,
                          "refund_status": "not_refunded",
                          "refunded_qty": 0,
                          "refunded_cents": 0
                        }
                      ],
                      "payments": [
                        {
                          "id": "abe7a6c1-c1dc-41eb-af97-89c7e33bf299",
                          "kind": "payment",
                          "payment_method": "lightning",
                          "amount_cents": 10000,
                          "paid_at": "2026-11-16T22:40:17.042Z",
                          "amount_sats": 123456,
                          "btc_price_at_payment": "100000.0",
                          "fiat_value_at_payment": "123.46",
                          "fiat_variance_cents": 2346,
                          "payment_hash": "97fbc35c56c03c99bc39ba8a6c041b495a0a30c3beb1f8a7102d0f2f59904ac1",
                          "preimage": "preimage_5cac37f7e9c6d4151f67473b143f1aad_179",
                          "txid": null,
                          "vout": null,
                          "card_brand": null,
                          "card_last4": null,
                          "approval_code": null,
                          "terminal_transaction_number": null,
                          "terminal_tip_cents": null,
                          "custom_method_name": null,
                          "custom_reference": null,
                          "refunded_payment_id": null
                        }
                      ],
                      "created_at": "2026-11-16T22:40:17.065Z",
                      "updated_at": "2026-11-16T22:40:17.065Z"
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 1,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "merchant_not_operational",
                    "message": "Merchant account is suspended. Contact support for assistance.",
                    "status": 403,
                    "details": {
                      "resource": "reports",
                      "access": "read"
                    },
                    "request_id": "4bb5f697-4f81-4713-97ee-d64d541e305c"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The sales ledger: one sale per paid order, newest sold_at first. A sale is written when its order is paid and kept after the order itself is deleted, so its id is the order's id. Read with a secret key whose security group reads reports; a test key lists test sales."
      }
    },
    "/api/v1/m/sales/{id}": {
      "get": {
        "summary": "Read a sale",
        "tags": [
          "Sales"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "f8ca154d-9596-441c-a46d-622d8e2d4a13"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "description": "sale (a paid order) or refund (a refund of one, its amounts, items and taxes negated)"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string",
                      "description": "The sale's id: its order's id, or a refund sale's refund's"
                    },
                    "order_id": {
                      "type": "string",
                      "description": "The order's id: the same as id for a sale; a refund sale's id is its refund's. It still names the sale after the order is deleted"
                    },
                    "original_sale_id": {
                      "type": "null",
                      "description": "A refund sale's: the sale it refunds"
                    },
                    "order_number": {
                      "type": "string"
                    },
                    "merchant_id": {
                      "type": "string"
                    },
                    "location_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "description": "paid, shipped, partially_refunded or refunded: the order's when the sale was written (a sale is never edited); a refund sale's is the order's once it is taken"
                    },
                    "current_status": {
                      "type": "string",
                      "description": "Where the order stands by its refund sales: the status, or partially_refunded or refunded"
                    },
                    "source": {
                      "type": "string",
                      "description": "Where it was sold: checkout, payment_link, order_link, quick_charge, pos, api, mcp or storefront"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "ordered_at": {
                      "type": "string",
                      "description": "When the order was created (placed at the POS or anywhere else); a refund sale copies its order's"
                    },
                    "sold_at": {
                      "type": "string",
                      "description": "When the payment confirmed, or the refund was made"
                    },
                    "subtotal_cents": {
                      "type": "integer"
                    },
                    "discount_cents": {
                      "type": "integer"
                    },
                    "discount_id": {
                      "type": "null"
                    },
                    "discount_name": {
                      "type": "null"
                    },
                    "tax_cents": {
                      "type": "integer"
                    },
                    "tax_details": {
                      "type": "array",
                      "items": {}
                    },
                    "conversion_fee_percent": {
                      "type": "string"
                    },
                    "conversion_fee_cents": {
                      "type": "integer"
                    },
                    "total_cents": {
                      "type": "integer",
                      "description": "The order's total, in the currency's smallest unit"
                    },
                    "amount_due_cents": {
                      "type": "integer",
                      "description": "What the customer was charged, conversion fee included"
                    },
                    "refunded_cents": {
                      "type": "integer",
                      "description": "What its refund sales returned; 0 on a refund sale"
                    },
                    "payment_method": {
                      "type": "string",
                      "description": "How it was paid: lightning, onchain, cash or card (a card payment on the merchant's own payment gateway: no sats, the amount charged in the sale's currency)"
                    },
                    "custom_method_name": {
                      "type": "null",
                      "description": "A custom payment (a way the merchant named itself, recorded by the cashier at the POS): the method's name as it was when the payment was taken, such as Zelle"
                    },
                    "payment_id": {
                      "type": "string"
                    },
                    "amount_sats": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Sats received (null for cash)"
                    },
                    "btc_price_at_order": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A bitcoin's price in the merchant's currency (`currency`) when the order was priced in sats."
                    },
                    "btc_price_at_payment": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                    },
                    "btc_usd_price_at_payment": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A bitcoin's price in US dollars when it was paid, whatever the merchant's currency."
                    },
                    "fiat_value_at_payment": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                    },
                    "usd_value_at_payment": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                      "deprecated": true
                    },
                    "fiat_variance_cents": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                    },
                    "usd_variance_cents": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents.",
                      "deprecated": true
                    },
                    "variance_percentage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "`fiat_variance_cents` as a percent of what the payment was charged."
                    },
                    "payment_hash": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "preimage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                    },
                    "wallet_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "wallet_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "api_token_id": {
                      "type": "null",
                      "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                    },
                    "customer_id": {
                      "type": "null",
                      "description": "The storefront customer who placed the order"
                    },
                    "customer_name": {
                      "type": "null",
                      "description": "The customer's name: a sale keeps their name and email only"
                    },
                    "customer_email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "delivery_status": {
                      "type": "null"
                    },
                    "shipped_at": {
                      "type": "null"
                    },
                    "delivered_at": {
                      "type": "null"
                    },
                    "margin_percent": {
                      "type": "null",
                      "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                    },
                    "margin_amount_sats": {
                      "type": "null",
                      "description": "The sats `margin_percent` comes to."
                    },
                    "settlement_amount_sats": {
                      "type": "null",
                      "description": "The sats left after `margin_amount_sats`."
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "receipt_url": {
                      "type": "string",
                      "description": "The public receipt, which keeps working after the order is deleted (null on a refund sale)"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "original_sale_item_id": {
                            "type": "null",
                            "description": "A refund sale's line: the line it refunds"
                          },
                          "name": {
                            "type": "string",
                            "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "price_cents": {
                            "type": "integer"
                          },
                          "line_total_cents": {
                            "type": "integer"
                          },
                          "tax_rate": {
                            "type": "null"
                          },
                          "tax_amount_cents": {
                            "type": "integer",
                            "description": "The tax inside the total."
                          },
                          "taxes": {
                            "type": "array",
                            "items": {},
                            "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
                          },
                          "discount_amount_cents": {
                            "type": "integer",
                            "description": "What discounts took off."
                          },
                          "discounts": {
                            "type": "array",
                            "items": {}
                          },
                          "product_id": {
                            "type": "null",
                            "description": "One of the merchant's products. Its name and price fill the item when not given."
                          },
                          "sku_id": {
                            "type": "null",
                            "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                          },
                          "product_sku": {
                            "type": "null"
                          },
                          "sku_modifiers": {
                            "type": "array",
                            "items": {}
                          },
                          "product_type_id": {
                            "type": "null",
                            "description": "Product type to file it under. Omit to use the merchant's Default type, created on first use."
                          },
                          "product_type_name": {
                            "type": "null"
                          },
                          "total_amount_sats": {
                            "type": "null"
                          },
                          "margin_amount_sats": {
                            "type": "null",
                            "description": "The sats `margin_percent` comes to."
                          },
                          "settlement_amount_sats": {
                            "type": "null",
                            "description": "The sats left after `margin_amount_sats`."
                          },
                          "refund_status": {
                            "type": "string",
                            "description": "How far the item has been refunded, worked out from the sales ledger: not_refunded, partially_refunded (a unit, or its share of an amount refunded without naming items) or refunded (every unit, its line total and its taxes), as the sale's refund sales tell; null on a refund sale's line"
                          },
                          "refunded_qty": {
                            "type": "integer",
                            "description": "How many of its units were refunded"
                          },
                          "refunded_cents": {
                            "type": "integer",
                            "description": "How much of its line total and taxes was refunded, in the currency's smallest unit"
                          }
                        },
                        "required": [
                          "id",
                          "original_sale_item_id",
                          "name",
                          "qty",
                          "price_cents",
                          "line_total_cents",
                          "tax_rate",
                          "tax_amount_cents",
                          "taxes",
                          "discount_amount_cents",
                          "discounts",
                          "product_id",
                          "sku_id",
                          "product_sku",
                          "sku_modifiers",
                          "product_type_id",
                          "product_type_name",
                          "total_amount_sats",
                          "margin_amount_sats",
                          "settlement_amount_sats",
                          "refund_status",
                          "refunded_qty",
                          "refunded_cents"
                        ]
                      }
                    },
                    "payments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The payment's id; on a refund sale, the refund's"
                          },
                          "kind": {
                            "type": "string",
                            "description": "sale (a paid order) or refund (a refund of one, its amounts, items and taxes negated)"
                          },
                          "payment_method": {
                            "type": "string",
                            "description": "lightning, onchain, cash, card, external_card, nequi, store_credit or custom (a payment method the merchant named itself, custom_method_name) on a payment; the refund's method (cash, bitcoin, card, bank_transfer …) on a refund"
                          },
                          "amount_cents": {
                            "type": "integer",
                            "description": "What it settled of the sale's amount due: a sale's payments add up to it. A payment that came after the order was paid settles 0; negative on a refund sale"
                          },
                          "paid_at": {
                            "type": "string"
                          },
                          "amount_sats": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Sats received (null for cash and card)"
                          },
                          "btc_price_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
                          },
                          "fiat_value_at_payment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
                          },
                          "fiat_variance_cents": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
                          },
                          "payment_hash": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "preimage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
                          },
                          "txid": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "On-chain: the transaction"
                          },
                          "vout": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "On-chain: the output"
                          },
                          "card_brand": {
                            "type": "null",
                            "description": "Card: the brand, as the processor names it (visa, mastercard, amex…)"
                          },
                          "card_last4": {
                            "type": "null",
                            "description": "Card: the card's last four digits"
                          },
                          "approval_code": {
                            "type": "null",
                            "description": "A card charged on the merchant's own terminal (external_card): the approval code its receipt printed, if the cashier typed it in"
                          },
                          "terminal_transaction_number": {
                            "type": "null",
                            "description": "External card: the terminal's transaction number, to match its end-of-day batch"
                          },
                          "terminal_tip_cents": {
                            "type": "null",
                            "description": "External card: the tip the customer added on the terminal, beside amount_cents and never in it"
                          },
                          "custom_method_name": {
                            "type": "null",
                            "description": "A custom payment (a way the merchant named itself, recorded by the cashier at the POS): the method's name as it was when the payment was taken, such as Zelle"
                          },
                          "custom_reference": {
                            "type": "null",
                            "description": "Custom payment: the reference the cashier typed (a check's number, a confirmation code), if any"
                          },
                          "refunded_payment_id": {
                            "type": "null",
                            "description": "On a refund: the payment it returned"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "payment_method",
                          "amount_cents",
                          "paid_at",
                          "amount_sats",
                          "btc_price_at_payment",
                          "fiat_value_at_payment",
                          "fiat_variance_cents",
                          "payment_hash",
                          "preimage",
                          "txid",
                          "vout",
                          "card_brand",
                          "card_last4",
                          "approval_code",
                          "terminal_transaction_number",
                          "terminal_tip_cents",
                          "custom_method_name",
                          "custom_reference",
                          "refunded_payment_id"
                        ]
                      },
                      "description": "Every payment that paid it, cash, card or bitcoin, in the order they came; on a refund sale, its one row: the money it returned. The payment fields above are the first payment's, kept for the clients that read them"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "txid": {
                      "type": "string",
                      "description": "On-chain: the transaction"
                    },
                    "vout": {
                      "type": "integer",
                      "description": "On-chain: the output"
                    },
                    "confirmations": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "kind",
                    "livemode",
                    "id",
                    "order_id",
                    "original_sale_id",
                    "order_number",
                    "merchant_id",
                    "location_id",
                    "status",
                    "current_status",
                    "source",
                    "currency",
                    "ordered_at",
                    "sold_at",
                    "subtotal_cents",
                    "discount_cents",
                    "discount_id",
                    "discount_name",
                    "tax_cents",
                    "tax_details",
                    "conversion_fee_percent",
                    "conversion_fee_cents",
                    "total_cents",
                    "amount_due_cents",
                    "refunded_cents",
                    "payment_method",
                    "custom_method_name",
                    "payment_id",
                    "amount_sats",
                    "btc_price_at_order",
                    "btc_price_at_payment",
                    "btc_usd_price_at_payment",
                    "fiat_value_at_payment",
                    "usd_value_at_payment",
                    "fiat_variance_cents",
                    "usd_variance_cents",
                    "variance_percentage",
                    "payment_hash",
                    "preimage",
                    "wallet_id",
                    "wallet_name",
                    "api_token_id",
                    "customer_id",
                    "customer_name",
                    "customer_email",
                    "delivery_status",
                    "shipped_at",
                    "delivered_at",
                    "margin_percent",
                    "margin_amount_sats",
                    "settlement_amount_sats",
                    "metadata",
                    "receipt_url",
                    "items",
                    "payments",
                    "created_at",
                    "updated_at"
                  ]
                },
                "example": {
                  "object": "sale",
                  "kind": "sale",
                  "livemode": true,
                  "id": "f8ca154d-9596-441c-a46d-622d8e2d4a13",
                  "order_id": "f8ca154d-9596-441c-a46d-622d8e2d4a13",
                  "original_sale_id": null,
                  "order_number": "ORD-SALE-61",
                  "merchant_id": "183ddc23-be2f-4322-9927-b2df866dcd80",
                  "location_id": "900125de-c9ee-4ca8-9529-b0832ef4c354",
                  "status": "paid",
                  "current_status": "paid",
                  "source": "checkout",
                  "currency": "cop",
                  "ordered_at": "2026-11-07T16:00:00.000Z",
                  "sold_at": "2026-11-07T17:00:00.000Z",
                  "subtotal_cents": 1800000,
                  "discount_cents": 0,
                  "discount_id": null,
                  "discount_name": null,
                  "tax_cents": 0,
                  "tax_details": [],
                  "conversion_fee_percent": "0.0",
                  "conversion_fee_cents": 0,
                  "total_cents": 1800000,
                  "amount_due_cents": 1800000,
                  "refunded_cents": 0,
                  "payment_method": "lightning",
                  "custom_method_name": null,
                  "payment_id": "926c063a-69ff-4799-9376-66668799d47b",
                  "amount_sats": 7000,
                  "btc_price_at_order": "400000000.0",
                  "btc_price_at_payment": "400000000.0",
                  "btc_usd_price_at_payment": "100000.0",
                  "fiat_value_at_payment": "28000.0",
                  "usd_value_at_payment": "28000.0",
                  "fiat_variance_cents": 1000000,
                  "usd_variance_cents": 1000000,
                  "variance_percentage": null,
                  "payment_hash": "7fd0a4d75961cbcde76f58dae679f703e294ae89b00a1bdd9e6fb5b0085cea8a",
                  "preimage": "5e553d7b2510fdac1094525b80c225bad3f22f7a1e75cf3ff8a717314f078a19",
                  "wallet_id": null,
                  "wallet_name": null,
                  "api_token_id": null,
                  "customer_id": null,
                  "customer_name": null,
                  "customer_email": null,
                  "delivery_status": null,
                  "shipped_at": null,
                  "delivered_at": null,
                  "margin_percent": null,
                  "margin_amount_sats": null,
                  "settlement_amount_sats": null,
                  "metadata": {},
                  "receipt_url": "https://www.satsrail.com/receipt/f8ca154d-9596-441c-a46d-622d8e2d4a13",
                  "items": [
                    {
                      "id": "45555207-6d8a-4e69-879d-014375871ac8",
                      "original_sale_item_id": null,
                      "name": "Item 1",
                      "qty": 1,
                      "price_cents": 1800000,
                      "line_total_cents": 1800000,
                      "tax_rate": null,
                      "tax_amount_cents": 0,
                      "taxes": [],
                      "discount_amount_cents": 0,
                      "discounts": [],
                      "product_id": null,
                      "sku_id": null,
                      "product_sku": null,
                      "sku_modifiers": [],
                      "product_type_id": null,
                      "product_type_name": null,
                      "total_amount_sats": null,
                      "margin_amount_sats": null,
                      "settlement_amount_sats": null,
                      "refund_status": "not_refunded",
                      "refunded_qty": 0,
                      "refunded_cents": 0
                    }
                  ],
                  "payments": [
                    {
                      "id": "926c063a-69ff-4799-9376-66668799d47b",
                      "kind": "payment",
                      "payment_method": "lightning",
                      "amount_cents": 1800000,
                      "paid_at": "2026-11-07T17:00:00.000Z",
                      "amount_sats": 7000,
                      "btc_price_at_payment": "400000000.0",
                      "fiat_value_at_payment": "28000.0",
                      "fiat_variance_cents": 1000000,
                      "payment_hash": "7fd0a4d75961cbcde76f58dae679f703e294ae89b00a1bdd9e6fb5b0085cea8a",
                      "preimage": "5e553d7b2510fdac1094525b80c225bad3f22f7a1e75cf3ff8a717314f078a19",
                      "txid": null,
                      "vout": null,
                      "card_brand": null,
                      "card_last4": null,
                      "approval_code": null,
                      "terminal_transaction_number": null,
                      "terminal_tip_cents": null,
                      "custom_method_name": null,
                      "custom_reference": null,
                      "refunded_payment_id": null
                    }
                  ],
                  "created_at": "2026-11-07T17:00:00.000Z",
                  "updated_at": "2026-11-07T18:00:00.000Z",
                  "txid": "c7bbaae518c3d05f0f9528bc3e71dec59eb1d8c787ef1fc3288ed7bb1e91bd5b",
                  "vout": 0,
                  "confirmations": 1
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read reports. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "reports",
                      "access": "read"
                    },
                    "request_id": "7b41cc25-238e-4ef7-8f87-7aeb10a7062d"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "A sale by its id, which is its order's id. It answers the same after the order has been deleted. Another merchant's sale, or one of the other mode, is not found."
      }
    },
    "/api/v1/m/checkout_sessions": {
      "get": {
        "summary": "List checkout sessions",
        "tags": [
          "Checkout sessions"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `status`, `created_at`, `updated_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "status_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "token": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "checkout_url": {
                            "type": "string",
                            "description": "The hosted checkout page to send the customer to."
                          },
                          "amount_cents": {
                            "type": "integer"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "tax_amount_cents": {
                            "type": "integer",
                            "description": "The tax inside the total."
                          },
                          "tax_details": {
                            "type": "array",
                            "items": {}
                          },
                          "payment_method": {
                            "type": "null"
                          },
                          "customer_name": {
                            "type": "null"
                          },
                          "customer_email": {
                            "type": "null"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "product_id": {
                            "type": "null",
                            "description": "One of the merchant's products. Its name and price fill the item when not given."
                          },
                          "order_id": {
                            "type": "null"
                          },
                          "invoice_id": {
                            "type": "null"
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {}
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "livemode",
                          "token",
                          "status",
                          "checkout_url",
                          "amount_cents",
                          "currency",
                          "tax_amount_cents",
                          "tax_details",
                          "payment_method",
                          "customer_name",
                          "customer_email",
                          "expires_at",
                          "product_id",
                          "order_id",
                          "invoice_id",
                          "metadata",
                          "created_at"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 0,
                    "total_pages": 0,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read checkout sessions. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "checkout_sessions",
                      "access": "read"
                    },
                    "request_id": "b1f5409f-358d-4e19-9e63-74a5f6bfc580"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The hosted checkout pages the merchant opened, in the key's mode."
      },
      "post": {
        "summary": "Create a checkout session",
        "tags": [
          "Checkout sessions"
        ],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    },
                    "checkout_url": {
                      "type": "string",
                      "description": "The hosted checkout page to send the customer to."
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "tax_amount_cents": {
                      "type": "integer",
                      "description": "The tax inside the total."
                    },
                    "tax_details": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "string",
                            "description": "A percentage, as a decimal string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "rate",
                          "amount_cents"
                        ]
                      }
                    },
                    "currency": {
                      "type": "string"
                    },
                    "customer_email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_phone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_address": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "checkout_mode": {
                      "type": "string"
                    },
                    "checkout_theme": {
                      "type": "string"
                    },
                    "checkout_accent_color": {
                      "type": "string"
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "order_ref": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string"
                        }
                      }
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "token",
                    "checkout_url",
                    "expires_at",
                    "amount_cents",
                    "tax_amount_cents",
                    "tax_details",
                    "currency",
                    "customer_email",
                    "customer_name",
                    "customer_phone",
                    "customer_address",
                    "checkout_mode",
                    "checkout_theme",
                    "checkout_accent_color",
                    "metadata",
                    "status"
                  ]
                },
                "example": {
                  "object": "checkout_session",
                  "livemode": true,
                  "id": "794e21bd-d97f-48a4-979e-3467528d962e",
                  "token": "cs_pJngEYnjBipWvT2pKJZxzTuZnJfsjqPaOJKWC0QzpdQ",
                  "checkout_url": "https://www.satsrail.com/checkout/cs_pJngEYnjBipWvT2pKJZxzTuZnJfsjqPaOJKWC0QzpdQ",
                  "expires_at": "2026-11-16T23:00:52Z",
                  "amount_cents": 100,
                  "tax_amount_cents": 0,
                  "tax_details": [],
                  "currency": "usd",
                  "customer_email": null,
                  "customer_name": null,
                  "customer_phone": null,
                  "customer_address": null,
                  "checkout_mode": "iframe",
                  "checkout_theme": "light",
                  "checkout_accent_color": "#e8b53c",
                  "metadata": {
                    "order_ref": "MY-123",
                    "source": "stream"
                  },
                  "status": "pending"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "current_volume_cents": {
                              "type": "integer"
                            },
                            "volume_currency": {
                              "type": "string"
                            },
                            "max_volume_cents": {
                              "type": "null"
                            },
                            "plan": {
                              "type": "string"
                            },
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          }
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage checkout sessions. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "current_volume_cents": 0,
                      "volume_currency": "USD",
                      "max_volume_cents": null,
                      "plan": "pro",
                      "resource": "checkout_sessions",
                      "access": "manage"
                    },
                    "request_id": "c44cc752-aca3-4ceb-8a94-dea4ecbb4b4f"
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Product not found",
                    "status": 404,
                    "request_id": "bc5f222d-db76-4a07-bb6a-aeb1699860c1"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fields": {
                          "type": "object",
                          "properties": {
                            "currency": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "customer_email": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "amount_cents": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "unknown_parameter",
                    "message": "Not a field of a checkout session: success_url. A session takes amount_cents, currency, product_id, customer_email, customer_name, customer_phone, customer_address, metadata.",
                    "status": 422,
                    "details": [
                      "Amount can't be blank",
                      "Amount is not a number"
                    ],
                    "fields": {
                      "currency": [
                        "must be EUR, your merchant's currency"
                      ],
                      "customer_email": [
                        "is invalid"
                      ],
                      "amount_cents": [
                        "can't be blank",
                        "is not a number"
                      ]
                    },
                    "request_id": "77a9079c-e209-4bcb-bb90-e1768d3a604d"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "checkout_session"
                ],
                "properties": {
                  "checkout_session": {
                    "type": "object",
                    "description": "`amount_cents` or `product_id`: one of the two.",
                    "properties": {
                      "amount_cents": {
                        "type": "integer",
                        "minimum": 1,
                        "description": "What to charge, when no product is named."
                      },
                      "currency": {
                        "type": "string",
                        "description": "ISO 4217, lowercase. The merchant's own when left out."
                      },
                      "product_id": {
                        "type": "string",
                        "description": "A product's id or slug: its price, its name and its taxes."
                      },
                      "customer_email": {
                        "type": "string",
                        "format": "email"
                      },
                      "customer_name": {
                        "type": "string"
                      },
                      "customer_phone": {
                        "type": "string"
                      },
                      "customer_address": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              },
              "example": {
                "checkout_session": {
                  "amount_cents": 100,
                  "currency": "usd",
                  "product_id": "prod_9b46570fa8a647620df9c0b2",
                  "customer_email": "buyer@example.com",
                  "customer_name": "Alice Smith",
                  "customer_phone": "+1-555-1234",
                  "customer_address": "123 Main St",
                  "metadata": {
                    "order_ref": "MY-123",
                    "source": "stream"
                  }
                }
              }
            }
          }
        },
        "description": "Opens a hosted page where the customer pays. Send a `product_id` whose price SatsRail sets, or an `amount_cents` with a key the merchant lets charge custom amounts (Settings → API keys). Send the customer to `checkout_url`. A session is in the key's mode."
      }
    },
    "/api/v1/m/checkout_sessions/{id}": {
      "get": {
        "summary": "Read a checkout session",
        "tags": [
          "Checkout sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "0c3d34d8-a8f2-4ec6-b912-d98a3a912fc3"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "object": {
                          "type": "string"
                        },
                        "livemode": {
                          "type": "boolean"
                        },
                        "token": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "checkout_url": {
                          "type": "string",
                          "description": "The hosted checkout page to send the customer to."
                        },
                        "amount_cents": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "tax_amount_cents": {
                          "type": "integer",
                          "description": "The tax inside the total."
                        },
                        "tax_details": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "rate": {
                                "type": "string",
                                "description": "A percentage, as a decimal string"
                              },
                              "amount_cents": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "name",
                              "rate",
                              "amount_cents"
                            ]
                          }
                        },
                        "payment_method": {
                          "type": "null"
                        },
                        "customer_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "customer_email": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": "null",
                          "description": "One of the merchant's products. Its name and price fill the item when not given."
                        },
                        "order_id": {
                          "type": "null"
                        },
                        "invoice_id": {
                          "type": "null"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {}
                        },
                        "created_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "object",
                        "livemode",
                        "token",
                        "status",
                        "checkout_url",
                        "amount_cents",
                        "currency",
                        "tax_amount_cents",
                        "tax_details",
                        "payment_method",
                        "customer_name",
                        "customer_email",
                        "expires_at",
                        "product_id",
                        "order_id",
                        "invoice_id",
                        "metadata",
                        "created_at"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "id": "0c3d34d8-a8f2-4ec6-b912-d98a3a912fc3",
                    "object": "checkout_session",
                    "livemode": true,
                    "token": "cs_EHgU172Ca0_Ui60UkyW1Vr5KPK_W6zKXzSPWdxvBt6g_56",
                    "status": "pending",
                    "checkout_url": "https://www.satsrail.com/checkout/cs_EHgU172Ca0_Ui60UkyW1Vr5KPK_W6zKXzSPWdxvBt6g_56",
                    "amount_cents": 1000,
                    "currency": "usd",
                    "tax_amount_cents": 0,
                    "tax_details": [],
                    "payment_method": null,
                    "customer_name": "Zqbuyer Quillfeather",
                    "customer_email": "zq.buyer-6620@privacy-probe.example",
                    "expires_at": "2026-11-16T22:56:46.109Z",
                    "product_id": null,
                    "order_id": null,
                    "invoice_id": null,
                    "metadata": {},
                    "created_at": "2026-11-16T22:41:46.113Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One session and its status. `order_id` and `invoice_id` are set once the customer reaches the payment step."
      }
    },
    "/api/v1/m/webhooks": {
      "get": {
        "summary": "List webhook endpoints",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `active`, `url`, `created_at`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "active_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "disabled_at": {
                            "type": "null",
                            "description": "When SatsRail switched the endpoint off after its deliveries kept failing; null while it is on, or when you switched it off."
                          },
                          "success_count": {
                            "type": "integer"
                          },
                          "failure_count": {
                            "type": "integer"
                          },
                          "last_triggered_at": {
                            "type": "null"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "health_percentage": {
                            "type": "integer"
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {}
                          }
                        },
                        "required": [
                          "object",
                          "livemode",
                          "id",
                          "url",
                          "description",
                          "events",
                          "active",
                          "disabled_at",
                          "success_count",
                          "failure_count",
                          "last_triggered_at",
                          "created_at",
                          "updated_at",
                          "health_percentage",
                          "metadata"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    },
                    "available_events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta",
                    "available_events"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "webhook",
                      "livemode": true,
                      "id": "bf26968c-97ac-4e55-999f-a7978dc9eb46",
                      "url": "https://example.com/webhooks",
                      "description": "Test Webhook",
                      "events": [
                        "order.created",
                        "invoice.paid"
                      ],
                      "active": true,
                      "disabled_at": null,
                      "success_count": 0,
                      "failure_count": 0,
                      "last_triggered_at": null,
                      "created_at": "2026-11-16T22:41:01.998Z",
                      "updated_at": "2026-11-16T22:41:01.998Z",
                      "health_percentage": 100,
                      "metadata": {}
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 1,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  },
                  "available_events": [
                    "order.created",
                    "order.updated",
                    "invoice.created",
                    "invoice.paid",
                    "invoice.expired",
                    "payment.received",
                    "payment.confirmed",
                    "payment.flagged",
                    "payment.disputed",
                    "media_key.rotated",
                    "merchant.plan_changed",
                    "invoice.payment_detected",
                    "onchain_payment.held",
                    "onchain_payment.reversed",
                    "subscription.created",
                    "subscription.activated",
                    "subscription.trial_will_end",
                    "subscription.past_due",
                    "subscription.paused",
                    "subscription.resumed",
                    "subscription.cancelled",
                    "subscription.renewed",
                    "refund.created",
                    "refund.updated"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read webhooks. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "webhooks",
                      "access": "read"
                    },
                    "request_id": "69a8717d-e769-47d2-b2ea-769b5baebf2d"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "invalid_filter",
                    "message": "q[merchant_id_eq] isn't a filter here. Filters: active, url, created_at, each with a predicate such as _eq, _gteq or _lteq (q[active_eq])",
                    "status": 422,
                    "request_id": "132afbcc-3e4b-4880-973a-d5731a70a8be"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Lists your webhook endpoints and every event one can subscribe to (available_events)."
      }
    },
    "/api/v1/m/webhooks/{id}": {
      "get": {
        "summary": "Read a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf0f2d80-57ae-440b-a151-b0527ca1b950"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "disabled_at": {
                      "type": "null",
                      "description": "When SatsRail switched the endpoint off after its deliveries kept failing; null while it is on, or when you switched it off."
                    },
                    "success_count": {
                      "type": "integer"
                    },
                    "failure_count": {
                      "type": "integer"
                    },
                    "last_triggered_at": {
                      "type": "null"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "health_percentage": {
                      "type": "integer"
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "url",
                    "description",
                    "events",
                    "active",
                    "disabled_at",
                    "success_count",
                    "failure_count",
                    "last_triggered_at",
                    "created_at",
                    "updated_at",
                    "health_percentage",
                    "metadata"
                  ]
                },
                "example": {
                  "object": "webhook",
                  "livemode": true,
                  "id": "fa0a763e-520b-4324-b7e5-81ce7c0ff92b",
                  "url": "https://example.com/webhooks",
                  "description": "Test Webhook",
                  "events": [
                    "order.created",
                    "invoice.paid"
                  ],
                  "active": true,
                  "disabled_at": null,
                  "success_count": 0,
                  "failure_count": 0,
                  "last_triggered_at": null,
                  "created_at": "2026-11-16T22:41:02.440Z",
                  "updated_at": "2026-11-16T22:41:02.440Z",
                  "health_percentage": 100,
                  "metadata": {}
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One endpoint, with its events and delivery counts."
      }
    },
    "/api/v1/m/wallets": {
      "get": {
        "summary": "List wallets",
        "tags": [
          "Wallets"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Filters, as `q[field_predicate]=value`. Fields: `status`, `enabled`, `name`. Predicates: `_eq`, `_not_eq`, `_gteq`, `_lteq`, `_gt`, `_lt`, `_in`, `_cont`. A status takes its name (`q[status_eq]=paid`); a date alone is that day on the merchant's clock. A field or value the list can't read answers 422 `invalid_filter`.",
            "example": {
              "status_eq": "…"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "operational": {
                            "type": "boolean"
                          },
                          "lightning": {
                            "type": "object",
                            "properties": {
                              "lightning_address": {
                                "type": "string"
                              },
                              "max_payment_sats": {
                                "type": "null",
                                "description": "The most this wallet takes in one payment, in sats, set by the merchant on the Wallets page; null is no maximum. A bigger Lightning payment goes to the merchant's next wallet, and one bigger than every wallet takes is refused with amount_exceeds_wallet_limits."
                              }
                            },
                            "required": [
                              "lightning_address",
                              "max_payment_sats"
                            ]
                          }
                        },
                        "required": [
                          "object",
                          "id",
                          "name",
                          "status",
                          "enabled",
                          "position",
                          "created_at",
                          "updated_at",
                          "operational",
                          "lightning"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "wallet",
                      "id": "b82333a1-0c7a-4588-a27f-582edd2b3716",
                      "name": "Wallet 1884",
                      "status": "active",
                      "enabled": true,
                      "position": 1889,
                      "created_at": "2026-11-16T22:40:57.950Z",
                      "updated_at": "2026-11-16T22:40:57.950Z",
                      "operational": true,
                      "lightning": {
                        "lightning_address": "shop@getalby.com",
                        "max_payment_sats": null
                      }
                    }
                  ],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 1,
                    "total_pages": 1,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read wallets. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "wallets",
                      "access": "read"
                    },
                    "request_id": "45c5aeeb-5884-43f4-bf6f-c87b95eec7ba"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "invalid_filter",
                    "message": "q[merchant_id_eq] isn't a filter here. Filters: status, enabled, name, each with a predicate such as _eq, _gteq or _lteq (q[status_eq])",
                    "status": 422,
                    "request_id": "bebf744c-9efa-4b85-9e71-acf98e6b67fa"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "Where the merchant is paid, in the order they are tried. Read-only; wallets are changed in the portal."
      }
    },
    "/api/v1/m/wallets/{id}": {
      "get": {
        "summary": "Read a wallet",
        "tags": [
          "Wallets"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "2b570b4f-55b1-4116-b27a-0b164afe4dbe"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "operational": {
                      "type": "boolean"
                    },
                    "lightning": {
                      "type": "object",
                      "properties": {
                        "lightning_address": {
                          "type": "string"
                        },
                        "max_payment_sats": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "The most this wallet takes in one payment, in sats, set by the merchant on the Wallets page; null is no maximum. A bigger Lightning payment goes to the merchant's next wallet, and one bigger than every wallet takes is refused with amount_exceeds_wallet_limits."
                        }
                      },
                      "required": [
                        "lightning_address",
                        "max_payment_sats"
                      ]
                    },
                    "last_checked_at": {
                      "type": "null"
                    },
                    "last_transaction_at": {
                      "type": "null"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "consecutive_failures": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "name",
                    "status",
                    "enabled",
                    "position",
                    "created_at",
                    "updated_at",
                    "operational",
                    "lightning",
                    "last_checked_at",
                    "last_transaction_at",
                    "last_error",
                    "consecutive_failures"
                  ]
                },
                "example": {
                  "object": "wallet",
                  "id": "77e98576-7995-4f6f-a392-e8997612a857",
                  "name": "Wallet 1888",
                  "status": "active",
                  "enabled": true,
                  "position": 1893,
                  "created_at": "2026-11-16T22:40:58.811Z",
                  "updated_at": "2026-11-16T22:40:58.811Z",
                  "operational": true,
                  "lightning": {
                    "lightning_address": "testmerchant1886@getalby.com",
                    "max_payment_sats": null
                  },
                  "last_checked_at": null,
                  "last_transaction_at": null,
                  "last_error": null,
                  "consecutive_failures": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One wallet, with its status and the most it takes in one payment."
      }
    },
    "/api/v1/m/access/verify": {
      "post": {
        "summary": "Check a buyer's access token",
        "tags": [
          "Access"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "access_token": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "access_token": "eyJfcmFpbHMiOnsiZGF0YSI6eyJvcmRlcl9pZCI6ImNiY2U5Y2I5LThmYmQtNGY0MS1hN2M5LTI3YzhiYzBhZjJiZCIsInByb2R1Y3RfaWQiOiI4YTc2YzAxZS1jNGZlLTQ0NGEtOTc1Ny05MDFkYTZkMDMxNWMiLCJtZXJjaGFudF9pZCI6ImFhNTI2Y2M4LWU4NDQtNDhmNy04YWJlLWU2NDg5ODY5ODViMyIsImV4cCI6MTc5NDg2OTQ0NH0sImV4cCI6IjIwMjYtMTEtMTZUMjI6NTA6NDQuNzkyWiIsInB1ciI6ImFjY2Vzc190b2tlbiJ9fQ--bfd827686f3282c21fa8b8bef046818ebaafb62b86fd33522013e30ce1a61c71"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "remaining_seconds": {
                      "type": "integer"
                    },
                    "resource_id": {
                      "type": "string"
                    },
                    "resource_type": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "expires_at": {
                      "type": "integer"
                    },
                    "product_id": {
                      "type": "string",
                      "description": "One of the merchant's products. Its name and price fill the item when not given."
                    },
                    "order_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "valid",
                    "remaining_seconds"
                  ]
                },
                "example": {
                  "valid": true,
                  "remaining_seconds": 600,
                  "resource_id": "prod_abc",
                  "resource_type": "stream",
                  "server_time": 1794868844,
                  "expires_at": 1794869444,
                  "product_id": "8a76c01e-c4fe-444a-9757-901da6d0315c",
                  "order_id": "cbce9cb9-8fbd-4f41-a7c9-27c8bc0af2bd"
                }
              }
            }
          },
          "400": {
            "description": "The request couldn't be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "missing_token",
                    "message": "access_token is required",
                    "status": 400,
                    "request_id": "cd67cc33-92d6-47a3-97fa-9bd6de910ab2"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Payment is needed first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status"
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "error"
                  ]
                },
                "example": {
                  "valid": false,
                  "error": {
                    "code": "access_expired",
                    "message": "This payment no longer grants access to the product.",
                    "status": 402
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "A publishable key reads the catalog and the products on sale, and opens checkout sessions (POST /api/v1/pub/checkout_sessions). Use a secret key for anything else.",
                    "status": 403,
                    "request_id": "4054dfe5-4eb7-457c-a90c-b3e423336343"
                  }
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "From your server. Confirms that an access token a buyer holds is for a paid order, and answers the content key it unlocks."
      }
    },
    "/api/v1/m/media_keys": {
      "get": {
        "summary": "List media keys",
        "tags": [
          "Media keys"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "livemode": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "merchant_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "key_fingerprint": {
                            "type": "string"
                          },
                          "rotation_pending": {
                            "type": "boolean"
                          },
                          "browser_delivery": {
                            "type": "boolean"
                          },
                          "product_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {}
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "object",
                          "livemode",
                          "id",
                          "merchant_id",
                          "name",
                          "key_fingerprint",
                          "rotation_pending",
                          "browser_delivery",
                          "product_ids",
                          "metadata",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total_count": {
                          "type": "integer"
                        },
                        "total_pages": {
                          "type": "integer"
                        },
                        "next_page": {
                          "type": "null"
                        },
                        "prev_page": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "current_page",
                        "per_page",
                        "total_count",
                        "total_pages",
                        "next_page",
                        "prev_page"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "object": "list",
                  "data": [],
                  "meta": {
                    "current_page": 1,
                    "per_page": 25,
                    "total_count": 0,
                    "total_pages": 0,
                    "next_page": null,
                    "prev_page": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't read media keys. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "details": {
                      "resource": "media_keys",
                      "access": "read"
                    },
                    "request_id": "93c090dc-6098-4710-b0fb-6bb60fa60233"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The keys that protect paid content, without the keys themselves."
      }
    },
    "/api/v1/m/media_keys/{id}": {
      "get": {
        "summary": "Read a media key",
        "tags": [
          "Media keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "not-a-uuid"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "merchant_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "key_fingerprint": {
                      "type": "string"
                    },
                    "rotation_pending": {
                      "type": "boolean"
                    },
                    "browser_delivery": {
                      "type": "boolean"
                    },
                    "product_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {}
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "merchant_id",
                    "name",
                    "key_fingerprint",
                    "rotation_pending",
                    "browser_delivery",
                    "product_ids",
                    "metadata",
                    "created_at",
                    "updated_at"
                  ]
                },
                "example": {
                  "object": "media_key",
                  "livemode": true,
                  "id": "09d65ffd-d371-4bee-95f3-cf718743b039",
                  "merchant_id": "51c4c93c-54dd-47b9-8b00-9b6036e10fb7",
                  "name": "Video key",
                  "key_fingerprint": "7ed2ba7c2f2cd70eefe86a7ccbd8199c3ca27c78fd7780620844bde5069a01c4",
                  "rotation_pending": false,
                  "browser_delivery": false,
                  "product_ids": [
                    "7a44c833-c5e5-436c-a6a6-f5c2b697db49",
                    "df99b2af-bc04-4f8a-8d65-b1625f41585c"
                  ],
                  "metadata": {},
                  "created_at": "2026-11-16T22:37:58.038Z",
                  "updated_at": "2026-11-16T22:37:58.038Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "One media key and the products linked to it, without the key itself."
      }
    },
    "/api/v1/m/media_keys/{id}/key": {
      "get": {
        "summary": "Read a media key's secret",
        "tags": [
          "Media keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "9b076fd5-f1cd-4267-8292-851490144ec8"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "key_fingerprint": {
                      "type": "string"
                    },
                    "previous_key": {
                      "type": "null"
                    },
                    "previous_key_fingerprint": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "key",
                    "key_fingerprint",
                    "previous_key",
                    "previous_key_fingerprint"
                  ]
                },
                "example": {
                  "object": "media_key_secret",
                  "id": "29cc1388-dc9f-4faf-ba5d-7f3bbc22ecbe",
                  "key": "_lnyrAEg4wnz_s_AwB1EfKNobtixVQjmWOXAkqgUnoU",
                  "key_fingerprint": "f59dc56d80235a712b7f022a6c65355c33fb26781fb96308ea99693765ac1752",
                  "previous_key": null,
                  "previous_key_fingerprint": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "properties": {
                            "resource": {
                              "type": "string"
                            },
                            "access": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "resource",
                            "access"
                          ]
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "This key's security group doesn't manage media keys. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                    "status": 403,
                    "request_id": "865b46ed-f0eb-4d46-ae61-d7130c5b1ef7",
                    "details": {
                      "resource": "media_keys",
                      "access": "manage"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "The key itself. Needs manage access to media keys."
      }
    },
    "/api/v1/pub/checkout_sessions": {
      "post": {
        "summary": "Create a checkout session from a web page",
        "tags": [
          "Checkout sessions"
        ],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "livemode": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    },
                    "checkout_url": {
                      "type": "string",
                      "description": "The hosted checkout page to send the customer to."
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "tax_amount_cents": {
                      "type": "integer",
                      "description": "The tax inside the total."
                    },
                    "tax_details": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "string",
                            "description": "A percentage, as a decimal string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "rate",
                          "amount_cents"
                        ]
                      }
                    },
                    "currency": {
                      "type": "string"
                    },
                    "customer_email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_phone": {
                      "type": "null"
                    },
                    "customer_address": {
                      "type": "null"
                    },
                    "checkout_mode": {
                      "type": "string"
                    },
                    "checkout_theme": {
                      "type": "string"
                    },
                    "checkout_accent_color": {
                      "type": "string"
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "order_ref": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string"
                        }
                      }
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "object",
                    "livemode",
                    "id",
                    "token",
                    "checkout_url",
                    "expires_at",
                    "amount_cents",
                    "tax_amount_cents",
                    "tax_details",
                    "currency",
                    "customer_email",
                    "customer_name",
                    "customer_phone",
                    "customer_address",
                    "checkout_mode",
                    "checkout_theme",
                    "checkout_accent_color",
                    "metadata",
                    "status"
                  ]
                },
                "example": {
                  "object": "checkout_session",
                  "livemode": true,
                  "id": "37c0072e-5091-447f-8d28-589ffa77a042",
                  "token": "cs_Y43WhOeCUdMc_z6J_E5KDoajGqdiu7k2obXhVc5ZUbs",
                  "checkout_url": "https://www.satsrail.com/checkout/cs_Y43WhOeCUdMc_z6J_E5KDoajGqdiu7k2obXhVc5ZUbs",
                  "expires_at": "2026-11-16T23:00:53Z",
                  "amount_cents": 5000,
                  "tax_amount_cents": 0,
                  "tax_details": [],
                  "currency": "usd",
                  "customer_email": null,
                  "customer_name": null,
                  "customer_phone": null,
                  "customer_address": null,
                  "checkout_mode": "iframe",
                  "checkout_theme": "dark",
                  "checkout_accent_color": "#16a34a",
                  "metadata": {
                    "order_ref": "MY-123",
                    "source": "website"
                  },
                  "status": "pending"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "origin_not_allowed",
                    "message": "This website isn't one of the merchant's allowed domains. The merchant adds it in Ecommerce → Your website.",
                    "status": 403,
                    "request_id": "2af40906-1569-42f8-b418-2d150934ed6c"
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Product not found",
                    "status": 404,
                    "request_id": "0dbc8999-dc89-4870-b6ca-6c0f52ae6a5e"
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request can't be done as sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "details": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "fields": {
                          "type": "object",
                          "properties": {
                            "amount_cents": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "customer_email": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "details",
                        "fields",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "validation_error",
                    "message": "Validation failed",
                    "status": 422,
                    "details": [
                      "Customer email is invalid"
                    ],
                    "fields": {
                      "amount_cents": [
                        "can't be blank",
                        "is not a number"
                      ],
                      "customer_email": [
                        "is invalid"
                      ]
                    },
                    "request_id": "c1bf20aa-51c3-493e-97d4-fedc0f5c923c"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checkout_session": {
                    "type": "object",
                    "properties": {
                      "amount_cents": {
                        "type": "integer"
                      },
                      "currency": {
                        "type": "string",
                        "description": "Optional; the merchant's currency, the default. Any other is refused with a validation_error naming the merchant's."
                      },
                      "product_id": {
                        "type": "string",
                        "description": "One of the merchant's products. Its name and price fill the item when not given."
                      },
                      "customer_email": {
                        "type": "string"
                      },
                      "customer_name": {
                        "type": "string"
                      },
                      "metadata": {
                        "type": "object",
                        "properties": {
                          "order_ref": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "order_ref",
                          "source"
                        ]
                      }
                    }
                  }
                },
                "required": [
                  "checkout_session"
                ]
              },
              "example": {
                "checkout_session": {
                  "amount_cents": 1,
                  "currency": "usd",
                  "product_id": "prod_8d5dd61d7453db75a354b294",
                  "customer_email": "buyer@example.com",
                  "customer_name": "Alice Smith",
                  "metadata": {
                    "order_ref": "MY-123",
                    "source": "website"
                  }
                }
              }
            }
          }
        },
        "description": "With a publishable key. Send a `product_id`: SatsRail sets the price, so the page can't change it. Send the customer to `checkout_url`.\n\nAn `amount_cents` with no product is taken only when the merchant turned on \"Let my website name the amount\" in Settings → Checkout; otherwise the answer is 403 `open_amounts_disabled`. A publishable key is public, so anyone on the page can change an amount: check the amount paid on `payment.received` before you deliver.",
        "security": [
          {
            "publishableKey": []
          }
        ]
      }
    },
    "/api/v1/pub/orders/{id}": {
      "get": {
        "summary": "Confirm a paid order",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "9b99c9ff-cac6-4fc8-a6ae-d8091e1322a8"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order_id": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "order_item_id": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "order_item_id"
                        ]
                      }
                    }
                  },
                  "required": [
                    "order_id",
                    "items"
                  ]
                },
                "example": {
                  "order_id": "c0aa3aa8-50f6-43a6-b6f0-1f1b999a0f2c",
                  "items": [
                    {
                      "order_item_id": "ca361f17-e7c2-459e-9c7f-5309d471a1f6"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key may not do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "forbidden",
                    "message": "Payment not confirmed",
                    "status": 403,
                    "request_id": "6f97b39f-fe84-433c-a330-7ce921448802"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "With a publishable key. Confirms an order was paid and lists what it unlocked. An unpaid order answers 403.",
        "security": [
          {
            "publishableKey": []
          }
        ]
      }
    },
    "/api/v1/pub/access/verify": {
      "post": {
        "summary": "Check a buyer's access token from a web page",
        "tags": [
          "Access"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "access_token": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "access_token": "eyJfcmFpbHMiOnsiZGF0YSI6eyJwYXltZW50X2lkIjoicGF5LXRlc3QtdXVpZCIsInJlc291cmNlX2lkIjoicHJvZF9hYmMiLCJyZXNvdXJjZV90eXBlIjoic3RyZWFtIiwibWVyY2hhbnRfaWQiOiJjNGFmNTBiOS1jYjQ5LTQzOTQtOGVkZS0zODJiZGFjZDBhMmEiLCJleHAiOjE3OTQ4Njk3NDh9LCJleHAiOiIyMDI2LTExLTE2VDIyOjU1OjQ4LjY3MFoiLCJwdXIiOiJhY2Nlc3NfdG9rZW4ifX0--96d26011bb03d951b574e70a76a40d10b1548701d087854bda0a2e18c1ef57ec"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "remaining_seconds": {
                      "type": "integer"
                    },
                    "resource_id": {
                      "type": "string"
                    },
                    "resource_type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "valid",
                    "remaining_seconds",
                    "resource_id",
                    "resource_type"
                  ]
                },
                "example": {
                  "valid": true,
                  "remaining_seconds": 600,
                  "resource_id": "prod_abc",
                  "resource_type": "stream"
                }
              }
            }
          },
          "400": {
            "description": "The request couldn't be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "example": {
                  "error": {
                    "code": "missing_token",
                    "message": "access_token is required",
                    "status": 400,
                    "request_id": "dae9be4c-898a-443d-8924-e04984262856"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Payment is needed first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "status"
                      ]
                    }
                  },
                  "required": [
                    "valid",
                    "error"
                  ]
                },
                "example": {
                  "valid": false,
                  "error": {
                    "code": "access_expired",
                    "message": "Access token has expired or is invalid. Please complete a new payment.",
                    "status": 402
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "description": "With a publishable key. Confirms a buyer's access token and answers the content key it unlocks.",
        "security": [
          {
            "publishableKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "secretKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk_live_… / sk_test_…",
        "description": "A secret key (Settings → API Keys) or a POS device's key (`POST /api/v1/m/sessions/activate`), as `Authorization: Bearer <key>`. `sk_test_` keys sell in test mode."
      },
      "publishableKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pk_live_… / pk_test_…",
        "description": "A publishable key, safe in a web page: it reads what is on sale and opens checkouts."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "status"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "What went wrong, as a word that doesn't change. Branch on this.",
                "example": "validation_error"
              },
              "message": {
                "type": "string",
                "description": "The same, in a sentence for a person.",
                "example": "Validation failed"
              },
              "status": {
                "type": "integer",
                "description": "The HTTP status, repeated.",
                "example": 422
              },
              "details": {
                "description": "More about this error, when there is more to say. Its shape depends on the code: each message for a `validation_error`, each refused item for `item_unavailable`, the order left pending (`order_id`) after a provider's failure, the missing `resource` and `access` for `forbidden`, both figures for `price_changed`.",
                "oneOf": [
                  {
                    "type": "array",
                    "items": {}
                  },
                  {
                    "type": "object"
                  }
                ]
              },
              "fields": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "description": "With a validation_error: the messages by the field each is about."
              },
              "request_id": {
                "type": "string",
                "description": "The request's id. Quote it to support."
              }
            }
          }
        },
        "example": {
          "error": {
            "code": "validation_error",
            "message": "Validation failed",
            "status": 422,
            "details": [
              "Total amount cents must be greater than 0"
            ],
            "fields": {
              "total_amount_cents": [
                "must be greater than 0"
              ]
            },
            "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"order\"."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test order, made with a test key. A test order is paid by simulation and moves no money."
          },
          "id": {
            "type": "string",
            "description": "The order's id."
          },
          "order_number": {
            "type": "string",
            "description": "A number a person can read out, printed on the receipt."
          },
          "total_amount_cents": {
            "type": "integer",
            "description": "What the customer pays, tax included, in the currency's smallest unit."
          },
          "tax_amount_cents": {
            "type": "integer",
            "description": "The tax inside the total."
          },
          "discount_amount_cents": {
            "type": "integer",
            "description": "What discounts took off."
          },
          "total_amount_sats": {
            "type": "integer",
            "description": "The total in sats, at the bitcoin price when the order was priced. null until it is priced for bitcoin."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "invoice_generated",
              "paid",
              "shipped",
              "cancelled",
              "refunded",
              "draft",
              "expired",
              "partially_refunded"
            ],
            "description": "Where the order stands. pending: made, no invoice yet. invoice_generated: an invoice is out, waiting to be paid. paid: the money arrived. shipped: paid and handed over. cancelled, expired: closed unpaid. partially_refunded, refunded: paid, then refunded. draft: being built item by item."
          },
          "merchant_id": {
            "type": "string",
            "description": "The merchant."
          },
          "location_id": {
            "type": "string",
            "description": "Where it was sold."
          },
          "price_list_id": {
            "description": "The price list it was priced from, if any."
          },
          "wallet_id": {
            "type": "string",
            "description": "The merchant's wallet the invoice pays to."
          },
          "discount_id": {
            "description": "The merchant's discount on the whole order, if any."
          },
          "api_token_id": {
            "type": "string",
            "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
          },
          "created_at": {
            "type": "string",
            "description": "When it was made."
          },
          "updated_at": {
            "type": "string",
            "description": "When it last changed."
          },
          "tender_type": {
            "type": "string",
            "description": "How it was paid or is to be: bitcoin, cash, card."
          },
          "cash_paid_at": {
            "description": "When cash was recorded for it."
          },
          "cash_recorded_by": {
            "description": "Who recorded the cash."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "price_cents": {
                  "type": "integer"
                },
                "qty": {
                  "type": "integer"
                },
                "line_total_cents": {
                  "type": "integer"
                },
                "product_id": {
                  "type": "string",
                  "description": "One of the merchant's products. Its name and price fill the item when not given."
                },
                "sku_id": {
                  "type": "string",
                  "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                },
                "tax_amount_cents": {
                  "type": "integer",
                  "description": "This line's tax."
                },
                "tax_details": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "string",
                        "description": "A percentage, as a decimal string"
                      },
                      "amount_cents": {
                        "type": "integer"
                      },
                      "tax_id": {
                        "type": "string"
                      }
                    }
                  }
                },
                "total_amount_sats": {
                  "type": "integer"
                },
                "margin_percent": {
                  "type": "string",
                  "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                },
                "margin_amount_sats": {
                  "type": "integer",
                  "description": "The sats `margin_percent` comes to."
                },
                "settlement_amount_sats": {
                  "type": "integer",
                  "description": "The sats left after `margin_amount_sats`."
                },
                "refund_status": {
                  "type": "string",
                  "description": "How far the item has been refunded, worked out from the sales ledger: not_refunded, partially_refunded (a unit, or its share of an amount refunded without naming items) or refunded (every unit, its line total and its taxes); present once the order is paid"
                },
                "refunded_qty": {
                  "type": "integer",
                  "description": "How many of its units were refunded"
                },
                "refunded_cents": {
                  "type": "integer",
                  "description": "How much of its line total and taxes was refunded, in the currency's smallest unit"
                }
              }
            },
            "description": "The lines."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, lowercase. The merchant's."
          },
          "customer_email": {
            "description": "The customer's email address, where the receipt goes"
          },
          "customer_name": {},
          "customer_phone": {},
          "shipping_address": {},
          "notes": {},
          "metadata": {
            "type": "object",
            "properties": {
              "pos_sale_id": {
                "type": "string"
              }
            },
            "description": "What you sent with it, as you sent it."
          },
          "itemized": {
            "type": "boolean",
            "description": "true for an order built line by line over MCP and sent as a payment link. false for an order made in one call, items or not."
          },
          "subtotal_amount_cents": {
            "type": "integer",
            "description": "The lines before tax."
          },
          "tax_details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "rate": {
                  "type": "string",
                  "description": "A percentage, as a decimal string"
                },
                "amount_cents": {
                  "type": "integer"
                }
              }
            },
            "description": "Each tax charged, with its name, rate and amount."
          },
          "payment_link_url": {
            "description": "The order's own payment page, when a link was made for it."
          },
          "payment_link_created_at": {},
          "expires_at": {
            "description": "When an order sent by payment link stops being payable. null for a counter sale."
          },
          "payment_email_sent_at": {
            "description": "When the order's payment link was last emailed to the customer."
          },
          "last_reminder_sent_at": {
            "description": "When the last payment reminder was emailed."
          },
          "reminders": {
            "type": "object",
            "properties": {
              "planned": {
                "type": "integer"
              },
              "sent": {
                "type": "integer"
              },
              "next_at": {}
            },
            "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
          },
          "delivery_status": {
            "description": "undelivered, shipped or delivered, where the merchant tracks delivery. null otherwise."
          },
          "pay_at_pickup_at": {},
          "pickup_location": {},
          "shipped_at": {},
          "delivered_at": {},
          "delivery_note": {},
          "receipt_url": {
            "type": "string",
            "description": "The customer's receipt, once the order is paid. null before."
          },
          "po_number": {
            "type": "string",
            "description": "The same as `order_number`, kept for older integrations."
          },
          "btc_fiat_price_at_creation": {
            "type": "string",
            "description": "A bitcoin's price in the order's currency when it was priced."
          },
          "btc_fiat_rate_source": {
            "type": "string",
            "description": "Where the bitcoin price the order was priced at came from."
          },
          "margin_percent": {
            "type": "string",
            "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
          },
          "margin_amount_sats": {
            "type": "integer",
            "description": "The sats `margin_percent` comes to."
          },
          "settlement_amount_sats": {
            "type": "integer",
            "description": "The sats the merchant receives."
          },
          "merchant": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "client_type": {
                "type": "string",
                "description": "erp, privapaid or api: its plan's. Every merchant is erp but a PrivaPaid channel or a merchant on an API plan, which sells through its own integration (no POS and no store modules); what an erp merchant has (the POS, the CRM, the online store) follows its plan, not this."
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "address": {},
              "city": {},
              "state": {
                "type": "string"
              },
              "postal_code": {},
              "status": {
                "type": "string"
              },
              "time_zone": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "conversion_fee_percent": {
                "type": "number"
              },
              "locale": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "tip_options": {
                "type": "array",
                "items": {}
              },
              "logo_url": {},
              "images": {
                "type": "array",
                "items": {}
              },
              "taxes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "rate": {
                      "type": "string",
                      "description": "A percentage, as a decimal string"
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  }
                },
                "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
              }
            },
            "description": "The merchant, in short."
          },
          "invoice": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string"
              },
              "livemode": {
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "payment_method": {
                "type": "string"
              },
              "amount_sats": {
                "type": "integer"
              },
              "status": {
                "type": "string"
              },
              "expires_at": {
                "type": "string"
              },
              "paid_at": {
                "type": "string"
              },
              "order_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "payment_request": {
                "type": "string"
              },
              "payment_hash": {
                "type": "string"
              },
              "expired": {
                "type": "boolean"
              },
              "time_until_expiry": {
                "type": "integer"
              },
              "metadata": {
                "type": "object",
                "properties": {
                  "left_to_pay_cents": {
                    "type": "integer"
                  }
                }
              }
            },
            "description": "The order's latest invoice. Present on create with generate_invoice, and on a read unless expand leaves it out."
          },
          "payment": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string"
              },
              "livemode": {
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "amount_sats": {
                "type": "integer"
              },
              "preimage": {
                "type": "string",
                "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
              },
              "confirmed_at": {
                "type": "string"
              },
              "order_id": {
                "type": "string"
              },
              "invoice_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "properties": {}
              },
              "payment_hash": {
                "type": "string"
              },
              "settled_at": {
                "type": "string"
              },
              "usd_value_at_payment": {
                "type": "string",
                "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                "deprecated": true
              },
              "usd_variance_cents": {
                "type": "integer",
                "deprecated": true,
                "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents."
              },
              "variance_percentage": {
                "type": "string",
                "description": "`fiat_variance_cents` as a percent of what the payment was charged."
              },
              "btc_fiat_price_at_payment": {
                "type": "string",
                "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
              },
              "fiat_value_at_payment": {
                "type": "string",
                "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
              },
              "fiat_variance_cents": {
                "type": "integer",
                "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
              },
              "confirmations": {
                "type": "integer"
              },
              "required_confirmations": {
                "type": "integer"
              },
              "flagged_for_review": {
                "type": "boolean"
              },
              "flag": {}
            },
            "description": "The payment that paid it. null until paid."
          }
        }
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"invoice\"."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test invoice."
          },
          "id": {
            "type": "string",
            "description": "The invoice's id: what GET /api/v1/m/invoices/{id}/status asks about."
          },
          "payment_method": {
            "type": "string",
            "enum": [
              "lightning",
              "onchain"
            ],
            "description": "lightning or onchain."
          },
          "amount_sats": {
            "type": "integer",
            "description": "What the customer pays, in sats."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "expired",
              "cancelled"
            ],
            "description": "pending: waiting to be paid. paid: the money arrived. expired: it ran out unpaid; make the next one with POST /api/v1/m/invoices/generate. cancelled: its order was cancelled."
          },
          "expires_at": {
            "type": "string",
            "description": "When it runs out. A Lightning invoice lasts minutes."
          },
          "paid_at": {
            "description": "When it was paid. null until then."
          },
          "order_id": {
            "type": "string",
            "description": "The order it is for."
          },
          "created_at": {
            "type": "string",
            "description": "When it was made."
          },
          "updated_at": {
            "type": "string",
            "description": "When it last changed."
          },
          "payment_request": {
            "type": "string",
            "description": "What the customer pays: a BOLT11 string for Lightning, a bitcoin: URI for on-chain. Show it as a QR code."
          },
          "payment_hash": {
            "type": "string",
            "description": "The Lightning invoice's payment hash."
          },
          "expired": {
            "type": "boolean",
            "description": "true once it ran out."
          },
          "time_until_expiry": {
            "type": "integer",
            "description": "Seconds left before it runs out."
          },
          "metadata": {
            "type": "object",
            "properties": {
              "left_to_pay_cents": {
                "type": "integer"
              }
            },
            "description": "The order's metadata."
          },
          "order": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string"
              },
              "livemode": {
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "order_number": {
                "type": "string"
              },
              "total_amount_cents": {
                "type": "integer",
                "description": "What the customer pays, tax included."
              },
              "tax_amount_cents": {
                "type": "integer",
                "description": "The tax inside the total."
              },
              "discount_amount_cents": {
                "type": "integer",
                "description": "What discounts took off."
              },
              "total_amount_sats": {
                "type": "integer"
              },
              "status": {
                "type": "string"
              },
              "merchant_id": {
                "type": "string"
              },
              "location_id": {
                "type": "string"
              },
              "price_list_id": {},
              "wallet_id": {
                "type": "string"
              },
              "discount_id": {},
              "api_token_id": {
                "type": "string",
                "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "tender_type": {
                "type": "string",
                "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
              },
              "cash_paid_at": {},
              "cash_recorded_by": {},
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "price_cents": {
                      "type": "integer"
                    },
                    "qty": {
                      "type": "integer"
                    },
                    "line_total_cents": {
                      "type": "integer"
                    },
                    "product_id": {
                      "type": "string",
                      "description": "One of the merchant's products. Its name and price fill the item when not given."
                    },
                    "sku_id": {
                      "type": "string",
                      "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                    },
                    "tax_amount_cents": {
                      "type": "integer",
                      "description": "The tax inside the total."
                    },
                    "tax_details": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "string",
                            "description": "A percentage, as a decimal string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          },
                          "tax_id": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "currency": {
                "type": "string"
              },
              "customer_email": {},
              "customer_name": {},
              "customer_phone": {},
              "shipping_address": {},
              "notes": {},
              "metadata": {
                "type": "object",
                "properties": {
                  "pos_sale_id": {
                    "type": "string"
                  }
                }
              },
              "itemized": {
                "type": "boolean"
              },
              "subtotal_amount_cents": {
                "type": "integer"
              },
              "tax_details": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "rate": {
                      "type": "string",
                      "description": "A percentage, as a decimal string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    }
                  }
                }
              },
              "payment_link_url": {
                "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
              },
              "payment_link_created_at": {},
              "expires_at": {},
              "payment_email_sent_at": {
                "description": "When the order's payment link was last emailed to the customer."
              },
              "last_reminder_sent_at": {
                "description": "When the last payment reminder was emailed."
              },
              "reminders": {
                "type": "object",
                "properties": {
                  "planned": {
                    "type": "integer"
                  },
                  "sent": {
                    "type": "integer"
                  },
                  "next_at": {}
                },
                "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
              },
              "delivery_status": {},
              "pay_at_pickup_at": {},
              "pickup_location": {},
              "shipped_at": {},
              "delivered_at": {},
              "delivery_note": {},
              "receipt_url": {
                "description": "The customer's receipt page, once paid; null before."
              },
              "po_number": {
                "type": "string",
                "description": "The same as `order_number`, kept for older integrations."
              },
              "btc_fiat_price_at_creation": {
                "type": "string"
              },
              "btc_fiat_rate_source": {
                "type": "string",
                "description": "Where the bitcoin price the order was priced at came from."
              }
            },
            "description": "Its order, in short."
          }
        }
      },
      "InvoiceStatus": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"invoice_status\"."
          },
          "id": {
            "type": "string",
            "description": "The invoice's id."
          },
          "order_id": {
            "type": "string",
            "description": "Its order."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test invoice."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "expired",
              "cancelled"
            ],
            "description": "pending, paid, expired or cancelled."
          },
          "paid": {
            "type": "boolean",
            "description": "true once the money arrived. Only then hand over the goods."
          },
          "expired": {
            "type": "boolean",
            "description": "true once the invoice ran out. Ask once more before making a new one: a payment can land as it expires."
          },
          "wallet_reachable": {
            "type": "boolean",
            "description": "false when the wallet was asked just now and didn't answer. Then paid: false means not known yet: keep asking."
          },
          "paid_at": {
            "type": "string",
            "description": "When it was paid."
          },
          "expires_at": {
            "type": "string",
            "description": "When it runs out."
          },
          "payment_method": {
            "type": "string",
            "enum": [
              "lightning",
              "onchain"
            ],
            "description": "lightning or onchain."
          },
          "amount_sats": {
            "type": "integer",
            "description": "What was asked, in sats."
          },
          "amount_paid_sats": {
            "type": "integer",
            "description": "What arrived, in sats."
          },
          "receipt_url": {
            "type": "string",
            "description": "The customer's receipt page, once paid; null before."
          },
          "payment": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string"
              },
              "livemode": {
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "amount_sats": {
                "type": "integer"
              },
              "preimage": {
                "type": "string",
                "description": "The Lightning payment's preimage, its proof of payment (null for cash, and for a Lightning payment that its wallet's provider confirmed over its own API, such as Strike)"
              },
              "confirmed_at": {
                "type": "string"
              },
              "order_id": {
                "type": "string"
              },
              "invoice_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "properties": {}
              },
              "payment_hash": {
                "type": "string"
              },
              "settled_at": {
                "type": "string"
              },
              "usd_value_at_payment": {
                "type": "string",
                "description": "Deprecated: the same as fiat_value_at_payment, in the merchant's currency (`currency`), NOT US dollars. Kept for one release; read fiat_value_at_payment.",
                "deprecated": true
              },
              "usd_variance_cents": {
                "type": "integer",
                "description": "Deprecated: the same as fiat_variance_cents, in the smallest unit of the merchant's currency (`currency`), NOT US cents. Kept for one release; read fiat_variance_cents.",
                "deprecated": true
              },
              "variance_percentage": {
                "type": "string",
                "description": "`fiat_variance_cents` as a percent of what the payment was charged."
              },
              "btc_fiat_price_at_payment": {
                "type": "string",
                "description": "A bitcoin's price in the merchant's currency (`currency`) when it was paid."
              },
              "fiat_value_at_payment": {
                "type": "string",
                "description": "What the payment was worth when it was paid, in the merchant's currency (`currency`), in its units (a decimal string)."
              },
              "fiat_variance_cents": {
                "type": "integer",
                "description": "How far fiat_value_at_payment moved from what the payment was charged, in the smallest unit of the merchant's currency (`currency`); a loss is negative."
              },
              "confirmations": {
                "type": "integer"
              },
              "required_confirmations": {
                "type": "integer"
              },
              "flagged_for_review": {
                "type": "boolean"
              },
              "flag": {},
              "order": {
                "type": "object",
                "properties": {
                  "object": {
                    "type": "string"
                  },
                  "livemode": {
                    "type": "boolean"
                  },
                  "id": {
                    "type": "string"
                  },
                  "order_number": {
                    "type": "string"
                  },
                  "total_amount_cents": {
                    "type": "integer",
                    "description": "What the customer pays, tax included."
                  },
                  "tax_amount_cents": {
                    "type": "integer",
                    "description": "The tax inside the total."
                  },
                  "discount_amount_cents": {
                    "type": "integer",
                    "description": "What discounts took off."
                  },
                  "total_amount_sats": {
                    "type": "integer"
                  },
                  "status": {
                    "type": "string"
                  },
                  "merchant_id": {
                    "type": "string"
                  },
                  "location_id": {
                    "type": "string"
                  },
                  "price_list_id": {},
                  "wallet_id": {
                    "type": "string"
                  },
                  "discount_id": {},
                  "api_token_id": {
                    "type": "string",
                    "description": "The API key the order was made with; null for one made elsewhere (the portal, a website, Ubicada)."
                  },
                  "created_at": {
                    "type": "string"
                  },
                  "updated_at": {
                    "type": "string"
                  },
                  "tender_type": {
                    "type": "string",
                    "description": "How the order is paid: bitcoin (Lightning or on-chain), cash recorded at the POS, or card on the merchant's own payment gateway"
                  },
                  "cash_paid_at": {},
                  "cash_recorded_by": {},
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "price_cents": {
                          "type": "integer"
                        },
                        "qty": {
                          "type": "integer"
                        },
                        "line_total_cents": {
                          "type": "integer"
                        },
                        "product_id": {
                          "type": "string",
                          "description": "One of the merchant's products. Its name and price fill the item when not given."
                        },
                        "sku_id": {
                          "type": "string",
                          "description": "One of the merchant's SKUs (the catalog's products[].skus). It names its product by itself and fills the item's name and price when not given. Without it, an item naming a product is that product's default SKU."
                        },
                        "tax_amount_cents": {
                          "type": "integer",
                          "description": "The tax inside the total."
                        },
                        "tax_details": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "rate": {
                                "type": "string",
                                "description": "A percentage, as a decimal string"
                              },
                              "amount_cents": {
                                "type": "integer"
                              },
                              "tax_id": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "total_amount_sats": {
                          "type": "integer"
                        },
                        "margin_percent": {
                          "type": "string",
                          "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                        },
                        "margin_amount_sats": {
                          "type": "integer",
                          "description": "The sats `margin_percent` comes to."
                        },
                        "settlement_amount_sats": {
                          "type": "integer",
                          "description": "The sats left after `margin_amount_sats`."
                        },
                        "refund_status": {
                          "type": "string"
                        },
                        "refunded_qty": {
                          "type": "integer",
                          "description": "How many of its units were refunded"
                        },
                        "refunded_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "currency": {
                    "type": "string"
                  },
                  "customer_email": {},
                  "customer_name": {},
                  "customer_phone": {},
                  "shipping_address": {},
                  "notes": {},
                  "metadata": {
                    "type": "object",
                    "properties": {
                      "pos_sale_id": {
                        "type": "string"
                      }
                    }
                  },
                  "itemized": {
                    "type": "boolean"
                  },
                  "subtotal_amount_cents": {
                    "type": "integer"
                  },
                  "tax_details": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "rate": {
                          "type": "string",
                          "description": "A percentage, as a decimal string"
                        },
                        "amount_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "payment_link_url": {
                    "description": "The product's payment link (/pay/:slug): a URL to send a customer that opens the hosted checkout at this price. Null while the product is not active."
                  },
                  "payment_link_created_at": {},
                  "expires_at": {},
                  "payment_email_sent_at": {
                    "description": "When the order's payment link was last emailed to the customer."
                  },
                  "last_reminder_sent_at": {
                    "description": "When the last payment reminder was emailed."
                  },
                  "reminders": {
                    "type": "object",
                    "properties": {
                      "planned": {
                        "type": "integer"
                      },
                      "sent": {
                        "type": "integer"
                      },
                      "next_at": {}
                    },
                    "description": "The payment reminders emailed for an order sent by payment link: how many are planned, how many were sent, and when the next goes."
                  },
                  "delivery_status": {},
                  "pay_at_pickup_at": {},
                  "pickup_location": {},
                  "shipped_at": {},
                  "delivered_at": {},
                  "delivery_note": {},
                  "receipt_url": {
                    "type": "string",
                    "description": "The customer's receipt page, once paid; null before."
                  },
                  "po_number": {
                    "type": "string",
                    "description": "The same as `order_number`, kept for older integrations."
                  },
                  "btc_fiat_price_at_creation": {
                    "type": "string"
                  },
                  "btc_fiat_rate_source": {
                    "type": "string",
                    "description": "Where the bitcoin price the order was priced at came from."
                  },
                  "margin_percent": {
                    "type": "string",
                    "description": "On a paid bitcoin order or item: the margin of its product type (or the merchant's default), a percent. A reporting split of its sats, with `margin_amount_sats` and `settlement_amount_sats`; nothing is paid out by it."
                  },
                  "margin_amount_sats": {
                    "type": "integer",
                    "description": "The sats `margin_percent` comes to."
                  },
                  "settlement_amount_sats": {
                    "type": "integer",
                    "description": "The sats left after `margin_amount_sats`."
                  }
                }
              }
            },
            "description": "The payment, once paid, with its order."
          }
        }
      },
      "PaymentRequest": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"payment_request\"."
          },
          "id": {
            "type": "string",
            "description": "The invoice's id: ask GET /api/v1/m/invoices/{id}/status whether it was paid."
          },
          "order_id": {
            "type": "string",
            "description": "The order made behind the request: read it for the receipt once paid."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test request."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "expired",
              "cancelled"
            ],
            "description": "pending, paid, expired or cancelled: the invoice's."
          },
          "payment_method": {
            "type": "string",
            "enum": [
              "lightning",
              "onchain"
            ],
            "description": "lightning or onchain."
          },
          "amount_cents": {
            "type": "integer",
            "description": "What was asked, in the merchant's currency's smallest unit."
          },
          "currency": {
            "type": "string",
            "description": "The merchant's currency."
          },
          "amount_sats": {
            "type": "integer",
            "description": "What the customer pays, in sats."
          },
          "description": {
            "type": "string",
            "description": "The line's name, as you sent it."
          },
          "metadata": {
            "type": "object",
            "properties": {
              "pos_sale_id": {
                "type": "string"
              }
            },
            "description": "What you sent with it."
          },
          "created_at": {
            "type": "string",
            "description": "When it was made."
          },
          "expires_at": {
            "type": "string",
            "description": "When the invoice runs out."
          },
          "payment_request": {
            "type": "string",
            "description": "What the customer pays: a BOLT11 string, or a bitcoin: URI. Show it as a QR code."
          },
          "payment_hash": {
            "type": "string",
            "description": "The Lightning invoice's payment hash."
          }
        }
      },
      "DeviceKey": {
        "type": "object",
        "properties": {
          "api_key": {
            "type": "string",
            "description": "The device's key. Send it as Authorization: Bearer. Shown this once."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test key."
          },
          "expires_at": {
            "type": "string",
            "description": "When the key ends. Renew it before then with POST /api/v1/m/sessions/renew."
          },
          "renewable_until": {
            "type": "string",
            "description": "The last moment a renewal can move expires_at to. After it, the person signs in again."
          },
          "device_name": {
            "type": "string",
            "description": "The name you sent, as the merchant sees it beside the key."
          },
          "merchant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The merchant's id."
              },
              "name": {
                "type": "string",
                "description": "The merchant's name."
              },
              "currency": {
                "type": "string",
                "description": "The merchant's currency: every amount is in its smallest unit."
              }
            },
            "description": "The merchant the key sells for."
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The location's id."
              },
              "name": {
                "type": "string",
                "description": "The location's name."
              }
            },
            "description": "Where the device sells: its orders are placed there, and it reads that location's catalog."
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"api_token\"."
          },
          "id": {
            "type": "string",
            "description": "The key's id. Never the key itself."
          },
          "name": {
            "type": "string",
            "description": "What the key is called on the API keys page."
          },
          "token_type": {
            "type": "string",
            "description": "secret or publishable."
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test key."
          },
          "security_group": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "admin": {
                "type": "boolean"
              }
            },
            "description": "The security group the key acts in."
          },
          "permissions": {
            "type": "object",
            "properties": {
              "access": {
                "type": "string"
              },
              "api_request_logs": {
                "type": "string"
              },
              "api_tokens": {
                "type": "string"
              },
              "checkout_sessions": {
                "type": "string"
              },
              "costs": {
                "type": "string"
              },
              "customer_notes": {
                "type": "string"
              },
              "customers": {
                "type": "string"
              },
              "discounts": {
                "type": "string"
              },
              "employees": {
                "type": "string"
              },
              "integrations": {
                "type": "string"
              },
              "inventory": {
                "type": "string"
              },
              "invoices": {
                "type": "string"
              },
              "kitchen": {
                "type": "string"
              },
              "locations": {
                "type": "string"
              },
              "loyalty": {
                "type": "string"
              },
              "media_keys": {
                "type": "string"
              },
              "merchant_documents": {
                "type": "string"
              },
              "onchain_payments": {
                "type": "string"
              },
              "orders": {
                "type": "string"
              },
              "payment_gateways": {
                "type": "string"
              },
              "payment_requests": {
                "type": "string"
              },
              "payments": {
                "type": "string"
              },
              "pos": {
                "type": "string"
              },
              "product_types": {
                "type": "string"
              },
              "products": {
                "type": "string"
              },
              "quick_charges": {
                "type": "string"
              },
              "refund_requests": {
                "type": "string"
              },
              "refunds": {
                "type": "string"
              },
              "reports": {
                "type": "string"
              },
              "security_groups": {
                "type": "string"
              },
              "settings": {
                "type": "string"
              },
              "stock_counts": {
                "type": "string"
              },
              "taxes": {
                "type": "string",
                "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
              },
              "team": {
                "type": "string"
              },
              "timesheets": {
                "type": "string"
              },
              "users": {
                "type": "string"
              },
              "wallets": {
                "type": "string"
              },
              "webhooks": {
                "type": "string"
              }
            },
            "description": "Each resource the key reads or manages."
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "For a POS key: the calls it can make, as controller#action. null for a key held to no list."
          },
          "pos": {
            "type": "boolean",
            "description": "true for a POS key."
          },
          "device_name": {
            "type": "string",
            "description": "For a device's key: the device's name."
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "description": "For a POS key: where it sells."
          },
          "created_at": {
            "type": "string",
            "description": "When it was made. For a device's key, when the device signed in."
          },
          "expires_at": {
            "type": "string",
            "description": "When it ends. null for a key that never ends."
          },
          "renewable_until": {
            "type": "string",
            "description": "For a device's key: the last moment a renewal can move expires_at to. null for any other key."
          }
        }
      },
      "Catalog": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "description": "Always \"catalog\"."
          },
          "merchant_id": {
            "type": "string",
            "description": "The merchant."
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "time_zone": {
                "type": "string"
              }
            },
            "description": "The location whose catalog this is: the key's."
          },
          "catalog_version": {
            "type": "string",
            "description": "Changes whenever anything in the catalog does. Compare it with GET /api/v1/m/catalog/version."
          },
          "catalog_refresh_minutes": {
            "type": "integer",
            "description": "How often to check the version."
          },
          "product_types": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "position": {
                  "type": "integer"
                },
                "color": {
                  "type": "string"
                },
                "images": {
                  "type": "array",
                  "items": {}
                },
                "products": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "product_id": {
                        "type": "string",
                        "description": "One of the merchant's products. Its name and price fill the item when not given."
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {},
                      "price_cents": {
                        "type": "integer",
                        "description": "Its default SKU's price, what it sells at named alone, kept for POS apps that read it. Each SKU's own is in skus."
                      },
                      "currency": {
                        "type": "string"
                      },
                      "sku": {},
                      "formatted_price": {
                        "type": "string",
                        "description": "Its default SKU's price, formatted."
                      },
                      "image_url": {},
                      "image_medium_url": {},
                      "images": {
                        "type": "array",
                        "items": {}
                      },
                      "position": {
                        "type": "integer"
                      },
                      "skus": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "location_id": {
                              "type": "string"
                            },
                            "code": {
                              "description": "Unique across the merchant's SKUs. The default SKU's is the product's sku."
                            },
                            "barcode": {},
                            "name": {
                              "type": "string",
                              "description": "Its label, else the product's name and its modifiers' values (\"T-shirt — Black / M\")."
                            },
                            "price_cents": {
                              "type": "integer",
                              "description": "What an item of it costs, in the subunits of the merchant's currency. Every price is a SKU's: a product has none of its own."
                            },
                            "default": {
                              "type": "boolean",
                              "description": "The product's default SKU: an item naming the product alone is this SKU."
                            },
                            "status": {
                              "type": "string"
                            },
                            "modifiers": {
                              "type": "array",
                              "items": {},
                              "description": "Labels, up to five, such as Color: Black."
                            },
                            "weight_grams": {
                              "description": "Weight in whole grams, or null."
                            },
                            "length_mm": {
                              "description": "Length in whole millimetres, or null."
                            },
                            "width_mm": {
                              "description": "Width in whole millimetres, or null."
                            },
                            "height_mm": {
                              "description": "Height in whole millimetres, or null."
                            },
                            "images": {
                              "type": "array",
                              "items": {}
                            },
                            "choice_name": {
                              "type": "string",
                              "description": "What it is called among its product's choices: its label or its modifiers' values (\"Large\", \"Black / M\"), else \"Regular\" for the default SKU until it is labelled."
                            },
                            "line_name": {
                              "type": "string",
                              "description": "What a line of it is called on a sale: the product's name, then its variant (\"Latte · Large\"); the product's name alone for a SKU with no variant."
                            },
                            "sold_out": {
                              "type": "boolean",
                              "description": "None on hand at the location while the merchant tracks inventory and the product tracks its stock: shown, not sold. A product whose every SKU is sold out is listed, every SKU sold out."
                            },
                            "held_for_pickup": {
                              "type": "integer"
                            }
                          }
                        },
                        "description": "The SKUs it is sold as at the catalog's location: every active one there, cheapest first."
                      }
                    }
                  }
                },
                "tax_ids": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The merchant's taxes this item owes, by id ([] for none). Send it on every item or on none. When sent, the server works out each item's taxes and the order's tax_amount_cents, discount_amount_cents, subtotal_amount_cents and total_amount_cents; any of those sent as well must match, or the order is refused (422)."
                }
              }
            },
            "description": "The groups, each with its products, and each product with its SKUs."
          },
          "taxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "rate": {
                  "type": "string",
                  "description": "A percentage, as a decimal string"
                },
                "enabled": {
                  "type": "boolean"
                }
              }
            },
            "description": "Each tax the item was charged, frozen at the moment of sale (negated on a refund sale)"
          },
          "discounts": {
            "type": "array",
            "items": {},
            "description": "The merchant's discounts a line may take."
          },
          "livemode": {
            "type": "boolean",
            "description": "The key's mode. A POS key reads the store's own catalog in test mode too."
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "The key is missing, wrong, expired or revoked: `missing_token`, `invalid_token`, `token_expired`, `token_revoked`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "invalid_token",
                "message": "Invalid or revoked API token",
                "status": 401,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The key may not do this: its security group doesn't allow it (`forbidden`), or the merchant can't act now (`merchant_not_operational`: a live key before the account is approved, or a suspended account).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "forbidden",
                "status": 403,
                "details": {
                  "resource": "invoices",
                  "access": "read"
                },
                "message": "This key's security group doesn't read invoices. GET /api/v1/m/api_token lists what it may do; the merchant changes it in Settings → Security groups.",
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "BadRequest": {
        "description": "The body couldn't be read: `invalid_json` for JSON that doesn't parse, `bad_request` for a body of the wrong shape.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "invalid_json",
                "message": "The request body is not valid JSON.",
                "status": 400,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "The same `Idempotency-Key` is still being answered (`idempotency_in_progress`): wait a moment and send it again.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "idempotency_in_progress",
                "message": "A request with this Idempotency-Key is still in progress.",
                "status": 409,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "No such record for this merchant in the key's mode: `not_found`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "not_found",
                "message": "Order not found",
                "status": 404,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The request can't be done as sent: `validation_error` (with `details` and `fields`), `unknown_parameter`, `invalid_argument`, `invalid_amount`, `invalid_filter`, or a code of the endpoint's own.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "validation_error",
                "message": "Validation failed",
                "status": 422,
                "details": [
                  "Total amount cents must be greater than 0"
                ],
                "fields": {
                  "total_amount_cents": [
                    "must be greater than 0"
                  ]
                },
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests: `rate_limit_exceeded`. Wait `Retry-After` seconds.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "rate_limit_exceeded",
                "message": "Rate limit exceeded. Please retry after 12 seconds.",
                "status": 429,
                "retry_after": 12,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "ProviderError": {
        "description": "The merchant's wallet provider couldn't be reached (`provider_error`). Nothing was lost: retry.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "provider_error",
                "message": "Payment provider is temporarily unavailable. Please try again.",
                "status": 502,
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      },
      "Unavailable": {
        "description": "SatsRail can't do this right now: `service_unavailable`, or `price_unavailable` when the bitcoin price can't be read. Retry in a minute.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "price_unavailable",
                "status": 503,
                "message": "The bitcoin price can't be read right now, so this can't be priced. Try again in a minute.",
                "request_id": "5f0c2a1e-7b1d-4c58-9d0e-2f6a3f0b9c11"
              }
            }
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Any string of yours, one for each thing you make. Sent again with the same request, it gets the first answer again for 24 hours, so a retry after a timeout never makes a second order."
      },
      "Page": {
        "name": "page",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "description": "Which page."
      },
      "PerPage": {
        "name": "per_page",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        },
        "description": "How many a page."
      }
    }
  },
  "tags": [
    {
      "name": "Sessions",
      "description": "Sign a person in on a POS device, keep the device's key, and sign the device out."
    },
    {
      "name": "API token",
      "description": "The key you are calling with."
    },
    {
      "name": "Merchant",
      "description": "The merchant a key belongs to."
    },
    {
      "name": "Locations",
      "description": "Where the merchant sells."
    },
    {
      "name": "Catalog",
      "description": "Everything a POS sells, in one call."
    },
    {
      "name": "Products",
      "description": "The merchant's products."
    },
    {
      "name": "Product types",
      "description": "The groups products are filed under."
    },
    {
      "name": "Orders",
      "description": "What a customer is buying, and whether it is paid."
    },
    {
      "name": "Invoices",
      "description": "What the customer pays, a Lightning invoice or a bitcoin address."
    },
    {
      "name": "Payment requests",
      "description": "An order and its invoice in one call, from an amount."
    },
    {
      "name": "Payments",
      "description": "Money that arrived."
    },
    {
      "name": "Checkout sessions",
      "description": "A hosted page where a customer pays."
    },
    {
      "name": "Webhooks",
      "description": "Where SatsRail tells your server what happened."
    },
    {
      "name": "Sales",
      "description": "Every paid order, kept for good."
    },
    {
      "name": "Wallets",
      "description": "Where the merchant is paid. Read-only."
    },
    {
      "name": "Media keys",
      "description": "Keys that unlock paid content."
    },
    {
      "name": "Access",
      "description": "Checking that a buyer paid for content."
    }
  ],
  "security": [
    {
      "secretKey": []
    }
  ]
}