# Cancel Multi Payment Page

- Sandbox: `POST https://sandbox.payme.io/api/cancel-template`
- Production: `POST https://live.payme.io/api/cancel-template`

## Credentials

- Request body field `seller_payme_id` (required): MPL. Your private key in PayMe system.

## Overview

This endpoint enable you to cancle a Multi Payment Page.

Multi Payment Page enables payments on a single sale link, by multiple buyers.

You can find more information in our [Multi Payment Page Guide](/guides-and-use-cases-migrated/payments/multi-payment-page).

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seller_payme_id` | string | yes | MPL. Your private key in PayMe system. |
| `payme_sale_id` | string | yes | Our unique sale ID. |

### Request example

```json
{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/cancel-template' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/cancel-template", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "payme_client_key": "XXXXXXXX",
    "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "sale_refund_amount": 1000,
    "language": "he"
  }),
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/cancel-template",
    json={
        "payme_client_key": "XXXXXXXX",
        "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
        "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
        "sale_refund_amount": 1000,
        "language": "he",
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/cancel-template');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### 200 — OK (success)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | Status of the request (0 - success, 1 - error). |

```json
{
  "status_code": 0,
  "status_error_code": 0,
  "payme_status": "success",
  "refunded_from_creditcard": false,
  "sale_invoice_number": null,
  "sale_invoice_url": null,
  "sale_refund_buffer": 18800,
  "sale_status": "partial-refund",
  "payme_transaction_total": 1000,
  "payme_transaction_total_aft_deduction": 1000,
  "payme_transaction_id": "TRANDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_transaction_card_brand": "XXXXXXXX",
  "payme_transaction_auth_number": "72****4",
  "payme_transaction_voucher": "24****9",
  "payme_signature": "b71e**************ca5a",
  "payme_transaction_arn": null
}
```

### 251 — Seller not found (success)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | Status of the request (0 - success, 1 - error). |
| `status_error_details` | string |  |
| `status_additional_info` | string |  |
| `status_error_code` | integer |  |
| `session` | string |  |

```json
{
  "status_code": 1,
  "status_error_details": "מוכר לא נמצא",
  "status_additional_info": "seller_payme_id",
  "status_error_code": 251,
  "session": "MfH3Hc80"
}
```

### 305 — This operation cannot be completed due to an inappropriate sale status (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | Status of the request (0 - success, 1 - error). |
| `status_error_details` | string |  |
| `status_additional_info` | string |  |
| `status_error_code` | integer |  |
| `session` | string |  |

```json
{
  "status_code": 1,
  "status_error_details": "לא ניתן להשלים פעולה זו עקב סטטוס מכירה לא מתאים",
  "status_additional_info": "canceled",
  "status_error_code": 305,
  "session": "NGQ1QpYB"
}
```
