# Привязка карты

1. Создание транзакции для привязки карты с указанием project\_client\_id.
2. Создается платеж на 10тг.
3. Мерчант перенаправляет на страницу оплаты. &#x20;
4. После проведения платежа  происходит возврат 10тг.

{% hint style="info" %}
Результат привязки карты мерчант можете узнать в методе [получения списка привязанных карт пользователя](broken://pages/NUtlqVz5wJmuviFTrYpZ), [Webhook ](/platezhnyi-shlyuz/webhook-platezhnoi-sistemy/status-oplaty.md)отправляется после списания средств. При последующих оплатах пользователю будут доступны ранее привязанные карты.
{% endhint %}

## Создание транзакции для привязки карты

<mark style="color:green;">`POST`</mark> `https://prapi.tarlanpayments.kz/transaction/api/v1/transaction/primal/card-link`

#### Headers

| Name                                            | Type   | Description                                                                                         |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer  Авторотационный хэш (см [Формирование подписи](/platezhnyi-shlyuz/formirovanie-podpisi.md)) |

#### Request Body

| Name                                                     | Type    | Description                                                                                                                                                               |
| -------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| project\_id<mark style="color:red;">\*</mark>            | Integer | Идентификатор проекта присваиваемый платежной системой                                                                                                                    |
| merchant\_id<mark style="color:red;">\*</mark>           | Integer | Идентификатор мерчанта присваиваемый платежной системой                                                                                                                   |
| project\_client\_id<mark style="color:red;">\*</mark>    | String  | Идентификатор клиента на стороне проекта                                                                                                                                  |
| success\_redirect\_url<mark style="color:red;">\*</mark> | String  | Страница проекта на которую будет выполнен редирект пользователя после успешной оплаты                                                                                    |
| failure\_redirect\_url<mark style="color:red;">\*</mark> | String  | Страница проекта на которую будет выполнен редирект пользователя после неуспешной оплаты. Если параметр не был передан, редирект будет выполнен на `success_redirect_url` |
| description<mark style="color:red;">\*</mark>            | String  | Описание платежа (50 символов)                                                                                                                                            |
| additional\_data                                         | Object  | Дополнительные параметры                                                                                                                                                  |
| callback\_url                                            | String  | URL проекта для оправки коллбэка со статусом транзакции (см [Отправка callback](/platezhnyi-shlyuz/webhook-platezhnoi-sistemy/status-oplaty.md))                          |

{% tabs %}
{% tab title="200: OK Пример успешного ответа" %}

```json
{
    "status": true,
    "message": "Success",
    "result": "https://process.tarlanpayments.kz?hash=$2a$10$nhrUYWm9sDVYqCL4LKxn9ugrdC4Pszz5wGaUsDYYIqCGc8ZA4Vu0y&transaction_id=100474"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Пример ответа с ошибкой" %}

```json
{
    "status": false,
    "status_code": 5000,
    "message": "transaction already exists",
    "result": {}
}
```

{% endtab %}
{% endtabs %}

{% code fullWidth="true" %}

```bash
curl --location 'https://prapi.tarlanpayments.kz/transaction/api/v1/transaction/primal/card-link'  \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sign' \
--data-raw '{
    "callback_url": "https://test.site/callback_url",
    "description": "desc",
    "failure_redirect_url": "https://www.test.com",
    "merchant_id": 2222,
    "project_client_id": "999",
    "project_id": 111,
    "success_redirect_url": "https://www.test.com",
    "additional_data": {
        "test": "value",
        "qwerty": "123"
    }
}'
```

{% endcode %}


---

# 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.tarlanpayments.kz/platezhnyi-shlyuz/vzaimodeistvie-s-formoi-oplaty/privyazka-karty.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.
