# Cancel an Invoice

Request intended to cancel a previously created invoice by its ID. The invoice ID is specified in the URL endpoint.

<mark style="color:red;">DELETE</mark> [<mark style="color:$primary;">https://app.goodpayments.io/v1/api/payment/{id}/cancel</mark>](https://app.goodpayments.io/v1/api/payment/448255354/cancel) &#x20;

### Headers&#x20;

| Name            | Type   | Description             | Example                                                          |
| --------------- | ------ | ----------------------- | ---------------------------------------------------------------- |
| Authorization\* | string | Unique Merchant API Key | 94a48138b1f41b9cdb3e12c2ff0c7cbe1c7a5f50a311a5054b903cad84215662 |

### **Request Body**

This request does not require any parameters in the request body. All necessary parameters are included in the URL endpoint.

### **Request** **Example**

```yaml
curl -X 'DELETE' \
  'https://app.goodpayments.io/v1/api/payment/448255354/cancel' \
  -H 'accept: application/json' \
  -H 'Authorization: 94a48138b1f41b9cdb3e12c2ff0c7cbe1c7a5f50a311a5054b903cad84215662'
```

### Response Parameters

| Name                | Type    | Description                                                                                                                                                                                                                                                                                      | Example                                         |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| id                  | integer | Unique invoice ID                                                                                                                                                                                                                                                                                | 123477361                                       |
| status              | string  | <p>Invoice status. Possible values:</p><ul><li><code>CANCELED</code></li></ul>                                                                                                                                                                                                                   | CANCELLED                                       |
| type                | string  | <p>Invoice type. <code>SINGLE</code> – temporary address; <code>MULTIPLE</code> – static address<br><code>MULTIPLE\_TRANSFER</code> – mass payout address</p>                                                                                                                                    | SINGLE                                          |
| paymentURL          | string  | Payment page URL                                                                                                                                                                                                                                                                                 | <https://app.goodpayments.io/payment/123477361> |
| amount              | number  | Invoice amount in USD                                                                                                                                                                                                                                                                            | 1                                               |
| currencies          | string  | <p>List of accepted tokens. Possible values:</p><ul><li><code>TRX</code></li><li><code>USDT</code></li><li><code>TRX, USDT</code></li></ul>                                                                                                                                                      | \["USDT", "TRX"]                                |
| currencies\_amounts | string  | Amount to be paid in each accepted token                                                                                                                                                                                                                                                         | "TRX": 3.6329                                   |
| transfer\_amounts   | string  | Actual received amount                                                                                                                                                                                                                                                                           | "TRX": 3.6329                                   |
| cost                | number  | Service fee charged for processing the payment                                                                                                                                                                                                                                                   | 6.5                                             |
| order\_id           | string  | Order identifier in the merchant's system                                                                                                                                                                                                                                                        | 12345                                           |
| address             | string  | Generated  payment address                                                                                                                                                                                                                                                                       | TBi3zPSQ8JszpkkgwZL4kZWDjXEZsi9Fze              |
| client\_comission   | boolean | <p>Flag that determines who pays the forwarding fee. Only for <code>SINGLE</code> invoice type.</p><ul><li>true – the fee is charged to the client. The invoice amount is increased by the fee, and the client pays the total amount.</li><li>false – the fee is paid by the merchant.</li></ul> | true / false                                    |
| webhook\_url        | string  | The URL to which goodPayments will send a webhook after the customer completes the payment                                                                                                                                                                                                       | <https://example.com/webhook>                   |
| redirect\_url       | string  | The URL where the customer will be redirected after completing the payment                                                                                                                                                                                                                       | <https://example.com/thank-you>                 |
| description         | string  | Order description: may contain any provided information related to the order                                                                                                                                                                                                                     | Payment for order #123                          |
| merchant\_contact   | string  | Merchant contact details                                                                                                                                                                                                                                                                         | @username                                       |
| target\_wallets     | object  | An object containing a list of addresses and the amount to be sent to each address (for invoices with type `MULTIPLE_TRANSFER`).                                                                                                                                                                 |                                                 |
| expired\_at         | string  | Invoice expiration timestamp                                                                                                                                                                                                                                                                     | 2025-11-23T14:28:57.786076+00:00                |
| created\_at         | string  | Invoice creation timestamp                                                                                                                                                                                                                                                                       | 2025-11-23T13:58:57.789617+00:00                |

### Response Example

{% tabs %}
{% tab title="200 Success" %}

```json
{
  "id": 336575574,
  "status": "CANCELLED",
  "type": "SINGLE",
  "paymentURL": "https://app.goodpayments.io/payment/336575574",
  "amount": 10,
  "currencies": [
    "TRX",
    "USDT"
  ],
  "currencies_amounts": {
    "TRX": 33.402357,
    "USDT": 10
  },
  "transfer_amounts": {
    "input": {
      "TRX": 0,
      "USDT": 0
    },
    "output": {
      "TRX": 0,
      "USDT": 0
    }
  },
  "cost": null,
  "client_commission": true,
  "order_id": null,
  "address": "TRWvSiQzhSpLdRAmwDHKtgd7bZb2G2be53",
  "webhook_url": null,
  "redirect_url": null,
  "description": "",
  "merchant_contact": "@username",
  "target_wallets": {},
  "expired_at": "2026-03-17T11:59:07.515594+03:00",
  "created_at": "2026-03-17T11:29:07.518981+03:00"
}
```

{% endtab %}

{% tab title="400 Invoice cannot be canceled" %}

```json
{
  "detail": "Invoice cannot be canceled"
}
```

{% endtab %}

{% tab title="403 Authentication credentials were not provided" %}

```json
{
  "detail": "Authentication credentials were not provided."
}
```

{% endtab %}

{% tab title="404 No Invoice matches the given query" %}

```json
{
  "detail": "No Invoice matches the given query."
}
```

{% endtab %}
{% endtabs %}

### **Possible Errors**

If the invoice cannot be canceled (for example, the specified invoice is already in the `ERROR`, `TIMEOUT`, `COMPLETED`, or `CANCELLED` status), the server returns a **400** response.

If the request does not contain a valid API key in the header or IP address is not in Whitelist, the server will return a **403** response.

If the request contains an incorrect invoice ID, the server returns a **404** response.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://goodpayments.gitbook.io/docs/api-reference/api-methods-overview-request-response-structure/cancel-an-invoice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
