---
updatedAt: 2026-02-27T02:49:39.000Z
agentTools:
  projectIndex: https://developer.ezypay.com/llms.txt
---

# Cancel a QR Payment request

To prevent a PENDING_QR_PAYMENT invoice from being processed for payment by the customer, call the Cancel API endpoint to cancel the QR payment request. Once the cancellation request is submitted, the invoice status will be updated to PROCESSING, during which no further actions are allowed. If the cancellation is successful, the invoice status will be updated to UNPAID. If the cancellation fails, the status will revert accordingly.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "billing",
    "version": "2.1.0"
  },
  "servers": [
    {
      "url": "https://api-sandbox.ezypay.com/v2"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/billing/invoices/{invoiceId}/cancel": {
      "put": {
        "summary": "Copy of Write off an invoice",
        "description": "To stop \"PAST_DUE\" invoice from being processed again, the invoice can be written-off using the written-off API endpoint. This will set the invoice status to \"WRITTEN_OFF\". Ezypay will stop all ability to modify, retry and update the invoice once the invoice has been written-off.\n\nNOTE:\nAny customer PAID fees (failed payment fees, load fees, transaction fees) will be reallocated to the merchant once the written-off API is triggered. This will be deducted from the merchant before the next settlement.",
        "operationId": "write-off-an-invoice-1",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "Auto-generated identifier of the invoice.",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "merchant",
            "in": "header",
            "description": "Merchant ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {
                      "id": "7e2481d6-3ce5-42b5-89af-33dbd61b5151",
                      "creditNoteId": null,
                      "documentNumber": "IN0000000000000137",
                      "date": "2026-03-06",
                      "dueDate": "2026-03-06",
                      "scheduledPaymentDate": null,
                      "status": "PROCESSING",
                      "memo": "Monthly",
                      "items": [
                        {
                          "description": "Customer Paid Fee",
                          "amount": {
                            "currency": "THB",
                            "value": 4,
                            "type": null
                          },
                          "tax": {
                            "rate": 0
                          },
                          "id": "ca7369c0-b29b-4980-b927-e271466126d0",
                          "type": "transaction_fee",
                          "discounted": {
                            "currency": "THB",
                            "value": 0,
                            "type": null
                          },
                          "accountingCode": "test-1772808814",
                          "reference": null
                        },
                        {
                          "description": "MISC",
                          "amount": {
                            "currency": "THB",
                            "value": 80,
                            "type": null
                          },
                          "tax": {
                            "rate": 1
                          },
                          "id": "aac1ffa0-3a26-42a7-837d-c45b6b4af13c",
                          "type": "addon_payment",
                          "discounted": {
                            "currency": "THB",
                            "value": 0,
                            "type": null
                          },
                          "accountingCode": "test-1772808814",
                          "reference": null
                        },
                        {
                          "description": "Dec subscription fee-005",
                          "amount": {
                            "currency": "THB",
                            "value": 2916,
                            "type": null
                          },
                          "tax": {
                            "rate": 1
                          },
                          "id": "c8792ba4-38e9-47da-944c-a39f8a568e3a",
                          "type": "on_demand_payment",
                          "discounted": {
                            "currency": "THB",
                            "value": 0,
                            "type": null
                          },
                          "accountingCode": "test-1772808814",
                          "reference": null
                        }
                      ],
                      "amount": {
                        "currency": "THB",
                        "value": 3000,
                        "type": null
                      },
                      "amountWithoutDiscount": {
                        "currency": "THB",
                        "value": 3000,
                        "type": null
                      },
                      "totalDiscounted": {
                        "currency": "THB",
                        "value": 0,
                        "type": null
                      },
                      "totalRefunded": {
                        "currency": "THB",
                        "value": 0,
                        "type": null
                      },
                      "totalTax": {
                        "currency": "THB",
                        "value": 29.66,
                        "type": null
                      },
                      "customerId": "d199d162-d72c-41c3-9f58-c0117b2aac50",
                      "subscriptionId": null,
                      "checkoutId": null,
                      "subscriptionName": null,
                      "paymentMethodToken": "32f39266-353f-4626-8324-2524de12451a",
                      "paymentMethodData": null,
                      "autoPayment": true,
                      "processingModel": "IN_PERSON_PAYMENT",
                      "transactionSource": null,
                      "createdOn": "2026-03-06T14:53:35.220",
                      "payNowUrl": null,
                      "channel": "api",
                      "checkoutResult": null,
                      "customerFirstName": null,
                      "customerLastName": null,
                      "invoiceCategory": "ONE_OFF",
                      "invoiceSubCategory": "AD_HOC",
                      "qrData": {
                        "qrString": "MzYwMjAwMDoxNzcyODA4ODE1NjI1Ojk4ZmIwNjA3",
                        "expires": "2026-03-13T21:53:35"
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "3749a82a-7d11-4be2-9ad9-4f76590e5af5"
                    },
                    "creditNoteId": {
                      "type": "string"
                    },
                    "documentNumber": {
                      "type": "string",
                      "example": "420423"
                    },
                    "date": {
                      "type": "string",
                      "example": "2017-12-02"
                    },
                    "dueDate": {
                      "type": "string",
                      "example": "2017-12-02"
                    },
                    "scheduledPaymentDate": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "WRITTEN_OFF"
                    },
                    "memo": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "description": {
                            "type": "string",
                            "example": "Failed Payment Fee"
                          },
                          "amount": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "example": "NZD"
                              },
                              "value": {
                                "type": "number",
                                "example": 8.5,
                                "default": 0
                              },
                              "type": {}
                            }
                          },
                          "tax": {
                            "type": "object",
                            "properties": {
                              "rate": {
                                "type": "number",
                                "example": 0.1,
                                "default": 0
                              }
                            }
                          },
                          "id": {
                            "type": "string",
                            "example": "b9d62cd9-ce1e-4732-9449-446cbcfa3cb4"
                          },
                          "type": {
                            "type": "string",
                            "example": "failed_payment_fee"
                          },
                          "discounted": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "example": "NZD"
                              },
                              "value": {
                                "type": "integer",
                                "example": 0,
                                "default": 0
                              },
                              "type": {}
                            }
                          },
                          "accountingCode": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "amount": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "example": "NZD"
                        },
                        "value": {
                          "type": "number",
                          "example": 119.5,
                          "default": 0
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "amountWithoutDiscount": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "example": "NZD"
                        },
                        "value": {
                          "type": "number",
                          "example": 119.5,
                          "default": 0
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "totalDiscounted": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "example": "NZD"
                        },
                        "value": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "totalRefunded": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "example": "NZD"
                        },
                        "value": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "totalTax": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "example": "NZD"
                        },
                        "value": {
                          "type": "number",
                          "example": 10.1,
                          "default": 0
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "customerId": {
                      "type": "string",
                      "example": "c00770d2-9547-4b5d-a00a-db3d9627e706"
                    },
                    "subscriptionId": {
                      "type": "string",
                      "example": "68e17208-b70a-4588-880b-803ad85d1d11"
                    },
                    "checkoutId": {
                      "type": "string"
                    },
                    "subscriptionName": {
                      "type": "string",
                      "example": "Migration Subscription 2"
                    },
                    "paymentMethodToken": {
                      "type": "string",
                      "example": "ef0a2cbc-95d9-4877-abcd-d900acc38930"
                    },
                    "paymentMethodData": {
                      "type": "string"
                    },
                    "autoPayment": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "processingModel": {
                      "type": "string"
                    },
                    "transactionSource": {
                      "type": "string"
                    },
                    "createdOn": {
                      "type": "string",
                      "example": "2017-11-27T06:47:07.860"
                    },
                    "paynowUrl": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "checkoutResult": {
                      "type": "string"
                    },
                    "customerFirstName": {
                      "type": "string"
                    },
                    "customerLastName": {
                      "type": "string"
                    },
                    "invoiceCategory": {
                      "type": "string"
                    },
                    "invoiceSubCategory": {
                      "type": "string"
                    },
                    "qrData": {
                      "type": "object",
                      "properties": {
                        "qrString": {
                          "type": "string"
                        },
                        "expires": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Invoice Not Found": {
                    "value": "{\n    \"type\": \"invalid_request_error\",\n    \"code\": \"invoice_not_found\",\n    \"message\": \"Invoice with specified invoiceId cannot be found.\"\n}"
                  },
                  "Invoice that is not in the PENDING_QR_PAYMENT status": {
                    "value": {
                      "type": "invalid_request_error",
                      "code": "qr_cancel_failed",
                      "message": "Unable to cancel the QR payment request."
                    },
                    "summary": "Invoice that is not in the PENDING_QR_PAYMENT status"
                  }
                },
                "schema": {
                  "oneOf": [
                    {
                      "title": "Invoice Not Found",
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "example": "invalid_request_error"
                        },
                        "code": {
                          "type": "string",
                          "example": "invoice_not_found"
                        },
                        "message": {
                          "type": "string",
                          "example": "Invoice with specified invoiceId cannot be found."
                        }
                      }
                    },
                    {
                      "title": "Invoice that is not in the PENDING_QR_PAYMENT status",
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "example": "invalid_request_error"
                        },
                        "code": {
                          "type": "string",
                          "example": "invoice_cannot_be_written_off"
                        },
                        "message": {
                          "type": "string",
                          "example": "Only invoices with status past_due can be written off."
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "deprecated": false,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "examples": {
                "Request Example": {
                  "value": {}
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```