# Get CreditCard Token

#### Request Base URL <a href="#request-base-url" id="request-base-url"></a>

```
  Test Environment: https://security-test.pagsmile.com
  Prod Environment: https://security.pagsmile.com
```

#### EndPoints <a href="#endpoints" id="endpoints"></a>

```
  /card/tokenize
```

#### Request Header <a href="#request-header" id="request-header"></a>

| Parameter     | Required  | Description                         |
| ------------- | --------- | ----------------------------------- |
| Content-Type  | recommend | application/json                    |
| Authorization | yes       | Basic Base64(app\_id:security\_key) |

#### Request Body (JSON format) <a href="#request-body-json-format" id="request-body-json-format"></a>

| Parameter                         | Type   | Required                                 | Max Length(or Default Value) | Description                   |
| --------------------------------- | ------ | ---------------------------------------- | ---------------------------- | ----------------------------- |
| app\_id                           | string | yes                                      | 32                           | created app's id at dashboard |
| timestamp                         | string | yes                                      | 19                           | yyyy-MM-dd HH:mm:ss           |
| card.card\_no                     | string | yes                                      | 32                           |                               |
| card.issuer                       | string | yes                                      | 16                           | visa,mastercard...            |
| card.holder.name                  | string | yes                                      | 64                           |                               |
| card.holder.identification.type   | string | no                                       | 16                           |                               |
| card.holder.identification.number | string | yes. Not required for Chile, Costa Rica. | 64                           |                               |
| card.cvv                          | string | yes. Not required for Costa Rica.        | 8                            | security code                 |
| card.valid\_thru\_year            | string | yes                                      | 4                            | expire year                   |
| card.valid\_thru\_month           | string | yes                                      | 2                            | expire month                  |

#### Request Sample <a href="#request-sample" id="request-sample"></a>

```
curl --location --request POST 'https://security.pagsmile.com/card/tokenize' \
--header 'Authorization: Basic Base64(appid:security_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1629***13",
    * "timestamp": "2025-10-24 13:18:10",
    * "card": {
    *   "card_no": "545195******2434",
    *   "issuer": "",
    *   "holder": {
    *       "name": ""
        },
    *   "cvv": "",
    *   "valid_thru_year": "2030",
    *   "valid_thru_month": "08"
      } 
}'
```

#### Http Response (JSON format) <a href="#http-response-json-format" id="http-response-json-format"></a>

| Parameter | Type   | Description                 |
| --------- | ------ | --------------------------- |
| code      | string | return code                 |
| msg       | string | return msg                  |
| sub\_code | string | return sub code(only error) |
| sub\_msg  | string | return sub msg(only error)  |
| token     | string |                             |

#### Return Code (Success) <a href="#return-code-success" id="return-code-success"></a>

```
{
    "code": "10000",
    "msg": "Success",
    "token": "{token}",
}
```

#### Return Code (Fail) <a href="#return-code-fail" id="return-code-fail"></a>

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "invalid-signature",
    "sub_msg": "invalid signature"
}
```


---

# 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.pagsmile.com/payin/tools/tokenize.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.
