# Создание платежа

### Процесс создания и проведения платежа

Суть процесса создания и проведения платежа заключается в следующей идее. Когда клиент в вашем магазине совершает действие, связанное с покупкой товара(-ов), например, нажимает на кнопку "Купить", вы отправляете запрос, описанный ниже, который генерирует ссылку на оплату товара(-ов) и возвращает её вам. С вашей стороны нужно лишь перенаправить пользователя на полученную ссылку, где он и совершит платеж. Дальше мы сами его обработаем: выдадим товары на сервере и пополним ваш баланс.

## Получение ссылки на оплату товара(-ов)

<mark style="color:blue;">`GET`</mark> `https://easydonate.ru/api/v3/shop/payment/create`

Запрос вернет ссылку на оплату товара(-ов).

#### Query Parameters

| Name                                         | Type    | Description                                                                                                 |
| -------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| customer<mark style="color:red;">\*</mark>   | string  | Никнейм покупателя                                                                                          |
| server\_id<mark style="color:red;">\*</mark> | integer | Идентификатор сервера. Можно найти в настройках магазина, в разделе "Серверы"                               |
| products<mark style="color:red;">\*</mark>   | object  | JSON объект вида {"23": 3, "24": 1}, где ключом является идентификатор товара, а значением - его количество |
| email<mark style="color:red;">\*</mark>      | string  | Email покупателя                                                                                            |
| coupon                                       | string  | Купон на скидку. Настраивается в настройках магазина, в разделе "Купоны"                                    |
| success\_url                                 | string  | URL успешной оплаты. Сюда будет перенаправлен клиент после успешной оплаты товаров                          |

#### Headers

| Name                                       | Type   | Description              |
| ------------------------------------------ | ------ | ------------------------ |
| Shop-Key<mark style="color:red;">\*</mark> | string | Уникальный ключ магазина |

{% tabs %}
{% tab title="200: OK Запрос успешно обработан." %}

```
{
    "success": true,
    "response": {
        "url": "https://pay.easydonate.ru/EFgesFE",
        "payment": {
            "id": 118305,
            "customer": "DontFollow",
            "email": null,
            "server_id": 64336,
            "payment_type": false,
            "shop_id": 531,
            "updated_at": "2021-04-20 23:24:12",
            "created_at": "2021-04-20 23:24:12",
            "enrolled": 0.97,
            "cost": 1,
            "server": {
               "id": 64336,
               "name": "Выживание",
               "ip": "127.0.0.1",
               "port": "25565",
               "version": "",
               "is_port_hidden": 0,
               "hide_ip": 0,
               "is_hidden": 0,
               "shop_id": 531,
               "created_at": "2021-02-22 17:44:47",
               "updated_at": "2021-04-20 23:19:31"
            },
            "products": [
               {
                  "id": 121620,
                  "product_id": 6074,
                  "name": "Алмазный меч",
                  "price": 1,
                  "old_price": null,
                  "type": "item",
                  "number": 1,
                  "commands": [
                     "give {user} 276 {amount}"
                  ],
                  "additional_fields": null,
                  "description": null,
                  "payment_id": 118305,
                  "amount": 1,
                  "image": "http://cp.easydonate.ru/storage/app/media/Diamond%20Sword-min.png",
                  "first_delete": 0,
                  "created_at": "2021-04-20 23:24:12",
                  "updated_at": "2021-04-20 23:24:12"
               }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="404: Not Found Ошибка" %}

```
{
    "success": false,
    "response": "Товар с ID 6074 не найден в магазине.",
    "error_code": 2
}
```

{% endtab %}
{% endtabs %}

{% content-ref url="products" %}
[products](https://docs.easydonate.ru/shop/products)
{% endcontent-ref %}

{% content-ref url="servers" %}
[servers](https://docs.easydonate.ru/shop/servers)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.easydonate.ru/shop/payment-create.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
