# 2. New Card / Tokenization

## **Save New Card / Tokenization**

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/paywall/card/tokenization`

{% hint style="info" %}
**Important:** Card operations are highly secure transactions. Therefore, you must include the **apikeyprivate** and **apiclientprivate** parameters in the **Header**.\
\
[<mark style="color:green;">**CardWallAPI Address**</mark>](/payment-orchestration-integration-document/environment.md)
{% endhint %}

**The (HEADERS) parameters to be sent to the service are as follows:**

<table><thead><tr><th width="162">Parameter</th><th width="95.33984375">Type</th><th width="137.6953125">Compulsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeyprivate</td><td>string</td><td>Yes</td><td>The <strong>Private Key</strong> obtained from the merchant panel.</td></tr><tr><td>apiclientprivate</td><td>string</td><td>Yes</td><td>The <strong>Private Key</strong> obtained from the merchant panel.</td></tr></tbody></table>

#### The parameters that must be sent to the service (BODY) are as follows:

<table><thead><tr><th width="244">Parameter</th><th width="92">Type</th><th width="127">Compulsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>PartnerBased</td><td>bool</td><td>No</td><td>If the cards are to be stored in a shared pool within the scope of Partnership management, it should be used.</td></tr><tr><td>PartnerIdentity</td><td>string</td><td>Yes/No</td><td>If it will be registered within the scope of Partnership, the identity information of your Partner account.</td></tr><tr><td>RelationalId1</td><td>string</td><td>Yes</td><td>The unique information to which the card is requested to be linked.</td></tr><tr><td>RelationalId2</td><td>string</td><td>No</td><td>The second unique information to which the card is requested to be linked (all information must be sent during listing).</td></tr><tr><td>RelationalId3</td><td>string</td><td>No</td><td>The third unique information to which the card is requested to be linked (all information must be sent during listing).</td></tr><tr><td>Nickname</td><td>string</td><td>Yes</td><td>The alias name of the card (Example: My high-limit card).</td></tr><tr><td>CardToken</td><td>Guid</td><td>Yes</td><td>The tokenized card information itself, provided by the Client.</td></tr><tr><td>IncludeDetails</td><td>boolean</td><td>No</td><td>If you want the card details (BIN, Type, Brand, Bank, etc.) to be returned, you must send it as TRUE.</td></tr></tbody></table>

**A sample JSON file to be sent to the service is as follows**

{% tabs %}
{% tab title="JSON" %}

<pre class="language-json5" data-line-numbers><code class="lang-json5"><strong>{
</strong>    "PartnerBased": false,
    "PartnerIdentity": "",
    "RelationalId1": "1000923",
    "RelationalId2": "",
    "RelationalId3": "",
    "Card": {
        "CardToken": "580a3866-0055-4486-8c4b-96c8ac173e32",
        "Nickname": "Test Nickname"
    },
    "IncludeDetails": true
}
</code></pre>

{% endtab %}
{% endtabs %}

**The parameters returned from the service are as follows:**

<table><thead><tr><th width="189">Parameter</th><th width="100.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ErrorCode</td><td>int</td><td>Error code. Returns '0' if the operation is successful.</td></tr><tr><td>Result</td><td>bool</td><td>Returns a true or false value. If the operation is successful, it returns 'true'.</td></tr><tr><td>Message</td><td>string</td><td>If the operation fails, this is the message describing the error and provides language support based on the locale parameter.</td></tr><tr><td>Body</td><td>object</td><td>If the operation fails, this is the detail object related to the error.</td></tr></tbody></table>

{% tabs %}
{% tab title="JSON" %}
{% code lineNumbers="true" %}

```json
{
    "ErrorCode": 4,
    "Result": false,
    "Message": "Card already exists",
    "Body": {
        "Scope": 0,
        "Name": "Test Card",
        "CardBin": "55287900",
        "CardLastFour": "0008",
        "CardHolderName": "Kart Sahibi İsmi",
        "CardNumber": "55287900****0008",
        "Expired": false,
        "CardTypeId": 1,
        "CardType": "Credit",
        "Month": 12,
        "Year": 2030,
        "UniqueCode": "ZtuCwuJWMD+Jqju+ZRnw/X92WNSqFEo97slEjPZD6+5M40L75cT4+g==",
        "Details": {
            "CardBankId": 55,
            "CardBank": "T.HALK BANKASI A.Ş.",
            "CardBrandId": 1,
            "CardBrand": "Master Card",
            "CardFamilyId": 5,
            "CardFamily": "Paraf",
            "CardKindId": 1,
            "CardKind": "Bireysel Kart",
            "CardTypeId": 1,
            "CardType": "Credit"
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# 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://developer.paywall.one/payment-orchestration-integration-document/card-storage-service/card-saving/2.-new-card-tokenization.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.
