{"openapi":"3.1.0","info":{"title":"easyway merchant API","version":"1","description":"Non-custodial crypto payments: create invoices that are paid straight to your own wallet, and receive signed webhooks. The platform holds no funds and no keys; there are no balances and no payouts, and no fee is taken from a payment. Set a receiving wallet per network in the dashboard before creating live invoices. Human-readable guide with code samples: https://new.easyway.cash/docs"},"externalDocs":{"description":"API documentation","url":"https://new.easyway.cash/docs"},"servers":[{"url":"https://api.easyway.cash"}],"security":[{"bearer":[]},{"apiKeyHeader":[]}],"tags":[{"name":"Invoices","description":"Ask a customer for a payment and follow it to paid."},{"name":"Transactions","description":"Transfers that reached one of your wallets but could not be tied to exactly one invoice."},{"name":"Account","description":"Your plan and usage, indicative rates and the coins you can accept today."},{"name":"Customers","description":"The people you invoice: create or update by your own id or e-mail, and look one up with its invoices."},{"name":"Refunds","description":"Request a refund of a paid invoice. You approve it and send the coins from your own wallet in the dashboard; the platform never moves funds."},{"name":"Subscriptions","description":"Recurring invoices on a plan made in the dashboard."},{"name":"Reports","description":"Totals, a period series and breakdowns for accounting."},{"name":"Metering","description":"Usage-based billing: consumers (apps, AI agents) prepay a USD balance in crypto, your server deducts each use. Products and prices are set in the dashboard (Paid API & agents)."},{"name":"x402","description":"HTTP 402 pay-per-request for agents without an account: answer 402 with payment requirements, then verify + settle the X-PAYMENT header. One payment unlocks one request; it is paid straight to your wallet."}],"paths":{"/v1/invoices":{"post":{"tags":["Invoices"],"summary":"Create an invoice","operationId":"createInvoice","x-required-scope":"invoices:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes a retry safe: the same key with the same body replays the first response (with `Idempotent-Replayed: true`) instead of creating a second object. A key that does not match the pattern is rejected with 400 `{ error: \"bad_request\", message: \"invalid_idempotency_key\" }`.","schema":{"type":"string","pattern":"^[A-Za-z0-9_\\-:.]{8,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCreate"}}}},"description":"Live mode needs a receiving wallet on the coin's network (set in the dashboard) and counts towards the plan's monthly invoice allowance. On networks where invoices share one address and are matched by exact amount, pay_amount can be slightly higher than the amount requested: always show pay_amount to the payer, or redirect to payment_url.","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}},"headers":{"Idempotent-Replayed":{"description":"\"true\" when this is the stored response of an earlier request with the same Idempotency-Key.","schema":{"type":"string","enum":["true"]}}}},"400":{"description":"validation_error, invalid_json, invalid_idempotency_key, unknown_currency, unknown_asset, asset_not_allowed, amount_too_small, amount_too_large or amount_below_minimum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"plan_invoice_limit_reached (this month's live-invoice allowance of the plan is used up)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_wallets_configured, wallet_not_configured, or request_in_progress (same Idempotency-Key still running)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"idempotency_key_reused (same key, different body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}},"503":{"description":"rate_unavailable or too_many_open_invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Invoices"],"summary":"List invoices","operationId":"listInvoices","x-required-scope":"invoices:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"description":"1-based; newest first."},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or after this UTC day (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or before this UTC day (YYYY-MM-DD, inclusive). Must not be before `from`."},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","confirming","paid","underpaid","expired","cancelled"]}},{"name":"asset","in":"query","schema":{"type":"string"},"description":"A coin id; ids that are no longer enabled are accepted too."},{"name":"order_id","in":"query","schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","total","page","page_size"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"total":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/invoices/{id}":{"get":{"tags":["Invoices"],"summary":"Retrieve an invoice","operationId":"getInvoice","x-required-scope":"invoices:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^inv_[0-9A-Za-z]{22}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"invoice_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/invoices/{id}/cancel":{"post":{"tags":["Invoices"],"summary":"Cancel a pending invoice","operationId":"cancelInvoice","x-required-scope":"invoices:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^inv_[0-9A-Za-z]{22}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"invoice_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"invoice_not_pending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/transactions/unmatched":{"get":{"tags":["Transactions"],"summary":"List unmatched transactions","operationId":"listUnmatchedTransactions","x-required-scope":"transactions:read","description":"Confirmed live transfers to one of your shared addresses that could not be tied to exactly one invoice. They are never guessed: assign one to an invoice, or ignore it, in the dashboard. The coins are in your wallet either way.","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"description":"1-based; newest first."},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or after this UTC day (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or before this UTC day (YYYY-MM-DD, inclusive). Must not be before `from`."},{"name":"status","in":"query","schema":{"type":"string","enum":["open","assigned","ignored"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","total","page","page_size"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/UnmatchedTransaction"}},"total":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/account":{"get":{"tags":["Account"],"summary":"Plan and usage","operationId":"getAccount","description":"Any key. The account's plan and how much of this month's live-invoice allowance is used.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/rates":{"get":{"tags":["Account"],"summary":"Indicative USD rates","operationId":"getRates","description":"Any key. USD per unit; stablecoins are pinned to 1. An invoice locks its own rate when the payer picks a coin.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/assets":{"get":{"tags":["Account"],"summary":"Coins and networks you can accept","operationId":"getAssets","description":"Any key. fee_bps is always 0: payments go straight to your wallet and no fee is taken from them.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["fee_bps","data"],"properties":{"fee_bps":{"type":"integer","const":0},"data":{"type":"array","items":{"$ref":"#/components/schemas/Asset"}}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/customers":{"post":{"tags":["Customers"],"summary":"Create or update a customer","operationId":"upsertCustomer","x-required-scope":"invoices:write","description":"Upsert: the customer is found by external_id, else by email, and created if there is none. Fields you send replace the stored ones. One of external_id or email is required. 201 when the customer was created, 200 when an existing one was updated (same body).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerInput"}}}},"responses":{"200":{"description":"Updated an existing customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"validation_error or customer_id_or_email_required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"customer_external_id_taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}},"get":{"tags":["Customers"],"summary":"List customers","operationId":"listCustomers","x-required-scope":"invoices:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"description":"1-based; newest first."},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"email","in":"query","schema":{"type":"string","maxLength":190},"description":"Exact match (case-insensitive)."},{"name":"external_id","in":"query","schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","total","page","page_size"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"total":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/customers/{id}":{"get":{"tags":["Customers"],"summary":"Retrieve a customer with its invoices","operationId":"getCustomer","x-required-scope":"invoices:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"cus_… or your own external_id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerWithInvoices"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"customer_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/refunds":{"post":{"tags":["Refunds"],"summary":"Request a refund","operationId":"createRefund","x-required-scope":"invoices:write","description":"Records a refund request (status requested) for a paid invoice, on the network the payment came from. Approving it and sending the coins from your own wallet happen in the dashboard.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes a retry safe: the same key with the same body replays the first response (with `Idempotent-Replayed: true`) instead of creating a second object. A key that does not match the pattern is rejected with 400 `{ error: \"bad_request\", message: \"invalid_idempotency_key\" }`.","schema":{"type":"string","pattern":"^[A-Za-z0-9_\\-:.]{8,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}},"headers":{"Idempotent-Replayed":{"description":"\"true\" when this is the stored response of an earlier request with the same Idempotency-Key.","schema":{"type":"string","enum":["true"]}}}},"400":{"description":"validation_error, invalid_idempotency_key, invoice_not_paid, invalid_refund_address, nothing_left_to_refund or refund_exceeds_received","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"invoice_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"request_in_progress (same Idempotency-Key still running)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"idempotency_key_reused (same key, different body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}},"get":{"tags":["Refunds"],"summary":"List refunds","operationId":"listRefunds","x-required-scope":"invoices:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"description":"1-based; newest first."},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or after this UTC day (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Created on or before this UTC day (YYYY-MM-DD, inclusive). Must not be before `from`."},{"name":"status","in":"query","schema":{"type":"string","enum":["requested","approved","sent","rejected","cancelled"]}},{"name":"invoice","in":"query","schema":{"type":"string","pattern":"^inv_[0-9A-Za-z]{22}$"},"description":"Only refunds of this invoice."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","total","page","page_size"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}},"total":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/refunds/{id}":{"get":{"tags":["Refunds"],"summary":"Retrieve a refund","operationId":"getRefund","x-required-scope":"invoices:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^rfd_[0-9A-Za-z]{22}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"refund_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/subscription-plans":{"get":{"tags":["Subscriptions"],"summary":"List active subscription plans","operationId":"listSubscriptionPlans","x-required-scope":"invoices:read","description":"Plans are created in the dashboard. Not paginated.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionPlan"}}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/subscriptions":{"post":{"tags":["Subscriptions"],"summary":"Subscribe a customer to a plan","operationId":"createSubscription","x-required-scope":"invoices:write","description":"Creates the subscription (status pending) and its first invoice. Send the customer to pay_url. The customer must end up with an e-mail address.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes a retry safe: the same key with the same body replays the first response (with `Idempotent-Replayed: true`) instead of creating a second object. A key that does not match the pattern is rejected with 400 `{ error: \"bad_request\", message: \"invalid_idempotency_key\" }`.","schema":{"type":"string","pattern":"^[A-Za-z0-9_\\-:.]{8,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}},"headers":{"Idempotent-Replayed":{"description":"\"true\" when this is the stored response of an earlier request with the same Idempotency-Key.","schema":{"type":"string","enum":["true"]}}}},"400":{"description":"validation_error, invalid_idempotency_key, customer_required or customer_email_required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"plan_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"request_in_progress (same Idempotency-Key still running)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"idempotency_key_reused (same key, different body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}},"get":{"tags":["Subscriptions"],"summary":"List subscriptions","operationId":"listSubscriptions","x-required-scope":"invoices:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1},"description":"1-based; newest first."},{"name":"pageSize","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","active","past_due","expired","cancelled"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","total","page","page_size"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"total":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"}}}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/subscriptions/{id}":{"get":{"tags":["Subscriptions"],"summary":"Retrieve a subscription","operationId":"getSubscription","x-required-scope":"invoices:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^sub_[0-9A-Za-z]{22}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"subscription_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/subscriptions/{id}/cancel":{"post":{"tags":["Subscriptions"],"summary":"Cancel a subscription","operationId":"cancelSubscription","x-required-scope":"invoices:write","description":"at_period_end true (default): an active subscription runs to the end of the paid period, then ends; any other status is cancelled at once. false: cancelled at once.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^sub_[0-9A-Za-z]{22}$"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"at_period_end":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"validation_error or subscription_already_ended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"subscription_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/metering/charge":{"post":{"tags":["Metering"],"summary":"Charge a consumer for usage","operationId":"charge","x-required-scope":"invoices:write","description":"Deducts units × the product's price from the consumer's prepaid balance, atomically. Name the consumer by id (con_…), key (ck_…) or your external_id. request_id makes retries safe: the same id is never charged twice (duplicate: true). 402 when the balance is too low — nothing is charged.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product"],"properties":{"consumer":{"type":"string"},"consumer_key":{"type":"string"},"external_id":{"type":"string"},"product":{"type":"string","description":"Product id or slug"},"units":{"type":"string","default":"1"},"request_id":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"insufficient_balance (charged: false, cost_usd, balance_usd)","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"consumer_not_found or product_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/metering/consumers":{"post":{"tags":["Metering"],"summary":"Create a consumer","operationId":"createConsumer","x-required-scope":"invoices:write","description":"An app, customer or AI agent with its own prepaid balance. The consumer_key is returned only in this response.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"external_id":{"type":"string"},"low_balance_usd":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"consumer_exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/metering/consumers/{id}":{"get":{"tags":["Metering"],"summary":"Retrieve a consumer and its balance","operationId":"getConsumer","x-required-scope":"invoices:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^con_[0-9A-Za-z]{22}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"consumer_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/metering/consumers/{id}/topups":{"post":{"tags":["Metering"],"summary":"Create a top-up invoice","operationId":"createTopup","x-required-scope":"invoices:write","description":"An ordinary invoice (paid to your wallet). When it is paid the consumer's balance goes up by amount_usd. At least $1.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^con_[0-9A-Za-z]{22}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount_usd"],"properties":{"amount_usd":{"type":"string"},"success_url":{"type":"string","format":"uri"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"consumer_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/x402/requirements":{"post":{"tags":["x402"],"summary":"Payment requirements for one request","operationId":"x402Requirements","x-required-scope":"invoices:write","description":"Creates a 15-minute invoice for the product's price and returns an x402-style body (x402Version, accepts[] with scheme \"easyway-invoice\", one entry per coin you accept). Send it to the client with HTTP 402. The product must have x402 switched on. Each on-chain payment has the coin's minimum (about $0.50).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product","resource"],"properties":{"product":{"type":"string"},"resource":{"type":"string"},"units":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"x402_not_enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/x402/verify":{"post":{"tags":["x402"],"summary":"Verify (and settle) an X-PAYMENT header","operationId":"x402Verify","x-required-scope":"invoices:write","description":"payment: the X-PAYMENT header — base64 JSON {x402Version, scheme, payload: {invoice}} or the bare invoice id. With settle (default true) a valid payment is consumed: one payment = one request; a replay answers invalidReason payment_already_used.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["payment"],"properties":{"payment":{"type":"string"},"resource":{"type":"string"},"settle":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"isValid, invalidReason?, success?","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Validation or business-rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}},"/v1/reports":{"get":{"tags":["Reports"],"summary":"Report for a date range","operationId":"getReport","x-required-scope":"invoices:read","description":"Volume is what actually arrived (paid + underpaid), valued at each invoice's locked rate. All dates are UTC. Defaults to the last 30 days; at most 400 days. format=csv returns the period series as a CSV download; format=xlsx returns every table as a workbook download. The CSV and XLSX files keep their own column headers.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"First UTC day (YYYY-MM-DD). Default: 29 days before `to`."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Last UTC day (YYYY-MM-DD, inclusive). Default: today."},{"name":"group_by","in":"query","schema":{"type":"string","enum":["day","week","month"],"default":"day"}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv","xlsx"],"default":"json"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}},"text/csv":{"schema":{"type":"string"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"validation_error, invalid_date_range or date_range_too_long","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing scope or IP not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (300 requests per minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimited"}}}}}}}},"webhooks":{"event":{"post":{"summary":"Event delivered to your webhook URL","operationId":"webhookEvent","description":"Signed with X-Webhook-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + \".\" + raw_body)>. Reject a timestamp more than 300 seconds from now and compare in constant time. Answer 2xx within 10 seconds; failures are retried 8 times over about 45 hours. Deduplicate on the payload's `id` (evt_…), not on X-Webhook-Id: X-Webhook-Id identifies one delivery to one endpoint. Events: invoice.* (data.invoice); transaction.unmatched (data.transaction); refund.updated (data.refund, on request, approve, reject, cancel and sent); subscription.updated (data.subscription, on create, first payment / renewal, past_due, expired, cancel and resume); webhook.test (data.message). refund.updated, subscription.updated and transaction.unmatched go to account-wide endpoints only; a per-key webhook receives invoice.* events.","parameters":[{"name":"X-Webhook-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256>"},{"name":"X-Webhook-Id","in":"header","required":true,"schema":{"type":"string"},"description":"whd_… — the delivery (one event to one endpoint); the same on every retry of that delivery. Not the event id."},{"name":"X-Webhook-Event","in":"header","required":true,"schema":{"type":"string"},"description":"The event type, same as the payload's `type`."},{"name":"X-Webhook-Timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Unix seconds of this attempt, same as `t` in the signature."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the event"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"sk_live_… or sk_test_… — the key decides the mode."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key"}},"schemas":{"AssetId":{"type":"string","enum":["USDT_TRC20","USDT_BEP20","USDT_TON","USDT_ERC20","TRX","BNB","GRAM","ETH","BTC","LTC","DOGE","USDC_ERC20","USDC_BEP20","XRP","SOL","USDT_SOL","USDC_SOL","POL","USDT_POLYGON","USDC_POLYGON","AVAX","USDT_AVAX","ETH_BASE","USDC_BASE","ETH_ARB","USDT_ARB","USDC_ARB","ETH_OP","USDT_OP","USDC_OP","USDC_AVAX","DAI_ERC20","FDUSD_BEP20","DASH","SHIB_ERC20","PEPE_ERC20","BONK_SOL","NOT_TON","PYUSD_ERC20","DOGS_TON","CATI_TON","HMSTR_TON","WIF_SOL","LINK_ERC20","UNI_ERC20","AAVE_ERC20","ONDO_ERC20","ENA_ERC20","CRV_ERC20","GRT_ERC20","SKY_ERC20","USDS_ERC20","USDE_ERC20","MNT_ERC20","ARB_ERC20","WLD_ERC20","MANA_ERC20","SAND_ERC20","IMX_ERC20","GALA_ERC20","FET_ERC20","JASMY_ERC20","SPX_ERC20","XCN_ERC20","APE_ERC20","AXS_ERC20","CHZ_ERC20","1INCH_ERC20","PENDLE_ERC20","ETHFI_ERC20","ZRO_ERC20","BAT_ERC20","LPT_ERC20","ZRX_ERC20","SUSHI_ERC20","BAL_ERC20","COMP_ERC20","RPL_ERC20","ANKR_ERC20","CVX_ERC20","GLM_ERC20","CAKE_BEP20","TWT_BEP20","RENDER_SOL","JUP_SOL","PYTH_SOL","JTO_SOL","RAY_SOL","W_SOL","FARTCOIN_SOL","TRUMP_SOL","PENGU_SOL","POPCAT_SOL"],"description":"A (coin, network) pair."},"Decimal":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","maxLength":40,"description":"Amounts are decimal strings, never numbers."},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Machine-readable code, or a general class (bad_request, unauthorized, forbidden, not_found, conflict) whose specific code is in message"},"message":{"type":"string","description":"The specific code when error is a general class, e.g. invalid_api_key"},"fields":{"type":"array","items":{"type":"string"},"description":"Names of the invalid fields (validation_error only)."}}},"RateLimited":{"type":"object","required":["error"],"properties":{"error":{"type":"string","const":"rate_limited"}}},"InvoiceCreate":{"type":"object","required":["amount"],"additionalProperties":false,"properties":{"amount":{"$ref":"#/components/schemas/Decimal"},"currency":{"description":"\"USD\" (payer picks the coin) or a coin id (only that coin is accepted).","default":"USD","anyOf":[{"const":"USD"},{"$ref":"#/components/schemas/AssetId"}]},"order_id":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","minLength":1,"maxLength":500},"customer_email":{"type":"string","format":"email","maxLength":190},"customer":{"type":"object","additionalProperties":false,"properties":{"external_id":{"type":"string","minLength":1,"maxLength":128,"description":"Your own id for the customer."},"email":{"type":"string","format":"email","maxLength":190},"name":{"type":"string","minLength":1,"maxLength":120},"phone":{"type":"string","minLength":1,"maxLength":40}},"description":"Who it is for: found by external_id or email, or created."},"success_url":{"type":"string","format":"uri","maxLength":500},"cancel_url":{"type":"string","format":"uri","maxLength":500},"allowed_assets":{"type":"array","items":{"$ref":"#/components/schemas/AssetId"},"maxItems":93},"metadata":{"type":"object","maxProperties":20,"propertyNames":{"maxLength":40},"additionalProperties":{"type":"string","maxLength":500}},"lifetime":{"type":"integer","minimum":5,"maximum":1440,"description":"Minutes until an unpaid invoice expires."}}},"Invoice":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","confirming","paid","underpaid","expired","cancelled"]},"mode":{"type":"string","enum":["live","test"]},"order_id":{"type":["string","null"],"description":""},"description":{"type":["string","null"],"description":""},"amount":{"type":"string","description":"Price, in currency units"},"currency":{"type":"string"},"pay_asset":{"type":["string","null"],"description":"Set once the payer picks a coin"},"pay_amount":{"type":["string","null"],"description":"What the payer must send. On exact-amount networks it can be slightly higher than the amount requested, to make it unique: always show this value."},"pay_address":{"type":["string","null"],"description":"The merchant's own receiving wallet: a fresh address per invoice with an extended public key, otherwise one address shared by all invoices on the network."},"pay_memo":{"type":["string","null"],"description":"Non-null: the payer must attach this memo / destination tag"},"pay_network":{"type":["string","null"],"description":""},"rate":{"type":["string","null"],"description":"USD per unit, locked at selection"},"received_amount":{"type":"string"},"remaining_amount":{"type":"string"},"overpaid_amount":{"type":"string","description":"Received on top of pay_amount; \"0\" unless the payer overpaid or paid twice."},"late":{"type":"boolean","description":"true when a payment arrived after the invoice had expired or been cancelled."},"fee_amount":{"type":"string","description":"Always \"0\": no fee is taken from a payment."},"net_amount":{"type":"string","description":"Always equal to received_amount."},"customer_email":{"type":["string","null"],"description":""},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}},"payment_url":{"type":"string","format":"uri"},"expires_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"UnmatchedTransaction":{"type":"object","properties":{"id":{"type":"string","description":"utx_…"},"status":{"type":"string","enum":["open","assigned","ignored"]},"mode":{"type":"string","enum":["live","test"]},"asset":{"type":"string","description":"Coin id"},"network":{"type":["string","null"],"description":"Human-readable network name"},"address":{"type":"string","description":"Your wallet address that received the transfer"},"memo":{"type":["string","null"],"description":"Comment / destination tag on the transfer, if any"},"amount":{"type":"string"},"tx_hash":{"type":"string"},"log_index":{"type":"integer"},"from_address":{"type":["string","null"],"description":""},"reason":{"type":"string","enum":["memo_missing","memo_unknown","no_invoice_for_amount","ambiguous_amount"]},"block_time":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"Account":{"type":"object","required":["plan","usage"],"properties":{"plan":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"expires_at":{"type":["string","null"],"format":"date-time","description":"null on the Free plan."},"invoices_per_month":{"type":["integer","null"],"description":"Live invoices per calendar month (UTC); null = unlimited."}}},"usage":{"type":"object","properties":{"invoices_this_month":{"type":"integer"},"resets_at":{"type":"string","format":"date-time"}}}}},"Asset":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AssetId"},"symbol":{"type":"string"},"name":{"type":"string"},"network":{"type":"string"},"network_label":{"type":"string"},"memo_required":{"type":"boolean"},"decimals":{"type":"integer"},"confirmations":{"type":"integer"},"min_amount":{"type":"string","description":"Smallest amount an invoice may ask for in this coin."},"available":{"type":"boolean","description":"Live keys: true when a receiving wallet is set for the coin's network. Test keys: always true."},"monitor_ok":{"type":"boolean","description":"Whether the chain watcher for this network is reporting in. false = payments are detected late."}}},"CustomerInput":{"type":"object","additionalProperties":false,"properties":{"external_id":{"type":"string","minLength":1,"maxLength":128,"description":"Your own id for the customer."},"email":{"type":"string","format":"email","maxLength":190},"name":{"type":"string","minLength":1,"maxLength":120},"phone":{"type":"string","minLength":1,"maxLength":40}},"description":"external_id or email is required."},"Customer":{"type":"object","properties":{"id":{"type":"string","description":"cus_…"},"external_id":{"type":["string","null"],"description":"Your own id"},"email":{"type":["string","null"],"description":""},"name":{"type":["string","null"],"description":""},"phone":{"type":["string","null"],"description":""},"invoice_count":{"type":"integer"},"paid_invoices":{"type":"integer"},"paid_usd":{"type":"string","description":"Paid volume in USD at each invoice's locked rate"},"created_at":{"type":"string","format":"date-time"},"last_paid_at":{"type":["string","null"],"format":"date-time"}}},"CustomerWithInvoices":{"allOf":[{"$ref":"#/components/schemas/Customer"},{"type":"object","properties":{"invoices":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"},"description":"Newest first, at most 100."}}}]},"RefundCreate":{"type":"object","required":["invoice_id","to_address","reason"],"additionalProperties":false,"properties":{"invoice_id":{"type":"string","pattern":"^inv_[0-9A-Za-z]{22}$"},"amount":{"$ref":"#/components/schemas/Decimal","description":"In the coin the invoice was paid with. Default: everything not yet refunded."},"to_address":{"type":"string","minLength":10,"maxLength":128,"description":"On the network the payment came from."},"memo":{"type":"string","maxLength":64},"reason":{"type":"string","minLength":3,"maxLength":500}}},"Refund":{"type":"object","properties":{"id":{"type":"string","description":"rfd_…"},"mode":{"type":"string","enum":["live","test"]},"invoice_id":{"type":["string","null"],"description":"inv_…"},"asset":{"type":"string","description":"Coin id"},"amount":{"type":"string"},"amount_usd":{"type":"string"},"to_address":{"type":"string"},"memo":{"type":["string","null"],"description":""},"reason":{"type":"string"},"status":{"type":"string","enum":["requested","approved","sent","rejected","cancelled"]},"tx_hash":{"type":["string","null"],"description":"Set once sent"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SubscriptionPlan":{"type":"object","properties":{"id":{"type":"string","description":"splan_…"},"name":{"type":"string"},"description":{"type":["string","null"],"description":""},"amount":{"type":"string","description":"USD per interval"},"currency":{"type":"string","const":"USD"},"interval":{"type":"string","enum":["month","year"]},"interval_count":{"type":"integer"}}},"SubscriptionCreate":{"type":"object","required":["plan_id","customer"],"additionalProperties":false,"properties":{"plan_id":{"type":"string","pattern":"^splan_[0-9A-Za-z]{22}$"},"customer":{"type":"object","additionalProperties":false,"description":"An existing customer by id, or found / created by external_id or email.","properties":{"id":{"type":"string","pattern":"^cus_[0-9A-Za-z]{22}$"},"external_id":{"type":"string","minLength":1,"maxLength":128,"description":"Your own id for the customer."},"email":{"type":"string","format":"email","maxLength":190},"name":{"type":"string","minLength":1,"maxLength":120}}}}},"Subscription":{"type":"object","properties":{"id":{"type":"string","description":"sub_…"},"mode":{"type":"string","enum":["live","test"]},"status":{"type":"string","enum":["pending","active","past_due","expired","cancelled"]},"plan":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"amount":{"type":"string","description":"USD per interval"},"currency":{"type":"string","const":"USD"},"interval":{"type":"string","enum":["month","year"]},"interval_count":{"type":"integer"}}},"customer_id":{"type":["string","null"],"description":"cus_…"},"customer_email":{"type":["string","null"],"description":""},"current_period_start":{"type":["string","null"],"format":"date-time"},"current_period_end":{"type":["string","null"],"format":"date-time"},"cancel_at_period_end":{"type":"boolean"},"cancelled_at":{"type":["string","null"],"format":"date-time"},"pay_url":{"type":"string","format":"uri","description":"Page where the customer pays the current period."},"created_at":{"type":"string","format":"date-time"}}},"Report":{"type":"object","description":"Amounts are USD decimal strings.","properties":{"range":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"group_by":{"type":"string","enum":["day","week","month"]},"timezone":{"type":"string","const":"UTC"}}},"totals":{"type":"object","properties":{"invoices":{"type":"integer"},"paid":{"type":"integer"},"success_rate":{"type":["number","null"],"description":"Percent, one decimal"},"volume_usd":{"type":"string"},"average_paid_usd":{"type":"string"},"fees_usd":{"type":"string","const":"0.00"},"expired":{"type":"integer"},"refunds_sent_usd":{"type":"string"},"refunds_pending_usd":{"type":"string"}}},"exceptions":{"type":"object","properties":{"underpaid":{"type":"integer"},"underpaid_owed_usd":{"type":"string"},"overpaid":{"type":"integer"},"overpaid_usd":{"type":"string"},"late":{"type":"integer"},"unmatched":{"type":"integer"},"unmatched_open":{"type":"integer"}}},"series":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string","description":"YYYY-MM-DD, YYYY-Www or YYYY-MM"},"invoices":{"type":"integer"},"paid":{"type":"integer"},"volume_usd":{"type":"string"}}}},"by_asset":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string"},"symbol":{"type":"string"},"network":{"type":"string"},"invoices":{"type":"integer"},"paid":{"type":"integer"},"received":{"type":"string"},"volume_usd":{"type":"string"}}}},"by_network":{"type":"array","items":{"type":"object","properties":{"network":{"type":"string"},"invoices":{"type":"integer"},"paid":{"type":"integer"},"volume_usd":{"type":"string"}}}},"by_status":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string"},"invoices":{"type":"integer"},"volume_usd":{"type":"string"}}}},"by_project":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["key","link","dashboard"]},"ref":{"type":["string","null"]},"name":{"type":["string","null"]},"invoices":{"type":"integer"},"paid":{"type":"integer"},"volume_usd":{"type":"string"}}}},"refunds":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string","enum":["requested","approved","sent","rejected","cancelled"]},"count":{"type":"integer"},"usd":{"type":"string"}}}}}},"WebhookEvent":{"type":"object","required":["id","type","mode","created","data"],"properties":{"id":{"type":"string","description":"evt_… — store it and skip repeats."},"type":{"type":"string","enum":["invoice.created","invoice.confirming","invoice.paid","invoice.underpaid","invoice.overpaid","invoice.expired","invoice.cancelled","transaction.unmatched","refund.updated","subscription.updated","payout_batch.completed","webhook.test"]},"mode":{"type":"string","enum":["live","test"]},"created":{"type":"integer","description":"Unix seconds"},"data":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice","description":"invoice.* events"},"transaction":{"$ref":"#/components/schemas/UnmatchedTransaction","description":"transaction.unmatched only"},"refund":{"$ref":"#/components/schemas/Refund","description":"refund.updated only"},"subscription":{"$ref":"#/components/schemas/Subscription","description":"subscription.updated only"},"message":{"type":"string","description":"webhook.test only"}}}}}}}}