Create a purchase invoice
const url = 'https://api.trueproxies.com/v1/invoices';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"offer_key":"example","options":{"city":"example","gb":1},"promo_code":"example","request_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","service_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.trueproxies.com/v1/invoices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "offer_key": "example", "options": { "city": "example", "gb": 1 }, "promo_code": "example", "request_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "service_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Requires billing:write; reseller:purchase also permits this operation. Add customer_id to buy for an owned managed customer, which additionally requires reseller:purchase. Prices and discount are snapshotted; a floor conflict returns 409.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Owned sub-customer UUID. Resellers only; reads require reseller:read and writes reseller:purchase in addition to the operation scope. X-Customer-Id header is an alternative. Not allowed for me, wallet, trial, API keys, or reseller-management routes.
Header Parameters
Section titled “Header Parameters”Makes a retry safe. The first request carrying a given key is executed and its response recorded; repeating the same request with the same key replays that response, with Idempotency-Replayed: true, rather than buying or paying a second time. Reusing a key for a different request is refused with 409, as is a repeat that arrives while the first is still running. Keys are scoped to your account and to the endpoint. Successful and uncertain invoice commands are retained so that an old retry cannot create another invoice. Completed definite rejections are kept for at least 24 hours; after that, the same key may be evaluated again.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
GB for top-ups; taken from the offer otherwise
Required when promo_code is present; keep stable only while retrying identical invoice content.
Required for renewal and topup
Examplegenerated
{ "offer_key": "example", "options": { "city": "example", "gb": 1 }, "promo_code": "example", "request_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "service_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”Created
object
When this invoice’s service activation, top-up, renewal, or charge-only processing committed. Payment receipt and an already-active service do not establish this outcome.
Automatic fulfillment stopped and needs operator attention. Payment remains received; this does not mean a refund completed or previously purchased service was revoked.
Who the invoice is issued to, copied from the account’s billing details when the invoice was created. Absent when the account had no billing details then; saving details later does not change it.
object
True when a cancelled invoice closed because it was not paid by due_at. Invoices cancelled before this field existed report false.
Internal API identifier. Use reference for customer-facing display.
object
GB for top-ups; taken from the offer otherwise
object
Present only while the invoice is payable and the pending checkout has not reached its known expiry
Staff views only. Why the checkout ended unpaid, as the provider reports it: not_attempted (no payment submitted), not_completed (started, never confirmed), or the card issuer’s code such as card_declined/insufficient_funds.
A provider refund was reported without a trustworthy amount. Reconciliation is required before any additional refund.
The recorded request can be retried unchanged within the provider idempotency window.
Refund request recorded at; not proof of completion
Stable, unique customer-facing reference.
Example
{ "kind": "wallet_topup", "payments": [ { "provider": "manual", "refund_status": "processing", "status": "pending" } ], "reference": "INV-001001", "status": "open"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}Error
object
What a client needs to act on the error (ids, flags), never display text.
object
Example
{ "code": "BAD_REQUEST"}