1. Invoices
AutopayEG
  • Invoices
    • Create invoice
      POST
    • Get invoice
      GET
    • Cancel invoice
      POST
  • Merchant
    • Current merchant
      GET
  • Webhooks
    • Receive Autopay webhook
      POST
  • Schemas
    • InvoiceStatus
    • Provider
    • ErrorEnvelope
    • CreateInvoiceRequest
    • Invoice
    • CreateInvoiceResponse
    • GetInvoiceResponse
    • MerchantMeResponse
    • MerchantFees
    • MerchantTransaction
    • WebhookCustomer
    • WebhookEnvelope
    • WebhookData
  1. Invoices

Cancel invoice

POST
/api/v1/invoices/{invoice}/cancel
Cancels a payable invoice (pending, active, or under_review). Terminal
invoices (completed, failed, cancelled, expired) cannot be cancelled.
Do this
Call when the customer abandons checkout and you want the invoice closed.
After 200, treat the order as unpaid. You will also get invoice.cancelled
on webhook_url if you set one — handle that idempotently.
Confirm
200 and invoice.status is cancelled (cancelled_at set).
422 Invoice cannot be cancelled means it is already terminal — GET the
invoice and honor completed if it paid in the meantime.

Request

Authorization
API Key
Add parameter in header
X-API-Key
Example:
X-API-Key: ********************
API Key
Add parameter in header
X-API-Secret
Example:
X-API-Secret: ********************
or
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Path Params

Responses

🟢200
application/json
Cancelled
Bodyapplication/json

🟠422
🟠401Unauthorized
🟠404NotFound
🟠429RateLimited
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/v1/invoices//cancel' \
--header 'X-API-Key: <api-key>' \
--header 'X-API-Secret: <api-key>'
Response Response Example
200 - Cancelled invoice
{
    "invoice": {
        "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "amount": "100.00",
        "currency": "EGP",
        "status": "cancelled",
        "customer_email": "customer@example.com",
        "customer_name": "Ahmed Ali",
        "customer_phone": "01012345678",
        "customer_metadata": {
            "order_id": "1001"
        },
        "external_reference": "ORD-1001",
        "success_url": "https://merchant.example/orders/1001/success",
        "cancel_url": "https://merchant.example/orders/1001/cancel",
        "webhook_url": "https://merchant.example/webhooks/autopay",
        "expires_at": "2026-08-19T10:00:00+00:00",
        "completed_at": null,
        "cancelled_at": "2026-08-17T10:20:00+00:00",
        "created_at": "2026-08-17T10:00:00+00:00",
        "updated_at": "2026-08-17T10:20:00+00:00"
    }
}
Modified at 2026-08-17 11:17:23
Previous
Get invoice
Next
Current merchant
Built with