# Indomaret

DOKU has partnered with various partners and one of them is Indomaret to provide O2O Payment. Learn more about how DOKU can help you integrate with Indomaret here.

***

### Integration steps <a href="#integration-steps" id="integration-steps"></a>

Here is the overview of how to integrate with O2O:

1. Generate payment code
2. Display payment code
3. Acknowledge payment result

#### Direct API - O2O Sequence Diagram

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FXYmKdQ2yfJadTcRBVlSp%2F14.1-Indomaret-Doku-Generated.jpg?alt=media&#x26;token=31493a7a-8f82-474d-8cf6-0a9b6d44f785" alt=""><figcaption></figcaption></figure>

***

#### 1. Generate payment code <a href="#id-1-generate-payment-code" id="id-1-generate-payment-code"></a>

To generate payment code, you will need to hit this API through your Backend:

**API Request**

<table><thead><tr><th width="242">Type</th><th>Value</th></tr></thead><tbody><tr><td><strong>HTTP Method</strong></td><td>POST</td></tr><tr><td><strong>API endpoint (Sandbox)</strong></td><td><code>https://api-sandbox.doku.com/indomaret-online-to-offline/v2/payment-code</code></td></tr><tr><td><strong>API endpoint (Production)</strong></td><td><code>https://api.doku.com/indomaret-online-to-offline/v2/payment-code</code></td></tr></tbody></table>

Here is the sample of request header to generate payment code:

```
Client-Id: MCH-0001-10791114622547
Request-Id: 5b8e438f-fac1-4103-9e0e-ebfdc38b5acb
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

#### Request Header Explanation&#x20;

<table><thead><tr><th width="207">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Client-Id</strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong>Request-Id</strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong>Request-Timestamp</strong></td><td>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</td></tr><tr><td><strong>Signature</strong></td><td>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 <a href="../../../../get-started-with-doku-api/signature-component/non-snap/signature-from-api-get-method">this section</a> to generate the signature</td></tr></tbody></table>

Here is the sample of request body to generate payment code:

```json
{
    "order": {
        "invoice_number": "INV-2021002-0001",
        "amount": 150000
    },
    "online_to_offline_info": {
        "expired_time": 60,
        "reusable_status": true,
        "info": "Thanks for shopping in jokul.com"
    },
    "customer": {
        "name":"Taufik Ismail",
        "email":"taufik@doku.com"
    },
    "indomaret_info": {
        "receipt": {
            "description": "Voucher 10000",
            "footer_message": "Call 13555 for customer support"
        },
    },
    "additional_info": {
        "override_notification_url": "https://another.example.com/payments/notifications"
    }
}
```

**Request Body Explanation**

<table><thead><tr><th width="174">Parameter</th><th width="83">Type </th><th width="115">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td>string</td><td>Mandatory</td><td>Generated by merchant to identify the order and must unique per request<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>64</code></td></tr><tr><td><code>order.amount</code></td><td>number</td><td>Mandatory</td><td>In IDR currency and without decimal<br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></td></tr><tr><td><code>online_to_offline_info.</code><br><code>expired_time</code></td><td>number</td><td>Optional</td><td>Payment Code expiration time in minutes format<br>Allowed chars: <code>numeric</code><br>Maximum length: <code>8</code><br>Default value: <code>60</code></td></tr><tr><td><code>online_to_offline_info.</code><br><code>reusable_status</code></td><td>string</td><td>Mandatory</td><td>For payment code that can be paid more than once, set this to <code>true</code><br>Possible value: <code>true</code> <code>false</code></td></tr><tr><td><code>online_to_offline_info.info</code></td><td>string</td><td>Optional</td><td>Additional info that will be display on the acquirer channel when customer do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>32</code></td></tr><tr><td><code>customer.name</code></td><td>string</td><td>Mandatory</td><td>Customer name that will be displayed on acquirer channel when do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>64</code></td></tr><tr><td><code>customer.email</code></td><td>string</td><td>Optional</td><td>Customer email<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>128</code></td></tr><tr><td><code>indomaret_info.receipt.</code><br><code>description</code></td><td>string</td><td>Mandatory</td><td>Message that will be printed on the receipt as Product Description that given to the customer<br><br>Max length: <code>128</code></td></tr><tr><td><code>indomaret_info.receipt.</code><br><code>footer_message</code></td><td>string</td><td>Optional</td><td>Message that will be printed on the receipt as footer message that given to the customer<br><br>Max length: <code>255</code></td></tr><tr><td><code>additional_info.override_notification_url</code></td><td>string</td><td>Optional</td><td>This parameter is intended to override the configured <code>Notification URL</code> with another URL. Click <a href="../../../../get-started-with-doku-api/notification/override-notification-url">here</a> for more information.</td></tr></tbody></table>

**API Response**

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

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

```
Client-Id: MCH-0001-10791114622547
Request-Id: 5b8e438f-fac1-4103-9e0e-ebfdc38b5acb
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

#### Response Header Explanation

<table><thead><tr><th width="207">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Client-Id</strong></td><td>Same as the request</td></tr><tr><td><strong>Request-Id</strong></td><td>Same as the request</td></tr><tr><td><strong>Request-Timestamp</strong></td><td>Timestamp Response on UTC with format ISO8601 UTC+0 from DOKU</td></tr><tr><td><strong>Signature</strong></td><td>Signature generated by DOKU based on the response body</td></tr></tbody></table>

Here is the sample of response body:

```json
{
    "order": {
        "invoice_number": "INV-2021002-0001"
    },
    "online_to_offline_info": {
        "payment_code": "8888888844445555",
        "how_to_pay_page": "https://sandbox.doku.com/indomaret-online-to-offline/v2/how-to-pay-page/8888888844445555",
        "how_to_pay_api": "https://api-sandbox.doku.com/indomaret-online-to-offline/v2/how-to-pay-api/8888888844445555",
        "created_date": "20210624141049",
        "created_date_utc": "2021-06-24T07:10:49Z",
        "expired_date": "20210624151049",
        "expired_date_utc": "2021-06-24T08:10:49Z"
    },
    "additional_info": {
        "override_notification_url": "https://another.example.com/payments/notifications"
    }
}
```

**Response Body Explanation**

<table><thead><tr><th width="174">Parameter</th><th width="83">Type </th><th width="115">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td>string</td><td>Mandatory</td><td>Same as the request</td></tr><tr><td><code>online_to_offline_info.</code><br><code>payment_code</code></td><td>string</td><td>Mandatory</td><td>Generated by DOKU that will be used by customer for doing a payment through the Indomaret Store</td></tr><tr><td><code>online_to_offline_info.created_date</code></td><td>string</td><td>Conditional</td><td>Date time of Payment Code generated with the format of <code>yyyyMMddHHmmss</code>. The created date uses UTC+7 time</td></tr><tr><td><code>online_to_offline_info.</code><br><code>expired_date</code></td><td>string</td><td>Conditional</td><td>Date time of Payment Code will be expired with the format of <code>yyyyMMddHHmmss</code>. The expired date uses UTC+7 time. Use this to set the expiry order on merchant side</td></tr><tr><td><code>online_to_offline_info.created_date_utc</code></td><td>string</td><td>Conditional</td><td>Date time of Payment Code generated in UTC format</td></tr><tr><td><code>online_to_offline_info.expired_date_utc</code></td><td>string</td><td>Conditional</td><td>Date time of Payment Code will be expired in UTC. Use this to set the expiry order on merchant side</td></tr><tr><td><code>online_to_offline_info.how_to_pay_page</code></td><td>string</td><td>Optional</td><td>Page URL that merchant can use to display how customer can complete the payment process through the Indomaret Store</td></tr><tr><td><code>online_to_offline_info.how_to_pay_api</code></td><td>string</td><td>Optional</td><td>URL that merchant can parse to display customized how customer can complete the payment process through the Indomaret Store</td></tr><tr><td><code>additional_info.override_notification_url</code></td><td>string</td><td>Optional</td><td>Same as the request</td></tr></tbody></table>

{% hint style="success" %}
**Pro Tips**

You can also show payment instruction link to your customer by using `online_to_offline_info.how_to_pay_page`. If you wish to customize the UI for the payment instruction, you can use the `online_to_offline_info.how_to_pay_api`.
{% endhint %}

***

#### 2. Display payment code <a href="#id-2-display-payment-code" id="id-2-display-payment-code"></a>

You can display the payment code to your customer by using `online_to_offline_info.payment_code` that you retrieved from the API response.

***

#### 3. Acknowledge payment result <a href="#id-3-acknowledge-payment-result" id="id-3-acknowledge-payment-result"></a>

After the payment is being made by your customer, DOKU will send **HTTP Notification** to your defined `Notification URL`. Learn how to handle the notification from DOKU:

* [Handling DOKU HTTP Notification](https://developers.doku.com/get-started-with-doku-api/notification/http-notification-sample-non-snap)

***

### Additional features <a href="#additional-features" id="additional-features"></a>

We provide various additional features to suited your needs. Learn more here.

#### Split Settlement <a href="#split-settlement" id="split-settlement"></a>

If you are a platform or a marketplace, you can use this feature to settle the funds to your sellers or partners programmatically, save many operational efforts.

* Settlement

***

### What's next? <a href="#whats-next" id="whats-next"></a>

You can test your payment through our Payment Simulator. Learn more here.
