{"components":{"schemas":{"CheckoutInput":{"description":"Send amountMinor for a single amount, or lines for an itemised one.","properties":{"amountMinor":{"description":"The amount to collect. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"cancelUrl":{"type":"string"},"currency":{"description":"Optional. If sent it must be the workspace's own currency.","type":"string"},"customerEmail":{"type":"string"},"customerName":{"type":"string"},"description":{"maxLength":200,"type":"string"},"lines":{"items":{"properties":{"description":{"maxLength":200,"type":"string"},"quantity":{"description":"A quantity above zero; fractions are allowed. Defaults to 1.","type":"number"},"unitPriceMinor":{"description":"The price of one unit. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"}},"required":["description","unitPriceMinor"],"type":"object"},"maxItems":100,"type":"array"},"metadata":{"additionalProperties":true,"type":"object"},"reference":{"maxLength":120,"type":"string"},"successUrl":{"description":"Where to send the customer after paying. Not proof of payment.","type":"string"}},"type":"object"},"CheckoutSession":{"properties":{"amountMinor":{"description":"The amount to collect. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"amountText":{"description":"The amount formatted for display. Never parse it.","type":"string"},"cancelUrl":{"type":"string"},"created":{"type":"string"},"currency":{"description":"ISO 4217. This workspace takes one currency; it is the workspace's own.","type":"string"},"customerEmail":{"type":"string"},"customerName":{"type":"string"},"description":{"type":"string"},"expiresAt":{"description":"After this the checkout can no longer be paid.","type":"string"},"id":{"type":"string"},"invoice":{"description":"The numbered invoice a completed checkout produced. Null until money arrives.","nullable":true,"properties":{"amountDueMinor":{"description":"What is still owed. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"amountPaidMinor":{"description":"What has been paid. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"id":{"type":"string"},"number":{"type":"string"},"status":{"enum":["draft","issued","partially_paid","paid","overdue","cancelled"],"type":"string"}},"required":["id","number","status","amountPaidMinor","amountDueMinor"],"type":"object"},"livemode":{"description":"False for everything a test key makes.","type":"boolean"},"metadata":{"additionalProperties":true,"description":"Whatever you attached, returned unchanged.","type":"object"},"paid":{"description":"True once money has arrived. This, and only this, is proof of payment.","type":"boolean"},"reference":{"description":"Your own order reference, echoed back.","type":"string"},"status":{"enum":["open","complete","expired","cancelled"],"type":"string"},"successUrl":{"type":"string"},"url":{"description":"Send the customer here.","type":"string"}},"required":["id","status","url","amountMinor","currency","amountText","description","reference","metadata","customerName","customerEmail","successUrl","cancelUrl","expiresAt","livemode","created","paid","invoice"],"type":"object"},"CheckoutSessionEnvelope":{"properties":{"session":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["session"],"type":"object"},"CheckoutSessionList":{"properties":{"page":{"type":"integer"},"perPage":{"type":"integer"},"sessions":{"items":{"$ref":"#/components/schemas/CheckoutSession"},"type":"array"},"total":{"type":"integer"}},"required":["page","perPage","total","sessions"],"type":"object"},"Error":{"properties":{"docUrl":{"description":"Where the code is explained.","type":"string"},"error":{"description":"A stable code. Branch on this, not on the message.","type":"string"},"limit":{"description":"Present on rate_limited: the calls a minute this key may make.","type":"integer"},"message":{"description":"Written for a person, naming what to change.","type":"string"},"retryAfterSeconds":{"description":"Present on rate_limited: how long to wait.","type":"integer"}},"required":["error","message"],"type":"object"},"Health":{"properties":{"keyPrefix":{"description":"Identifies the key in your own records without revealing it.","type":"string"},"mode":{"enum":["live","test"],"type":"string"},"ok":{"type":"boolean"},"rateLimitPerMin":{"type":"integer"},"scopes":{"items":{"enum":["invoices.read","invoices.write","checkout.write","checkout.read","usage.read"],"type":"string"},"type":"array"},"workspace":{"description":"The workspace this key belongs to.","type":"string"}},"required":["ok","workspace","keyPrefix","mode","scopes","rateLimitPerMin"],"type":"object"},"InvoiceDetail":{"properties":{"amountDueMinor":{"description":"What is still owed. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"amountPaidMinor":{"description":"What has been paid. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"currency":{"type":"string"},"customerEmail":{"type":"string"},"customerName":{"type":"string"},"dueDate":{"type":"string"},"grossMinor":{"description":"The invoice total. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"grossText":{"description":"The total formatted for display. Never parse it.","type":"string"},"id":{"type":"string"},"issueDate":{"type":"string"},"lines":{"items":{"properties":{"description":{"type":"string"},"lineTotalMinor":{"description":"The line total. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"quantityMilli":{"description":"Quantity in thousandths: 1500 is 1.5.","type":"integer"},"taxMinor":{"description":"Tax on this line. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"unitPriceMinor":{"description":"The price of one unit. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"}},"required":["description","quantityMilli","unitPriceMinor","taxMinor","lineTotalMinor"],"type":"object"},"type":"array"},"livemode":{"type":"boolean"},"number":{"type":"string"},"paidAt":{"type":"string"},"payUrl":{"description":"The page the customer pays on.","type":"string"},"source":{"type":"string"},"status":{"enum":["draft","issued","partially_paid","paid","overdue","cancelled"],"type":"string"}},"required":["id","number","status","currency","grossMinor","amountPaidMinor","amountDueMinor","issueDate","dueDate","payUrl","livemode","lines"],"type":"object"},"InvoiceDetailEnvelope":{"properties":{"invoice":{"$ref":"#/components/schemas/InvoiceDetail"}},"required":["invoice"],"type":"object"},"InvoiceEnvelope":{"properties":{"invoice":{"$ref":"#/components/schemas/InvoiceSummary"}},"required":["invoice"],"type":"object"},"InvoiceInput":{"properties":{"currency":{"description":"Optional. If sent it must be the workspace's own currency.","type":"string"},"customerEmail":{"type":"string"},"customerId":{"description":"An existing customer of this workspace.","type":"string"},"customerName":{"type":"string"},"dueDate":{"description":"YYYY-MM-DD.","type":"string"},"lines":{"items":{"properties":{"description":{"maxLength":200,"type":"string"},"quantity":{"description":"A quantity above zero; fractions are allowed. Defaults to 1.","type":"number"},"taxId":{"description":"Optional. The id of a tax rate in this workspace; the line is taxed at that rate.","type":"string"},"unitPriceMinor":{"description":"The price of one unit. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"}},"required":["description","unitPriceMinor"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"},"notes":{"type":"string"}},"required":["lines"],"type":"object"},"InvoiceList":{"properties":{"invoices":{"items":{"$ref":"#/components/schemas/InvoiceSummary"},"type":"array"},"page":{"type":"integer"},"perPage":{"type":"integer"},"total":{"type":"integer"}},"required":["page","perPage","total","invoices"],"type":"object"},"InvoiceSummary":{"properties":{"amountDueMinor":{"description":"What is still owed. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"amountPaidMinor":{"description":"What has been paid. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"created":{"type":"string"},"currency":{"type":"string"},"customerEmail":{"type":"string"},"customerName":{"type":"string"},"dueDate":{"type":"string"},"grossMinor":{"description":"The invoice total. A whole number of minor units: 45000 is Nu 450.00.","type":"integer"},"grossText":{"description":"The total formatted for display. Never parse it.","type":"string"},"id":{"type":"string"},"issueDate":{"type":"string"},"livemode":{"type":"boolean"},"number":{"type":"string"},"payUrl":{"description":"The page the customer pays on.","type":"string"},"source":{"type":"string"},"status":{"enum":["draft","issued","partially_paid","paid","overdue","cancelled"],"type":"string"}},"required":["id","number","status","currency","grossMinor","amountPaidMinor","amountDueMinor","issueDate","dueDate","payUrl","livemode","created"],"type":"object"},"Usage":{"properties":{"byOutcome":{"description":"How many calls ended each way: rate_limited, missing_scope, ok ...","items":{"properties":{"count":{"type":"integer"},"outcome":{"type":"string"}},"required":["outcome","count"],"type":"object"},"type":"array"},"daily":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"days":{"type":"integer"},"ok":{"type":"integer"},"rateLimitPerMin":{"type":"integer"},"refused":{"type":"integer"},"total":{"type":"integer"}},"required":["days","rateLimitPerMin","total","ok","refused"],"type":"object"}},"securitySchemes":{"ApiKeyHeader":{"description":"The same key, in X-API-Key, for clients that cannot set Authorization.","in":"header","name":"X-API-Key","type":"apiKey"},"BearerAuth":{"description":"Authorization: Bearer \u003ckey\u003e. A key beginning wtest_ cannot move money.","scheme":"bearer","type":"http"}}},"info":{"description":"Take payments from your own website. Open a checkout for an amount, send the customer to the URL you get back, and read the result. Money is always a whole number of minor units. Prose reference: /docs/api.","title":"WONS Merchant API","version":"1"},"openapi":"3.0.3","paths":{"/checkout/sessions":{"get":{"parameters":[{"in":"query","name":"page","schema":{"default":1,"minimum":1,"type":"integer"}},{"in":"query","name":"perPage","schema":{"default":25,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionList"}}},"description":"A page of checkouts, newest first."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"List your checkouts","tags":["Checkout"],"x-required-scope":"checkout.read"},"post":{"parameters":[{"description":"Send on every POST. Repeating a key with the same body returns the first answer; a different body is 409.","in":"header","name":"Idempotency-Key","required":false,"schema":{"maxLength":200,"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutInput"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionEnvelope"}}},"description":"The checkout is open."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The same Idempotency-Key was used with a different body."},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The body is not acceptable, or the Idempotency-Key is longer than 200 characters. The message says exactly what to change."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Something went wrong on our side (error server_error). No answer is stored under your Idempotency-Key for this call, so a retry runs it again."}},"summary":"Open a checkout and get a pay URL","tags":["Checkout"],"x-required-scope":"checkout.write"}},"/checkout/sessions/{id}":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionEnvelope"}}},"description":"The checkout."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"Read one checkout back: did they pay?","tags":["Checkout"],"x-required-scope":"checkout.read"}},"/health":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}},"description":"The key is good."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"Is the key good, and is it live or test","tags":["Account"],"x-required-scope":""}},"/invoices":{"get":{"parameters":[{"in":"query","name":"page","schema":{"default":1,"minimum":1,"type":"integer"}},{"in":"query","name":"perPage","schema":{"default":25,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceList"}}},"description":"A page of invoices, newest first."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"List invoices","tags":["Invoices"],"x-required-scope":"invoices.read"},"post":{"parameters":[{"description":"Send on every POST. Repeating a key with the same body returns the first answer; a different body is 409.","in":"header","name":"Idempotency-Key","required":false,"schema":{"maxLength":200,"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceInput"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}},"description":"The invoice is issued."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The same Idempotency-Key was used with a different body."},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The body is not acceptable, or the Idempotency-Key is longer than 200 characters. The message says exactly what to change."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Something went wrong on our side (error server_error). No answer is stored under your Idempotency-Key for this call, so a retry runs it again."}},"summary":"Issue a numbered invoice with a pay link","tags":["Invoices"],"x-required-scope":"invoices.write"}},"/invoices/{id}":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetailEnvelope"}}},"description":"The invoice with its lines."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"One invoice, with its lines","tags":["Invoices"],"x-required-scope":"invoices.read"}},"/usage":{"get":{"parameters":[{"in":"query","name":"days","schema":{"default":30,"maximum":90,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}},"description":"Usage over the last days."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No key, or the key is wrong, revoked or expired."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, is not allowed from this address, or the workspace is suspended."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such record for this key, or the API is switched off. Live and test data are separate."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Too many requests. Wait retryAfterSeconds."}},"summary":"What your keys have been doing","tags":["Account"],"x-required-scope":"usage.read"}}},"security":[{"BearerAuth":[]},{"ApiKeyHeader":[]}],"servers":[{"url":"https://merchant.wons.bt/api/v1"}],"tags":[{"name":"Checkout"},{"name":"Invoices"},{"name":"Account"}],"x-platform":{"apiEnabled":true,"checkoutExpiryMinutes":7,"rateLimitPerMin":120}}
