# Tokenization

Want to make your checkout experience faster? You can combine this integration with the Tokenization, so the next time your customers purchase, they don't need to input the credit card anymore.

* Tokenization

### Get Token List

If you've previously made payment and you or your customer choose to save the credit card info\
You may use this Get Token List API show the saved card of your customers.\
this API can be used to obtain token from other payment method such as OVO, BRI Direct Debit, Allobank, etc that also uses tokenization feature.

{% openapi src="<https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FYVrerNgrhedwri8svc22%2Fswagger-token-core.yaml?alt=media&token=b3e42f76-63fb-47a6-97c0-749d11e30ed0>" path="/tokenization/v2/get-token" method="post" %}
[swagger-token-core.yaml](https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FYVrerNgrhedwri8svc22%2Fswagger-token-core.yaml?alt=media\&token=b3e42f76-63fb-47a6-97c0-749d11e30ed0)
{% endopenapi %}

### Unbind Token

If you want to unbind the token, you can use the delete tokenization API below :

**API Request**

| Type                          | Value                                                       |
| ----------------------------- | ----------------------------------------------------------- |
| **HTTP Method**               | POST                                                        |
| **API endpoint (Sandbox)**    | `https://api-sandbox.doku.com`/tokenization/v2/delete-token |
| **API endpoint (Production)** | `https://api.doku.com`/tokenization/v2/delete-token         |

Here is the sample of request header to capture the transaction:

```
Client-Id: MCH-0001-10791114622547
Request-Id: 071a6a32-6785-4011-833d-d2c2049cf744
Request-Timestamp: 2021-08-24T08:46:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

Request Header Explanation

| Parameter             | Description                                                                                                                                                                                                                                                                                                                                           |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Client-Id**         | Client ID retrieved from DOKU Back Office                                                                                                                                                                                                                                                                                                             |
| **Request-Id**        | Unique random string (max 128 characters) generated from merchant side to protect duplicate request                                                                                                                                                                                                                                                   |
| **Request-Timestamp** | Timestamp request on UTC time in ISO8601 UTC+0 format. It means to proceed transaction on UTC+7 (WIB), merchant need to subtract time with 7. Ex: to proceed transaction on September 22th 2020 at 08:51:00 WIB, the timestamp should be 2020-09-22T01:51:00Z                                                                                         |
| **Signature**         | Security parameter that needs to be generated on merchant Backend and placed to the header request to ensure that the request is coming from valid merchant. Please refer to [this section](https://developers.doku.com/getting-started-with-doku-api/signature-component/non-snap/signature-component-from-request-header) to generate the signature |

Here is the sample request body to unbind the token:

```
{
  "token": {
    "id": "gateway-token"
  }
}
```

Request Body Explanation

| Parameter  | Type     | Mandatory | Description                            |
| ---------- | -------- | --------- | -------------------------------------- |
| `token.id` | `string` | Mandatory | Token ID that want to unbind or delete |

**API Response**

After hitting the above API request, DOKU will give the response.

| Type            | Value   |
| --------------- | ------- |
| **HTTP Status** | 200     |
| **Result**      | SUCCESS |

Here is the sample response header:

```
Client-Id: MCH-0001-10791114622547
Request-Id: b266c265-3d61-4708-9860-c0d5b9a98f8c
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=
```

Response Header Explanation

| Parameter              | Description                                                   |
| ---------------------- | ------------------------------------------------------------- |
| **Client-Id**          | Same as the request                                           |
| **Request-Id**         | Same as the request                                           |
| **Response-Timestamp** | Timestamp Response on UTC with format ISO8601 UTC+0 from DOKU |
| **Signature**          | Signature generated by DOKU based on the response body        |

Here is the sample of response body:

```json
{
  "token": {
    "id": "gateway-token",
    "status": "INACTIVE"
  }
}
```

Response Body Explanation

| Parameter      | Type     | Mandatory | Description                                                           |
| -------------- | -------- | --------- | --------------------------------------------------------------------- |
| `token.id`     | `string` | Mandatory | Token ID that want to unbind or delete                                |
| `token.status` | `string` | Mandatory | <p>Delete Process Status<br>Possible Value: <code>INACTIVE</code></p> |

{% hint style="info" %}
**Info**

To make sure the token has been unbinded, you can hit API Get token List.
{% endhint %}
