curl -X POST https://api.settlx.io/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel \
-H "Authorization: Bearer pk_live_your_api_key"
const invoiceId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(
`https://api.settlx.io/api/v1/invoices/${invoiceId}/cancel`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer pk_live_your_api_key' }
}
);
const { data } = await response.json();
console.log(data.status); // "expired"
import httpx
client = httpx.Client(headers={"Authorization": "Bearer pk_live_your_api_key"})
invoice_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = client.post(f"https://api.settlx.io/api/v1/invoices/{invoice_id}/cancel")
invoice = response.json()["data"]
print(invoice["status"]) # "expired"
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchantId": "f9e8d7c6-b5a4-3210-9876-543210fedcba",
"amount": "99.99",
"currency": "USD",
"status": "expired",
"description": "Order #1234",
"expiresAt": "2024-01-15T10:30:00.000Z",
"webhookUrl": "https://yoursite.com/webhooks/settlx",
"paymentUrl": "https://api.settlx.io/checkout/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:02:00.000Z"
}
}
{
"error": "Bad Request",
"message": "Invoice cannot be cancelled in its current status: confirmed"
}
{
"error": "Not Found",
"message": "Invoice not found"
}
Invoices
Cancel Invoice
Cancel a pending invoice
POST
/
api
/
v1
/
invoices
/
{id}
/
cancel
curl -X POST https://api.settlx.io/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel \
-H "Authorization: Bearer pk_live_your_api_key"
const invoiceId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(
`https://api.settlx.io/api/v1/invoices/${invoiceId}/cancel`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer pk_live_your_api_key' }
}
);
const { data } = await response.json();
console.log(data.status); // "expired"
import httpx
client = httpx.Client(headers={"Authorization": "Bearer pk_live_your_api_key"})
invoice_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = client.post(f"https://api.settlx.io/api/v1/invoices/{invoice_id}/cancel")
invoice = response.json()["data"]
print(invoice["status"]) # "expired"
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchantId": "f9e8d7c6-b5a4-3210-9876-543210fedcba",
"amount": "99.99",
"currency": "USD",
"status": "expired",
"description": "Order #1234",
"expiresAt": "2024-01-15T10:30:00.000Z",
"webhookUrl": "https://yoursite.com/webhooks/settlx",
"paymentUrl": "https://api.settlx.io/checkout/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:02:00.000Z"
}
}
{
"error": "Bad Request",
"message": "Invoice cannot be cancelled in its current status: confirmed"
}
{
"error": "Not Found",
"message": "Invoice not found"
}
Cancel Invoice
Cancels a pending invoice. Only invoices inpending status can be cancelled. Once cancelled, the invoice status is set to expired and no further payments can be made against it.
Path Parameters
string
required
UUID of the invoice to cancel.
Response
Returns the updated invoice object withstatus: "expired".
object
Updated invoice object. Same shape as Get Invoice response (without
addresses).You can only cancel invoices with status
pending. Attempting to cancel a confirmed, settled, or already expired invoice will return a 400 error.curl -X POST https://api.settlx.io/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel \
-H "Authorization: Bearer pk_live_your_api_key"
const invoiceId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(
`https://api.settlx.io/api/v1/invoices/${invoiceId}/cancel`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer pk_live_your_api_key' }
}
);
const { data } = await response.json();
console.log(data.status); // "expired"
import httpx
client = httpx.Client(headers={"Authorization": "Bearer pk_live_your_api_key"})
invoice_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = client.post(f"https://api.settlx.io/api/v1/invoices/{invoice_id}/cancel")
invoice = response.json()["data"]
print(invoice["status"]) # "expired"
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchantId": "f9e8d7c6-b5a4-3210-9876-543210fedcba",
"amount": "99.99",
"currency": "USD",
"status": "expired",
"description": "Order #1234",
"expiresAt": "2024-01-15T10:30:00.000Z",
"webhookUrl": "https://yoursite.com/webhooks/settlx",
"paymentUrl": "https://api.settlx.io/checkout/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:02:00.000Z"
}
}
{
"error": "Bad Request",
"message": "Invoice cannot be cancelled in its current status: confirmed"
}
{
"error": "Not Found",
"message": "Invoice not found"
}
⌘I