# Update Price

- Sandbox: `PATCH https://sandbox.payme.io/api/subscriptions/{sub_id}/set-price`
- Production: `PATCH https://live.payme.io/api/subscriptions/{sub_id}/set-price`

## Credentials

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

## Overview


This endpoint is used to update a subscription price.
This will apply subscriptions in status "active" or subscription template in status "initial".

You can find more information in our guide - [Subscriptions
](/payments-migrated/subscriptions/post-generate-subscription).

## Parameters

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

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seller_payme_id` | string | yes | MPL. Your private key in PayMe system. |
| `sub_price` | string | yes | A single iteration final price. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075. Note that the minimum value is 500 |

### Request example

```json
{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sub_price": 500
}
```

## Code samples

### curl

```bash
curl -X PATCH 'https://sandbox.payme.io/api/subscriptions/<sub_id>/set-price' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sub_price": 500
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/subscriptions/<sub_id>/set-price", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
    "sub_price": 500
  }),
});

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

### Python

```python
import requests

response = requests.patch(
    "https://sandbox.payme.io/api/subscriptions/<sub_id>/set-price",
    json={
        "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
        "sub_price": 500,
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sub_price": 500
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/subscriptions/<sub_id>/set-price');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    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)> Allowed values `0` `1` |

### 400 (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer | Status of the request (0 - success, 1 - error)> Allowed values `0` `1` |
| `status_error_details` | string |  |
| `status_additional_info` | string |  |
| `status_error_code` | number |  |
