Skip to content

Cancel an invoice

POST
/invoice/cancel

Cancels an invoice that has not been paid yet on the account bound to the API key. The invoice is identified by either id or merchant orderId - at least one is required. Returns 400 if the invoice has already been settled or cancelled.

Required scope: invoices.cancel.

id
string format: uuid

Invoice ID (UUID) returned from POST /invoice. Mutually optional with orderId.

orderId
string

Merchant orderId supplied when the invoice was created. Mutually optional with id.

Invoice cancelled.

Invoice cannot be cancelled in its current status, or neither id nor orderId was supplied.

Missing or invalid x-tenant-api-key header. Code: exceptions.auth.invalidApiKey.

Media typeapplication/json
object
code
required

Stable machine-readable error code, namespaced under exceptions.. Always prefer branching on this value over message. See the per-route descriptions for the codes that route emits.

string
message
required

Human-readable explanation. Subject to wording changes; for programmatic checks use code instead.

string
extension

Optional structured payload accompanying the error. For exceptions.rateLimit.exceeded includes msBeforeNext; for validation errors includes the offending field info.

object
key
additional properties
any

Example

{
"code": "exceptions.auth.invalidApiKey",
"message": "Invalid or missing API key"
}

Request origin IP is not on the tenant API allowlist (exceptions.auth.ipNotAllowed), or the API key is missing the scope required by this operation (exceptions.auth.insufficientScope).

Media typeapplication/json
object
code
required

Stable machine-readable error code, namespaced under exceptions.. Always prefer branching on this value over message. See the per-route descriptions for the codes that route emits.

string
message
required

Human-readable explanation. Subject to wording changes; for programmatic checks use code instead.

string
extension

Optional structured payload accompanying the error. For exceptions.rateLimit.exceeded includes msBeforeNext; for validation errors includes the offending field info.

object
key
additional properties
any

Example

{
"code": "exceptions.auth.invalidApiKey",
"message": "Invalid or missing API key"
}

Invoice not found.

Rate limit exceeded for this endpoint. Retry after the window resets. Code: exceptions.rateLimit.exceeded. The extension.msBeforeNext field tells you how long to wait.

Media typeapplication/json
object
code
required

Stable machine-readable error code, namespaced under exceptions.. Always prefer branching on this value over message. See the per-route descriptions for the codes that route emits.

string
message
required

Human-readable explanation. Subject to wording changes; for programmatic checks use code instead.

string
extension

Optional structured payload accompanying the error. For exceptions.rateLimit.exceeded includes msBeforeNext; for validation errors includes the offending field info.

object
key
additional properties
any

Example

{
"code": "exceptions.auth.invalidApiKey",
"message": "Invalid or missing API key"
}

Unexpected server error. Safe to retry idempotent operations after a backoff.

Media typeapplication/json
object
code
required

Stable machine-readable error code, namespaced under exceptions.. Always prefer branching on this value over message. See the per-route descriptions for the codes that route emits.

string
message
required

Human-readable explanation. Subject to wording changes; for programmatic checks use code instead.

string
extension

Optional structured payload accompanying the error. For exceptions.rateLimit.exceeded includes msBeforeNext; for validation errors includes the offending field info.

object
key
additional properties
any

Example

{
"code": "exceptions.auth.invalidApiKey",
"message": "Invalid or missing API key"
}