# Activate Service (Apple Pay)

This is a variant of [POST /vas-enable — Order New POS Device](/payments-migrated/point-of-sale-pos/post-vas-enable); the request and responses below are the ones documented for Apple Pay.

- 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): Your PayMe API Partner Key.
- Request body field `seller_payme_id` (required): The unique seller ID the service is activated for.
- Request body field `vas_payme_id` (required): The service activation unique partner ID.

## Overview

#### **Apple Pay VAS-Enable** 

In order to be able to use Apple Pay in our platform, you will need to set up the service via API. 

### Website Enrollment Procedure

After you added the Apple's file into the proper folder and path of your website, you can use our VAS Enable request to sign your website for the Apple Pay service on our platform. 

By using the Activate service API request, you will need to register your websites to PayMes system.

The request works as in the following form:

```json
{
  "payme_client_key": "payme_partner_key",
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
  "vas_data": {
      "websites": [
      "payme.io", "marketplace.payme.io"
      ]
  },
  "language": "en"
}
```

A successful response will be 200 and includes a payload in the form of:

```json
{
    "status_code": 0,
    "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
    "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
    "vas_description": "Payments Account",
    "vas_type": "AlternativePaymentMethod",
    "vas_api_key": "",
    "vas_is_active": true,
    "vas_payer_type": 2,
    "vas_price_currency": "ILS",
    "vas_price_setup_fixed": 0,
    "vas_price_periodic_fixed": 0,
    "vas_price_periodic_variable": "0.00",
    "vas_price_usage_fixed": 0,
    "vas_price_usage_variable": "0.00",
    "vas_market_fee": null,
    "vas_period": 1,
    "vas_data": {
        "websites": [
            "test5.paymeservice.com"
        ]
    }
}
```

A failed response will be 500 and includes a payload in the form of:
```json
{
    "status_code": 1,
    "status_error_details": "The service was not activated",
    "status_additional_info": null,
    "status_error_code": 720
}
```

## 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 | Your PayMe API Partner Key. |
| `seller_payme_id` | string | yes | The unique seller ID the service is activated for. |
| `vas_payme_id` | string | yes | The service activation unique partner ID. |
| `vas_data` | object | yes |  |
| `vas_data.websites` | array | yes | The websites domains the service is activated for. Example: `https://payme.io` |
| `language` | string | yes |  |

### Request example

```json
{
  "payme_client_key": "payme_partner_key",
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
  "vas_data": {
    "websites": [
      "payme.io",
      "marketplace.payme.io"
    ]
  },
  "language": "en"
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/vas-enable' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "payme_client_key": "payme_partner_key",
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
  "vas_data": {
    "websites": [
      "payme.io",
      "marketplace.payme.io"
    ]
  },
  "language": "en"
}'
```

### 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": "payme_partner_key",
    "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
    "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
    "vas_data": {
      "websites": [
        "payme.io",
        "marketplace.payme.io"
      ]
    },
    "language": "en"
  }),
});

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

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/vas-enable",
    json={
        "payme_client_key": "payme_partner_key",
        "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
        "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
        "vas_data": {
            "websites": [
                "payme.io",
                "marketplace.payme.io",
            ],
        },
        "language": "en",
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "payme_client_key": "payme_partner_key",
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
  "vas_data": {
    "websites": [
      "payme.io",
      "marketplace.payme.io"
    ]
  },
  "language": "en"
}
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` | number | 0 - Success 1 - Failure |
| `seller_payme_id` | string | Our unique seller ID. |
| `vas_payme_id` | string | The partner unique service API key. |
| `vas_description` | string | The description of the service that was activated. |
| `vas_type` | string | The type of the service that was activated. You can find all the VAS types [VAS Types](/guides-and-use-cases-migrated/lists-statuses/vas-types). |
| `vas_api_key` | string | Empty by default. |
| `vas_is_active` | boolean | Was the service activated successfully |
| `vas_payer_type` | number | Internal payer identity. 1 = Partner 2 = Seller 3 = Reseller |
| `vas_price_currency` | string | The currency that the service is charged in. |
| `vas_price_setup_fixed` | number | Partner account configuration of the setup costs. |
| `vas_price_periodic_fixed` | number | Partner account configuration of the periodical costs. |
| `vas_price_periodic_variable` | string | Partner account configuration of the periodical costs. |
| `vas_price_usage_fixed` | number | Partner account configuration of the fixed costs. |
| `vas_price_usage_variable` | string | Partner account configuration of the usage costs. |
| `vas_period` | number |  |
| `vas_data` | object | The peiod of the VAS charge. Instant = 1, Daily = 2, Monthly = 3, Yearly = 4 |
| `vas_data.websites` | array | The websites domains the service is activated for. |

```json
{
  "status_code": 0,
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "vas_payme_id": "VASLDEMO-VASLDEMO-VASLDEMO-1234567",
  "vas_description": "Payments Account",
  "vas_type": "AlternativePaymentMethod",
  "vas_api_key": "",
  "vas_is_active": true,
  "vas_payer_type": 2,
  "vas_price_currency": "ILS",
  "vas_price_setup_fixed": 0,
  "vas_price_periodic_fixed": 0,
  "vas_price_periodic_variable": "0.00",
  "vas_price_usage_fixed": 0,
  "vas_price_usage_variable": "0.00",
  "vas_market_fee": null,
  "vas_period": 1,
  "vas_data": {
    "websites": [
      "test5.paymeservice.com"
    ]
  }
}
```

### 500 — Request Failed (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | number | Status code - will always be 1 for failed requests. |
| `status_error_details` | string | Reasons for the failed request. |
| `status_additional_info` | string | Null |
| `status_error_code` | number | Error code for further support. |

```json
{
  "status_code": 1,
  "status_error_details": "The service was not activated",
  "status_additional_info": null,
  "status_error_code": 720
}
```
