> For the complete documentation index, see [llms.txt](https://docs.tarlanpayments.kz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tarlanpayments.kz/eng/acquiring/interaction-with-the-payment-method/card-link.md).

# Card link

1. Creation of an action for card linking with reference to project\_client\_id.
2. Creation of payment amounting to KZT 10.
3. Merchant redirects to the payment page.
4. When the payment is proceeded, KZT 10 refunded.

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

## Creating a transaction to link a card

<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 Auto-rotation hash (see Signature Creating) |

#### Request Body

| Name                                                     | Type    | Description                                                                                                                                                                     |
| -------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| project\_id<mark style="color:red;">\*</mark>            | Integer | Project ID                                                                                                                                                                      |
| merchant\_id<mark style="color:red;">\*</mark>           | Integer | Merchant ID                                                                                                                                                                     |
| project\_client\_id<mark style="color:red;">\*</mark>    | String  | Client ID on the project side                                                                                                                                                   |
| success\_redirect\_url<mark style="color:red;">\*</mark> | String  | Project page to which the user will be redirected after successful payment                                                                                                      |
| failure\_redirect\_url<mark style="color:red;">\*</mark> | String  | Project page to which the user will be redirected after unsuccessful payment. If the value parameter was not uploaded, the redirect will be performed to success\_redirect\_url |
| description<mark style="color:red;">\*</mark>            | String  | Description of payment (50 symbols)                                                                                                                                             |
| additional\_data                                         | Object  | More Options                                                                                                                                                                    |
| callback\_url                                            | String  | Project URL for sending callback with transaction status (see Sending callback)                                                                                                 |

{% tabs %}
{% tab title="200: OK Example of a successful response" %}

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

{% endtab %}

{% tab title="500: Internal Server Error Example of an error response" %}

```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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.tarlanpayments.kz/eng/acquiring/interaction-with-the-payment-method/card-link.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
