# Delete Product

- Sandbox: `DELETE https://sandbox.payme.io/api/products/{guid}`
- Production: `DELETE https://live.payme.io/api/products/{guid}`

## Credentials

- Header `Authorization: Bearer <token>`

The delete-product endpoint is a critical component of the product management system. It allows clients to remove products from the available products list based on specific identifiers. This operation is essential for maintaining an up-to-date and accurate product catalog, ensuring that obsolete or discontinued items are no longer available in the inventory.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `guid` | path | string | yes |  |

## Request body

Content type: `application/json`

### Request example

```json
{
  "payme_client_key": "360_project_client_key",
  "seller_payme_id": "seller_identifier",
  "guid": "guid value"
}
```

## Code samples

### curl

```bash
curl -X DELETE 'https://sandbox.payme.io/api/products/<guid>' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <YOUR_TOKEN>' \
  --data-raw '{
  "payme_client_key": "360_project_client_key",
  "seller_payme_id": "seller_identifier",
  "guid": "guid value"
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/products/<guid>", {
  method: "DELETE",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <YOUR_TOKEN>",
  },
  body: JSON.stringify({
    "payme_client_key": "360_project_client_key",
    "seller_payme_id": "seller_identifier",
    "guid": "guid value"
  }),
});

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

### Python

```python
import requests

response = requests.delete(
    "https://sandbox.payme.io/api/products/<guid>",
    headers={
        "Authorization": "Bearer <YOUR_TOKEN>",
    },
    json={
        "payme_client_key": "360_project_client_key",
        "seller_payme_id": "seller_identifier",
        "guid": "guid value",
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "payme_client_key": "360_project_client_key",
  "seller_payme_id": "seller_identifier",
  "guid": "guid value"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/products/<guid>');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer <YOUR_TOKEN>',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

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

echo $response;
```

## Responses

### 200 — OK (success)

| Field | Type | Description |
| --- | --- | --- |
| `message` | string | The text indicator of the action requested to delete the product. |
| `guid` | string | The unique PayMe Product identifier. |

```json
{
  "status_code": 0,
  "message": "Product deleted successfully",
  "guid": "PRDCT123-123-123"
}
```

### 400 — Bad Request (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | ```1 = Failure, 0 = Sucess ``` |
| `message` | string | The error text message. |
| `status_error_code` | integer | The error code. |

```json
{
  "status_code": 1,
  "message": "Bad Request",
  "status_error_code": 400
}
```

### 401 — Unauthorized (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | ```1 = Failure, 0 = Sucess ``` |
| `message` | string | The error text message. |
| `status_error_code` | integer | The error code. |

```json
{
  "status_code": 1,
  "message": "Unauthorized request",
  "status_error_code": 401
}
```

### 500 — Internal Server Error (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | ```1 = Failure, 0 = Sucess ``` |
| `message` | string | The error text message. |
| `status_error_code` | integer | The error code. |

```json
{
  "status_code": 1,
  "message": "Internal Server Error",
  "status_error_code": 500
}
```
