# Convenience Store

DOKU provides various payment channels. One of the most used by our merchants is Online to Offline. By using this payment channels, your customer can pay their order through offline counters and DOKU will notify you once the payment is completed by your customer. DOKU has partnered with various partners to help you provide many payment options for your customers.

### Partnerships Model <a href="#partnerships-model" id="partnerships-model"></a>

Each user may have different needs for the business and the way they receive funds. DOKU has 2 types of models for accepting payments, namely the Aggregator Model and the Direct Model. For full details, you can check the details here.

The following is a list of models in receiving your funds for each bank via Online to Offline.

| Name      | Aggregator | Direct |
| --------- | ---------- | ------ |
| Alfa O2O  | ✅          | ✅      |
| Indomaret | ❌          | ✅      |

***

### Features for Online to Offline <a href="#features-for-online-to-offline" id="features-for-online-to-offline"></a>

**Payment Code Component**

{% hint style="info" %}
**PAYMENT CODE COMPONENT**&#x20;

Payment Code which is displayed to customer, contains two parts.\
**The first part** is the company code (BIN) and **the second part** is unique payment code.
{% endhint %}

There are 2 types of general features that can be used with Online to Offline:

1. **Register**: The payment code will be registered to DOKU and Acquirer will inquiry to our side when the customer make payment at the acquirer channel (Alfa Group, etc.)

| Features Type                          | Description                                                                                                                                                                                                                                               |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DOKU Generated Payment Code (DGPC)     | <p>Merchants don’t need to generate payment code, just need to request from DOKU and DOKU will send a unique payment code.<br>Component Payment Code : <code>BIN</code> and <code>Unique payment code</code>. Suitable for e-commerce business model.</p> |
| Merchant Generated Payment Code (MGPC) | <p>Merchants can generate payment codes with their own rules, and send the code to DOKU and customers will use it for payment.<br>Component Payment Code : <code>BIN</code> and <code>Unique payment code</code>. Suitable for top up business model.</p> |

2. **Direct Inquiry (DIPC)**: The payment code is registered on merchant side and DOKU will forward Acquirer inquiry request to merchant side when the customer make payment at the acquirer channel (Alfa Group, etc.). Component Payment Code : `BIN` and `Unique Payment Code`.

{% hint style="info" %}
**One transaction can't use 2 or 3 features at the same time.**

By default, DOKU will register your business with Doku Generate Payment Code feature which means BIN for payment code will be generated by DOKU side. But there is no limit for you to be able to use 2 features at the same time. **What it can't do is that 1 transaction uses 2 features at the same time.**
{% endhint %}

{% hint style="success" %}
**Get the BIN**

If you want to use MGPC or DIPC, then please contact the care team to get a BIN as a component for the payment code.
{% endhint %}

***

### Billing Type <a href="#billing-type" id="billing-type"></a>

Billing type is a type of feature used by merchants to determine the method of payment for their customers when they are in Inquiry. In case, the customer can input the amount according to their expected amount or the customer can also pay according to the amount that has been determined by the merchant.

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

Online to Offline only supports `FIX BILL`
{% endhint %}

***

### BIN Rules <a href="#bin-rules" id="bin-rules"></a>

In accordance with the explanation regarding the payment code Component, BIN is one of the components to create a payment code. So, here's an explanation regarding BIN rules and adapt them to your needs.

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

These rules only apply to Aggregator Partnership Models, which means merchants use DOKU's BIN.
{% endhint %}

{% tabs %}
{% tab title="Alfa Group" %}
| Partnership Model | BIN Type       | Description                                                                                                                | VA Number Component                                                       | Feature                                                       |
| ----------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------- |
| Aggregator        | DOKU General   | DOKU's BIN in Acquirer, that DOKU provide for merchants to use                                                             | DOKU General BIN (1 digit) + DOKU Generated Payment Code (max : 19 digit) | DOKU Generated Payment Code (DGPC)                            |
| Aggregator        | DOKU Exclusive | DOKU's BIN in Acquirer, that DOKU provides only for 1 merchant to use. Please contact sales team to get DOKU Exclusive BIN | DOKU Exclusive BIN (starting from 6 digit) + Free Digit (max. 14 digit)   | Merchant Generated Payment Code (MGPC), Direct Inquiry (DIPC) |
| Direct            | Direct         | Merchant’s Acquirer BIN. Please contact sales team to get Direct BIN from Acquirer                                         | Merchant’s Acquirer BIN (5 digit) + Free Digit (max. 20 digit)            | Merchant Generated Payment Code (MGPC), Direct Inquiry (DIPC) |
{% endtab %}

{% tab title="Indomaret" %}
| Partnership Model | BIN Type | Description                                                                        | VA Number Component                                            | Feature |
| ----------------- | -------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------- |
| Direct            | Direct   | Merchant’s Acquirer BIN. Please contact sales team to get Direct BIN from Acquirer | Merchant’s Acquirer BIN (5 digit) + Free Digit (max. 20 digit) |         |
{% endtab %}
{% endtabs %}

***

### Reusable Status <a href="#reusable-status" id="reusable-status"></a>

Reusable Status is a parameter in API to indicate if Payment Code can be paid more than once, set this to true if merchants wish to enable it.

Here is a reusable status explanation. Set this value in the API, to implement reusable status.

| Value   | Description                             |
| ------- | --------------------------------------- |
| `true`  | Payment Code can be paid more than once |
| `false` | Payment Code can only be paid once      |

{% hint style="info" %}
By default, DOKU will set the value to `false`, if you don't send this parameter on request.
{% endhint %}

***

### 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%2FPu6qxhYPlA3Jyv8Cnstx%2Fjokul-direct-va-aggregator-sequence-diagram.jpeg?alt=media&#x26;token=03416ff7-ba1a-422a-b172-e87a5364a8e0" 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/{{channel-name}}/{{version}}/payment-code` |
| **API endpoint (Production)** | `https://api.doku.com/{{channel-name}}/{{version}}/payment-code`         |

You need to change the `{{channel-name}}` and `{{version}}` accordingly based on what payment channel you wish. Here is the list:

| Name       | `{{channel-name}}`            | Current Version |
| ---------- | ----------------------------- | --------------- |
| Alfa Group | `alfa-online-to-offline`      | `v2`            |
| Indomaret  | `indomaret-online-to-offline` | `v2`            |

Every object naming in our O2O APIs are standarized and have their own customization to ensure easy integration. Therefore, you can learn more about how to integrate to each of them by clicking the link above.

***

#### 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](../../../getting-started-with-doku-api/notification/http-notification-sample-for-snap)

***

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

You can learn more about how to integrate to each payment channels you wish by clicking the menu on the sidebar.
