> For the complete documentation index, see [llms.txt](https://docs.morpara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.morpara.com/tr/en/api-documentation/bincheck/cancel.md).

# Cancel

The void service allows a successful payment to be **canceled on the same day before it is settled** into the accounts.

With this service:

* The payment is reversed.
* Bank and merchant records are updated.
* Transaction tracking is provided for the void operation.

> ⚠️ The void operation **is only valid** for payments that have not been settled on the same day.\
> For settled payments, **the refund (Refund)** service must be used.

***

### Endpoint

```http
POST /v1/Payment/DoPayment
```

***

### Headers

| Key            | Type   | Description                          | Example              |
| -------------- | ------ | ------------------------------------ | -------------------- |
| x-ClientID     | String | Unique identifier for the API client | your-client-id       |
| x-ClientSecret | String | Secret key for the API client        | your-secret-key      |
| x-GrantType    | String | Type of access token used            | client\_credentials  |
| x-Scope        | String | API scope                            | pf\_write, pf\_read  |
| x-Timestamp    | String | Request timestamp                    | 2024-12-17T12:34:56Z |

***

### Request Body

| Field                              | Required | Type    | Description                             | Example                                      |
| ---------------------------------- | -------- | ------- | --------------------------------------- | -------------------------------------------- |
| merchantId                         | ✅        | Integer | Merchant identification number          | 100000000000004                              |
| paymentId                          | ✅        | String  | ID number of the payment to be voided   | 100000000000004202402140248                  |
| conversationId                     | ✅        | String  | Transaction tracking number             | MSD29715509646227267                         |
| sign                               | ✅        | String  | Digital signature to verify the request | PT6JMMJANWWQ6DN5M+DUGIZW4DSVJHX0NI2JRJ0XT3O= |
| transactionDetails.transactionType | ✅        | String  | Transaction type (VOID = cancel)        | VOID                                         |
| transactionDetails.currency        | ✅        | String  | Currency code (ISO 4217)                | 949                                          |
| language                           | ✅        | String  | Transaction language                    | tr                                           |

***

### Response Body

If the void operation is successful, the system returns the following response:

#### Example Request

```http
POST /v1/Payment/DoPayment
Content-Type: application/json
x-ClientID: your-client-id
x-ClientSecret: your-secret-key
x-GrantType: client_credentials
x-Scope: pf_write, pf_read
x-Timestamp: 2024-12-17T12:34:56Z
```

```json
{
  "merchantId": 100000000000004,
  "paymentId": "100000000000004202402140248",
  "conversationId": "MSD29715509646227267",
  "sign": "PT6JMMJANWWQ6DN5M+DUGIZW4DSVJHX0NI2JRJ0XT3O=",
  "transactionDetails": {
    "transactionType": "VOID",
    "currency": "949"
  },
  "language": "tr"
}

```

#### Example Response

```json
{
  "code": "00",
  "message": "Approved",
  "resultCode": "00",
  "resultDescription": "Successful",
  "responseDate": "11/03/2024 12:34:40",
  "conversationId": "MSD29715509646227267",
  "orderId": "100000000000004202402140248",
  "paymentId": "100000000000004202402140248",
  "bankUniqueReferenceNumber": "407100003684",
  "authCode": "562660",
  "sign": "F7GJMMJANWWQ6DN5M+DUGIZW4DSVJHXJNI2JRJ0XT3O="
}

```
