# Order New POS Device

- Sandbox: `POST https://sandbox.payme.io/api/vas-enable`
- Production: `POST https://live.payme.io/api/vas-enable`

## Credentials

- Request body field `payme_client_key` (required): The PayMe Secret Client Key
- Request body field `seller_payme_id` (required): The unique seller identifier (MPL).
- Request body field `vas_payme_id` (required): The unique activation key.

## Overview

In order to be initiate the process of receiving a physical Point Of Sale (POS) device, you will first need to generate a new request to `https://<env>.payme.io/api/vas-enable` using your personal VAS identifier.

Once the VAS is activated, the process will be initiated and the following operations will take place:

1. New terminal request (takes up to 5 business days)
2. Physical device internal preparation (Immediate once terminal is ready)

The API request for activating the service will look as follows:
### 1st step
Add the payment method via `vas-enable`
```
{
    "payme_client_key": "payme_client_key",
    "seller_payme_id": "seller_payme_id",
    "vas_payme_id": "vas_payme_id"
}
```

### 2nd step
Add the device type via `vas-enable`
```
{
 "payme_client_key": "payme",
 "seller_payme_id":"MPL15991-MPL15991-MPL15991-MPL15991",
 "vas_payme_id": "VASL1545-8192915E-8192915E-8192915E",
 "extend_items": true,
 "vas_data": {
              "number_of_devices": 3,
              "items":[
                        {
                          "pos_id": "123", 
                          "shipping_address": "address of shipping", 
                          "name": "name of the device"
                        },
                        {
                        "pos_id": "123", 
                          "shipping_address": "address of shipping", 
                          "name": "name of the device"   
                        }
                      ]
            }
}
```

Once the VAS is activated, the process will be synchronous and there's no further action required to be completed by the partner or seller until receiving the device and starting to process immidiately.

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payme_client_key` | string | yes | The PayMe Secret Client Key |
| `seller_payme_id` | string | yes | The unique seller identifier (MPL). |
| `vas_payme_id` | string | yes | The unique activation key. |
| `vas_data` | object | yes | The predefined data object that allows you to request specific device amount and a per device information. |
| `vas_data.number_of_devices` | integer | yes | The number of requested devices. |
| `vas_data.items` | array | yes | The devices array. The items count must be equal to `number_of_devices` value. |
| `vas_data.items[].pos_id` | string | yes | The unique POS ID. This ID will be used in order to send payment request to the specific device. |
| `vas_data.items[].shipping_address` | string | yes | The shipping address for the physical device. |
| `vas_data.items[].name` | string | yes | The name of the device. Will be used internally for the setup process. |
| `extend_items` | boolean | yes |  |

### Request example

```json
{
  "payme_client_key": "icount",
  "seller_payme_id": "MPL15991-16765VD7-EMZAYZEV-31PXMITN",
  "vas_payme_id": "VASL1545-8192915E-5NTSEUM1-03YNFWNU",
  "vas_data": {
    "number_of_devices": 3,
    "items": [
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      },
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      }
    ]
  }
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/vas-enable' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "payme_client_key": "icount",
  "seller_payme_id": "MPL15991-16765VD7-EMZAYZEV-31PXMITN",
  "vas_payme_id": "VASL1545-8192915E-5NTSEUM1-03YNFWNU",
  "vas_data": {
    "number_of_devices": 3,
    "items": [
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      },
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      }
    ]
  }
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/vas-enable", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "payme_client_key": "icount",
    "seller_payme_id": "MPL15991-16765VD7-EMZAYZEV-31PXMITN",
    "vas_payme_id": "VASL1545-8192915E-5NTSEUM1-03YNFWNU",
    "vas_data": {
      "number_of_devices": 3,
      "items": [
        {
          "pos_id": "123",
          "shipping_address": "address of shipping",
          "name": "name of the device"
        },
        {
          "pos_id": "123",
          "shipping_address": "address of shipping",
          "name": "name of the device"
        }
      ]
    }
  }),
});

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

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/vas-enable",
    json={
        "payme_client_key": "icount",
        "seller_payme_id": "MPL15991-16765VD7-EMZAYZEV-31PXMITN",
        "vas_payme_id": "VASL1545-8192915E-5NTSEUM1-03YNFWNU",
        "vas_data": {
            "number_of_devices": 3,
            "items": [
                {
                    "pos_id": "123",
                    "shipping_address": "address of shipping",
                    "name": "name of the device",
                },
                {
                    "pos_id": "123",
                    "shipping_address": "address of shipping",
                    "name": "name of the device",
                },
            ],
        },
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "payme_client_key": "icount",
  "seller_payme_id": "MPL15991-16765VD7-EMZAYZEV-31PXMITN",
  "vas_payme_id": "VASL1545-8192915E-5NTSEUM1-03YNFWNU",
  "vas_data": {
    "number_of_devices": 3,
    "items": [
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      },
      {
        "pos_id": "123",
        "shipping_address": "address of shipping",
        "name": "name of the device"
      }
    ]
  }
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/vas-enable');
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` | string | The status code. |
| `seller_payme_id` | string | The unique seller ID. |
| `message` | string | The message for either success of failure. |

```json
{
  "status_code": 2,
  "seller_payme_id": "MPL16574-41620LKX-NMRDNAQV-ATOETSG8",
  "message": "Zendesk ticket created"
}
```
