# Alfa Group

DOKU has partnered with various partners and one of them is Alfa Group (Alfamart, Alfaexpress, Alfamidi, Lawson, Dan+Dan) to provide O2O Payment. Learn more about how DOKU can help you integrate with Alfa Group here.

***

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

There are two methods to integrate with Alfa Group:

1. **Register**: The payment code will be registered to DOKU and Alfa will inquiry to our side when the customer make payment at the Alfa Store
   1. **DOKU Generated Payment Code (DGPC)**: The payment code is generated by DOKU. Suitable for e-commerce business model.
   2. **Merchant Generated Payment Code (MGPC)**: The payment code is generated by Merchant. Suitable for top up business model.
2. **Direct Inquiry (DIPC)**: The payment code is registered on merchant side and DOKU will forward Alfa inquiry request to merchant side when the customer make payment at the Alfa store

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

{% tabs %}
{% tab title="DOKU Generate Payment Code" %}
Here is the overview of how to integrate with Online to Offline:

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

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FaV8mNyLoCWBkVDqYWdbN%2Fimage%20(36).png?alt=media&#x26;token=9045f5ce-d68a-4db9-ab57-78d01ec86f47" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FRi0fM5TcIEaXYjOQ0P3q%2Fimage.png?alt=media&#x26;token=17f548dc-866c-4069-a14c-383bda443595" 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**

| Type                          | Value                                                               |
| ----------------------------- | ------------------------------------------------------------------- |
| **HTTP Method**               | POST                                                                |
| **API endpoint (Sandbox)**    | `https://api-sandbox.doku.com/alfa-virtual-account/v2/payment-code` |
| **API endpoint (Production)** | `https://api.doku.com/alfa-virtual-account/v2/payment-code`         |

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

```
Client-Id: MCH-0001-10791114622547
Request-Id: d24a5644-6078-4249-8740-4a6dcd92df5a
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></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><code>signature</code></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="https://dashboard.doku.com/docs/docs/technical-references/generate-signature">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-20210124-0001",
        "amount": 150000
    },
    "online_to_offline_info": {
        "expired_time": 60,
        "reusable_status": false,
        "info": "Merchant Demo Store"
    },
    "customer": {
        "name": "Anton Budiman",
        "email": "anton@example.com"
    },
    "additional_info": {
        "override_notification_url": "https://another.example.com/payments/notifications"
    }
}
```

**Request Body Explanation**

| Parameter                                   | Type     | Mandatory | Description                                                                                                                                                                                                                 |
| ------------------------------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `order.invoice_number`                      | `string` | Mandatory | <p>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></p>                                             |
| `order.amount`                              | `number` | Mandatory | <p>In IDR currency and without decimal. Alfa only supports <code>Close Amount</code><br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></p>                                                              |
| `online_to_offline_info.expired_time`       | `number` | Optional  | <p>Payment code expiration time in minutes format<br>Allowed chars: <code>numeric</code><br>Maximum length: <code>5</code><br>Default value: <code>60</code></p>                                                            |
| `online_to_offline_info.reusable_status`    | `number` | Mandatory | <p>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></p>                                                                              |
| `online_to_offline_info.info`               | `string` | Optional  | <p>Additional info that will be display on the Alfa POS when customer do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>30</code></p>                                       |
| `customer.name`                             | `string` | Mandatory | <p>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></p>                                            |
| `customer.email`                            | `string` | Optional  | <p>Customer email<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>128</code></p>                                                                                                     |
| `additional_info.override_notification_url` | `string` | Optional  | This parameter is intended to override the configured `Notification URL` with another URL. Click [here](https://developers.doku.com/get-started-with-doku-api/notification/override-notification-url) for more information. |

**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: d24a5644-6078-4249-8740-4a6dcd92df5a
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></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><code>signature</code></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="https://dashboard.doku.com/docs/docs/technical-references/generate-signature">this section</a> to generate the signature</td></tr></tbody></table>

Here is the sample of response body:

```json
{
    "order": {
        "invoice_number": "INV-20210124-0001"
    },
    "online_to_offline_info": {
        "payment_code": "6059000000000205",
        "how_to_pay_page": "https://sandbox.doku.com/how-to-pay/v2/alfa-online-to-offline/6059000000000205",
        "how_to_pay_api": "https://api-sandbox.doku.com/alfa-online-to-offline/v2/how-to-pay-api/6059000000000205",
        "created_date": "20210331115005",
        "expired_date": "20210331125005",
        "created_date_utc": "2021-03-31T04:50:05Z",
        "expired_date_utc": "2021-03-31T05:50:05Z"
    },
    "additional_info": {
        "override_notification_url": "https://another.example.com/payments/notifications"
    }
}
```

#### Response Body Explanation

<table><thead><tr><th>Parameter</th><th width="121">Type</th><th width="116">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></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><code>string</code></td><td>Mandatory</td><td>Generated by DOKU that will be used by customer for doing a payment through Alfa store</td></tr><tr><td><code>online_to_offline_info.how_to_pay_page</code></td><td><code>string</code></td><td>Optional</td><td>Page URL that merchant can use to display how customer can complete the payment process through Alfa store</td></tr><tr><td><code>online_to_offline_info.how_to_pay_api</code></td><td><code>string</code></td><td>Optional</td><td>URL that merchant can parse to display customized how customer can complete the payment process through Alfa store</td></tr><tr><td><code>online_to_offline_info.created_date</code></td><td><code>string</code></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.expired_date</code></td><td><code>string</code></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><code>string</code></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><code>string</code></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>additional_info.override_notification_url</code></td><td><code>string</code></td><td>Optional</td><td>Same as the request</td></tr></tbody></table>

{% hint style="info" %}
**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)
  {% endtab %}

{% tab title="Merchant Generate Payment Code" %}
Here is the overview of how to integrate with Online to Offline:

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

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FvjaBLDDKXOUqeTI1Y0op%2Fimage.png?alt=media&#x26;token=56c88f76-8382-49fb-b1a0-0a57b2d4b21f" 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**

| Type                          | Value                                                                          |
| ----------------------------- | ------------------------------------------------------------------------------ |
| **HTTP Method**               | POST                                                                           |
| **API endpoint (Sandbox)**    | <https://api-sandbox.doku.com/alfa-online-to-offline/v2/merchant-payment-code> |
| **API endpoint (Production)** | <https://api.doku.com/alfa-online-to-offline/v2/merchant-payment-code>         |

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

```
Client-Id: MCH-0001-10791114622547
Request-Id: d24a5644-6078-4249-8740-4a6dcd92df5a
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></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><code>signature</code></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="https://dashboard.doku.com/docs/docs/technical-references/generate-signature">this section</a> to generate the signature</td></tr></tbody></table>

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

```
{
    "order": {
        "invoice_number": "INV-20210124-0001",
        "amount": 150000
    },
    "online_to_offline_info": {
        "payment_code": "1900600000000046",
        "expired_time": 60,
        "reusable_status": false,
        "info": "Merchant Demo Store",
    },
    "customer": {
        "name": "Anton Budiman",
        "email": "anton@example.com"
    }
}
```

#### Request Body Explanation

<table><thead><tr><th>Parameter</th><th width="104">Type</th><th width="128">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></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><code>number</code></td><td>Mandatory</td><td>In IDR currency and without decimal. Alfa only supports <code>Close Amount</code><br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></td></tr><tr><td><code>online_to_offline_info.</code><br><code>payment_code</code></td><td><code>string</code></td><td>Mandatory</td><td>Generated by Merchant that will be used by customer for doing a payment through Alfa store<br>Max Length: <code>20</code></td></tr><tr><td><code>online_to_offline_info.expired_time</code></td><td><code>number</code></td><td>Optional</td><td>Payment code expiration time in minutes format<br>Allowed chars: <code>numeric</code><br>Maximum length: <code>5</code><br>Default value: <code>60</code></td></tr><tr><td><code>online_to_offline_info.reusable_status</code></td><td><code>number</code></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><code>string</code></td><td>Optional</td><td>Additional info that will be display on the Alfa POS when customer do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>30</code></td></tr><tr><td><code>customer.name</code></td><td><code>string</code></td><td>Mandatory</td><td>Customer name that will be displayed on Alfa POS 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><code>string</code></td><td>Optional</td><td>Customer email<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>128</code></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: d24a5644-6078-4249-8740-4a6dcd92df5a
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></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><code>signature</code></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="https://dashboard.doku.com/docs/docs/technical-references/generate-signature">this section</a> to generate the signature</td></tr></tbody></table>

Here is the sample of response body:

```
{
    "order": {
        "invoice_number": "INV-20210124-0001"
    },
    "online_to_offline_info": {
        "payment_code": "1900600000000046",
        "how_to_pay_page": "https://sandbox.doku.com/how-to-pay/v1/alfa-online-to-offline/1900600000000046",
        "how_to_pay_api": "https://sandbox.doku.com/alfa-online-to-offline/v1/how-to-pay-api/1900600000000046",
        "created_date": "20200313095850",
        "expired_date": "20200313155850",
        "created_date_utc": "2020-03-31T09:58:50Z",
        "expired_date_utc": "2020-03-31T15:58:50Z"
    }
}
```

Response Body Explanation

Response Body Explanation

<table><thead><tr><th width="228">Parameter</th><th width="100">Type</th><th width="119">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></td><td>Mandatory</td><td>Same as the request</td></tr><tr><td><code>online_to_offline_info.</code><br><code>payment</code></td><td><code>string</code></td><td>Mandatory</td><td>Generated by DOKU that will be used by customer for doing a payment through Alfa store</td></tr><tr><td><code>online_to_offline_info.how_to_pay_page</code></td><td><code>string</code></td><td>Optional</td><td>Page URL that merchant can use to display how customer can complete the payment process through Alfa store</td></tr><tr><td><code>online_to_offline_info.how_to_pay_api</code></td><td><code>string</code></td><td>Optional</td><td>URL that merchant can parse to display customized how customer can complete the payment process through Alfa store</td></tr><tr><td><code>online_to_offline_info.created_date</code></td><td><code>string</code></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.expired_date</code></td><td><code>string</code></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><code>string</code></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><code>string</code></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></tbody></table>

{% hint style="info" %}
**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)
  {% endtab %}

{% tab title="Direct Inquiry" %}
Here is the overview of how to integrate with Alfa Group:

1. Setup `Inquiry URL`
2. Generate payment code
3. Receive inquiry request from DOKU
4. Acknowledge payment result

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FPm3HQZQdQudJrzBj6Vff%2Fimage.png?alt=media&#x26;token=777c178f-91a3-41f2-9615-4f78031e9c64" alt=""><figcaption></figcaption></figure>

1. **Setup Inquiry URL**

To receive the inquiry request from DOKU. You must set your `Inquiry URL` to DOKU. Please contact our team for the setup.

Please inform the `Inquiry URL` for Sandbox environment and Production environment.

2. **Generate Payment Code**

Generate payment is done in your system. The payment code length maximum is `20` digits.

3. **Receive Inquiry Request from DOKU**

#### API Request&#x20;

DOKU will hits your `Inquiry URL` with the following API request:

| Type        | Value |
| ----------- | ----- |
| HTTP Method | POST  |

Here is the sample of request header that DOKU generated for inquiry:

```json
Client-Id: MCH-0001-10791114622547
Request-Id: d24a5644-6078-4249-8740-4a6dcd92df5a
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

Request Header Explanation

<table><thead><tr><th width="208">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 DOKU 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 verified on merchant Backend to ensure that the request is coming from DOKU. Please refer to <a href="https://dashboard.doku.com/docs/docs/technical-references/generate-signature">this section</a> to generate the signature</td></tr></tbody></table>

Here is the sample of request body that DOKU will send to defined `Inquiry URL`:

```json
{
    "service": {
        "id":"ONLINE_TO_OFFLINE"
    },
    "acquirer": {
        "id":"ALFA"
    },
    "channel": {
        "id":"ONLINE_TO_OFFLINE_ALFA"
    },
    "online_to_offline_info": {
        "payment_code":"8896512345678123"
    },
    "online_to_offline_inquiry": {
        "date":"2020-08-11T08:45:42Z",
        "identifier": [
        ]
    }
}
```

#### **Request Body Explanation**

| Parameter                              | Type     | Mandatory | Description                                                                                               |
| -------------------------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------- |
| `service.id`                           | `string` | Mandatory | Value: `ONLINE_TO_OFFLINE`                                                                                |
| `acquirer.id`                          | `string` | Mandatory | Value: `ALFA`                                                                                             |
| `channel.id`                           | `string` | Mandatory | Value: `ONLINE_TO_OFFLINE_ALFA`                                                                           |
| `online_to_offline_info.payment_code`  | `number` | Mandatory | Payment code that is inquired by the customer                                                             |
| `online_to_offline_inquiry.date`       | `string` | Mandatory | Timestamp request on UTC time in ISO8601 format                                                           |
| `online_to_offline_inquiry.identifier` | `array`  | Optional  | List of transaction identifier that coming from the acquiring. Merchant can save these data for reference |

**API Response**[**​**](https://dashboard.doku.com/docs/docs/jokul-direct/e-money/shopeepay-guide/#api-response)

After DOKU hits your `Inquiry URL` with the above API request, you must give the following response:

<table><thead><tr><th width="608">Type</th><th>Value</th></tr></thead><tbody><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>success</code></td><td>200</td></tr><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>decline</code></td><td>400</td></tr><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>billing_already_paid</code></td><td>400</td></tr><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>billing_was_expired</code></td><td>400</td></tr><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>billing_not_found</code></td><td>404</td></tr><tr><td><strong>HTTP Status</strong> for <code>online_to_offline_inquiry.status</code> = <code>invalid_signature</code></td><td>401</td></tr></tbody></table>

```json
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="144">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>Response-Timestamp</strong></td><td>Timestamp Response on UTC with format ISO8601 UTC+0 from Merchant</td></tr><tr><td><strong>Signature</strong></td><td>Signature generated by Merchant based on the response body. 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 response body:

```json
{
    "order": {
        "invoice_number":"MINV20201231468",
        "amount":150000
    },
    "online_to_offline_info": {
        "payment_code":"8896512345678123",
        "info1":"Thanks for shooping"
    },
    "online_to_offline_inquiry": {
        "status":"success"
    },
    "customer": {
        "name":"Taufik Ismail",
        "email":"taufik@doku.com"
    }
    "additional_info": {
    }
}
```

#### Response Body Explanation

<table><thead><tr><th width="248">Parameter</th><th width="111">Type</th><th width="122">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></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><code>number</code></td><td>Mandatory</td><td>In IDR currency and without decimal. Alfa only supports <code>Close Amount</code><br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></td></tr><tr><td><code>online_to_offline_info.payment_code</code></td><td><code>string</code></td><td>Mandatory</td><td>Same as the request</td></tr><tr><td><code>online_to_offline_info.info</code></td><td><code>string</code></td><td>Optional</td><td>Additional info that will be display on the Alfa POS when customer do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>30</code></td></tr><tr><td><code>online_to_offline_inquiry.status</code></td><td><code>string</code></td><td>Mandatory</td><td>Possible value: <code>success</code>, <code>decline</code>, <code>billing_already_paid</code>, <code>billing_was_expired</code>, <code>billing_not_found</code></td></tr><tr><td><code>customer.name</code></td><td><code>string</code></td><td>Mandatory</td><td>Customer name that will be displayed on Alfa POS 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><code>string</code></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>additional_info</code></td><td><code>object</code></td><td>Optional</td><td>Merchant can send additional data through this parameter and will be get the data in the HTTP Notification</td></tr></tbody></table>

#### 4. 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)
  {% endtab %}
  {% endtabs %}

***

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

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

### Insurance Data <a href="#insurance-data" id="insurance-data"></a>

For insurance merchant, DOKU can show insurance data to Alfa POS and Alfa receipt by give object `additional_info.insurance_info` and also DOKU can show footer message on Alfa receipt by give `alfa_info.receipt.footer_message` to DOKU. Here is the sample:

```json
{
    ...
    "alfa_info": {
        "receipt": {
            "footer_message":"Call Center 021 555-0525"
        }
    },
    "additional_info": {
        "insurance_info": {
            "policy_type": "Dana Pendidikan",
            "policy_number": "9090901234",
            "policy_account_name": "Taufik Ismail",
            "policy_status": "aktif",
            "bill_due_date": "21 May 2021"
        }
    },
    ...
}
```

### Update and Cancel Payment Code Data <a href="#update-and-cancel-payment-code-data" id="update-and-cancel-payment-code-data"></a>

If you wish to update your payment code data such as, update the amount, update the expiry time, customer details, and etc. You can do that by hitting the API with `PATCH` method:

**API Request**

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

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

```json
Client-Id: MCH-0001-10791114622547
Request-Id: 2dc5985e-adaa-4f82-b126-b09e9006da14
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

#### Request Header Explanation

<table><thead><tr><th width="219">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 update payment code data:

{% hint style="info" %}
**Cancel payment code data**

To cancel a payment code, simply set `online_to_offline_info.status` to `DELETE`
{% endhint %}

```json
{
    "order": {
        "invoice_number": "INV-20210124-0001",
        "amount": 150000
    },
    "online_to_offline_info": {
        "payment_code": "6059000000000205",
        "status": "ACTIVE",
        "expired_time": 60,
        "reusable_status": false,
        "info": "Thank you for shopping"
    },
    "customer": {
        "name": "Anton Budiman",
        "email": "anton@example.com"
    }
}
```

**Request Body Explanation**

<table><thead><tr><th>Parameter</th><th width="130">Type</th><th width="151">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></td><td>Same as the generate payment code request</td><td></td></tr><tr><td><code>order.amount</code></td><td><code>number</code></td><td>Conditional</td><td>Set this with updated value if wished. Set this parameter to more than (>) <code>0</code>for <code>Close Amount</code><br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></td></tr><tr><td><code>online_to_offline_info.payment_code</code></td><td><code>string</code></td><td>Mandatory</td><td>The payment code that wish to be updated</td></tr><tr><td><code>online_to_offline_info.status</code></td><td><code>string</code></td><td>Mandatory</td><td>Set <code>ACTIVE</code> to update the payment code and set <code>DELETE</code> to cancel the payment code<br>Possible value: <code>ACTIVE, DELETE</code></td></tr><tr><td><code>online_to_offline_info.expired_time</code></td><td><code>number</code></td><td>Optional</td><td>Set this with updated value if wished<br>Allowed chars: <code>numeric</code><br>Maximum length: <code>5</code><br>Default value: <code>60</code></td></tr><tr><td><code>online_to_offline_info.reusable_status</code></td><td><code>number</code></td><td>Mandatory</td><td>Set this with updated value if wished<br>Possible value: <code>true</code> <code>false</code></td></tr><tr><td><code>online_to_offline_info.info</code></td><td><code>string</code></td><td>Optional</td><td>Additional info that will be display on the Alfa POS when customer do inquiry<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>30</code></td></tr><tr><td><code>customer.name</code></td><td><code>string</code></td><td>Mandatory</td><td>Set this with updated value if wished<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>40</code></td></tr><tr><td><code>customer.email</code></td><td><code>string</code></td><td>Optional</td><td>Set this with updated value if wished<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>128</code></td></tr></tbody></table>

**API Response**

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

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

```json
Client-Id: MCH-0001-10791114622547
Request-Id: 09e0defe-a071-45b3-9feb-ac134374628c
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

#### Response Header Explanation

<table><thead><tr><th width="226">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>Response-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-20210124-0001"
    },
    "online_to_offline_info": {
        "payment_code": "6059000000000205",
        "created_date": "20210331115005",
        "expired_date": "20210331125005",
        "created_date_utc": "2021-03-31T04:50:05Z",
        "expired_date_utc": "2021-03-31T05:50:05Z"
    }
}
```

#### Response Body Explanation <a href="#split-settlement" id="split-settlement"></a>

<table><thead><tr><th>Parameter</th><th width="118">Type</th><th width="135">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></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><code>string</code></td><td>Mandatory</td><td>Generated by DOKU that will be used by customer for doing a payment through Alfa store</td></tr><tr><td><code>online_to_offline_info.created_date</code></td><td><code>string</code></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.expired_date</code></td><td><code>string</code></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><code>string</code></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><code>string</code></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></tbody></table>

#### 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](#split-settlement-1)

***

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

You can test your payment through our Payment Simulator. Learn more [here](https://developers.doku.com/accept-payments/doku-checkout/integration-guide/simulate-payment-and-notification).
