# DOKU Biller

This documentation provides a comprehensive guide to understanding and using the DOKU Biller REST API. For the needs of data exchange, the format message used is based on JSON (JavaScript Object Notation). So it will facilitate the process of exchanging data between systems that already exist in the PT. Nusa Satu Inti Artha (DOKU) with a system developed by the partners.

> To interact with the API, you need an API key. You can obtain your API key from the API settings page. If this is your first time using the API, we recommend starting with the [Getting Started Guide](https://dashboard.doku.com/bo/developer/api-keys) to learn how to generate an API key and set up your environment.

## Overview

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F5s72Z8skHVo0HPiKrnOq%2Fimage.png?alt=media&#x26;token=8764af8b-eaa0-413b-8bea-54af063381a9" alt=""><figcaption><p>General flow</p></figcaption></figure>

**Note:**

1. Transactions originate from DOKU's merchant front-end application and are forwarded to DOKU Biller server. For server integration, DOKU must register the partner's IP address in the whitelist table.
2. DOKU Biller main server verifies the balance using the client id and processes the request to the biller.
3. The biller server processes the request based on "ID Pelanggan" and returns a response to DOKU Biller Server.

We offer two transaction flow methods: <mark style="color:red;">`synchronous`</mark> and <mark style="color:red;">`asynchronous`</mark> . Below are the differences between these flows.

### Synchronous&#x20;

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F8NX6aPuOVF5scl5Nv1Xe%2Fimage.png?alt=media&#x26;token=0ee6f329-ec81-4309-887b-d3dd8d3359c7" alt="" width="563"><figcaption><p>Flow sequence diagram: Synchronous</p></figcaption></figure>

The image shows a sequence diagram illustrating the synchronous flow between a Partner and DOKU system. The flow consists of three main steps:

1. Inquiry Process: Partner sends an inquiry request to DOKU and receives an inquiry response
2. Payment Process: Partner sends a payment request to DOKU and receives a payment response, in this case the partner receives the final transaction status.
3. Optional Advice Process: Partner can optionally send an advice request to DOKU and receive an advice response

The diagram uses dotted lines to show responses coming back from DOKU to the Partner, and solid lines to show requests going from Partner to DOKU.

### Asynchronous

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FVh30B47K3NlOtQUUXrVI%2Fimage.png?alt=media&#x26;token=59bda8a9-691b-49c2-aa24-61e51281a55e" alt="" width="563"><figcaption><p>Flow sequence diagram: Synchronous</p></figcaption></figure>

The image shows a sequence diagram illustrating an asynchronous flow between a Partner and DOKU system. The flow consists of three main steps:

1. Inquiry Process: Partner sends an inquiry request and receives a response from DOKU
2. Payment Process: Partner sends a payment request and receives a payment response from DOKU
3. Callback Request: DOKU sends a callback request back to the Partner

The diagram uses solid lines to show requests from Partner to DOKU, and dotted lines to show responses from DOKU back to Partner, clearly depicting the asynchronous nature of the communication.

{% hint style="info" %}
For payment responses with response code <mark style="color:red;">`5586`</mark>, the partner system needs to either hit the advice module to get the final status or wait for a callback. Below is a sample response for the pending status.
{% endhint %}

```json
{
    "transactionid": 58021,
    "responsecode": "5586",
    "responsemessage": "Transaction in progress (Pending), hit advice to get final status transaction.",
    "systrace": 5787,
    "transactiondate": "2022-06-16 15:04:31",
    "partnerdata": ""
}
```

***

## API Details

User objects represent users within the API. These objects are used in various API responses to provide details about the user involved in different actions.

### Inquiry

Inquiry will be used for&#x20;

* checking user bills for specific products such as PDAM, PLN, TELKOM, etc. or&#x20;
* to check availablility denom for specific biller such as&#x20;

#### Request

<table><thead><tr><th width="58">No</th><th width="153">Name</th><th width="65" align="center">Type</th><th width="87.1640625" align="center">Length</th><th width="83.515625" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td><code>MALLID</code></td><td align="center">N</td><td align="center">10</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Code to determine partner.</td></tr><tr><td>2</td><td><code>BILLERID</code></td><td align="center">N</td><td align="center">7</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Code to determine product.</td></tr><tr><td>4</td><td><code>ACCOUNTNUMBER</code></td><td align="center">AN</td><td align="center">20</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>similar with "ID Pelanggan", "Phone number", "No Tagihan", etc.</td></tr><tr><td>5</td><td><code>SYSTRACE</code></td><td align="center">N</td><td align="center">7</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Unique number in one day generated by partner.</td></tr><tr><td>6</td><td><code>WORDS</code></td><td align="center">AN</td><td align="center">255</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Security combination for verification: <strong>SHA1</strong>(<em>MALLID + SYSTRACE + Sharedkey + ACCOUNTNUMBER</em>)</td></tr><tr><td>7</td><td><code>ADDITIONALDATA1</code></td><td align="center">N</td><td align="center">255</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>default value is 5000</td></tr><tr><td>8</td><td><code>ADDITIONALDATA2</code></td><td align="center">N</td><td align="center">255</td><td align="center"></td><td></td></tr><tr><td>9</td><td><code>ADDITIONALDATA3</code></td><td align="center">N</td><td align="center">255</td><td align="center"></td><td>Conditional for each biller: <br>- PLN Prepaid (Mandatory): Fill with denom. i.e: 50000, 100000, etc.<br>- Others (Optional) : Leave it blank.</td></tr><tr><td>10</td><td><code>PARTNERDATA</code></td><td align="center">ANS</td><td align="center">255</td><td align="center"></td><td>Will return with the same value to partner in response</td></tr></tbody></table>

#### Response  1

The response below is the response format for the types of billers that have bills. \
i.e: PLN POSTPAID, TELKOM, PDAM, MULTIFINANCE, etc.

```json
{
    "billername": "BILLER NAME", -- Alpha Numeric
    "subscriberid": "CustomerID", -- Alpha Numeric
    "subscribername": "Customer Name", -- Alpha Numeric
    "paymenttype": "CLOSE/OPEN PAYMENT", -- Alpha Numeric
    "responsecode": "0000", -- Alpha Numeric
    "responsemessage": "RESPONSE MESSAGE", -- Alpha Numeric
    "systrace": "Systrace number", -- Numeric
    "inquiryid": "INQUIRY ID", –- Numeric
    "partnerdata": "",
    "transactiondate": "",
    "billerdetails":"",
    {
        "billdetails":
        {
            "billid": "1",
            "adminfee": "Admin fee",  -- Numeric
            "amount": "Billing amount",  -- Numeric
            "totalamount": "billing amount + admin fee"  -- Numeric
        }
        "display":
        {
            {
                "name":"FIELD NAME 1...n",
                "value":"VALUE of FIELD NAME 1..n"
            }
                [data array, different data for each biller]
            }
        },
}
```

#### Response 2

The response below is the response format for the types of billers that doesn't have bills, and have denomination. \
i.e: TELCO RELOAD (PULSA), DATA PACKAGE, TOP UP GAME, TOP UP E-MONEY, etc.

```json
{
    "billername": "BILLER NAME", -- Alpha Numeric
    "subscriberid": "CustomerID", -- Alpha Numeric
    "subscribername": "Customer Name", -- Alpha Numeric
    "paymenttype": "CLOSE/OPEN PAYMENT", -- Alpha Numeric
    "responsecode": "0000", -- Alpha Numeric
    "responsemessage": "RESPONSE MESSAGE", -- Alpha Numeric
    "systrace": "Systrace number", -- Numeric
    "inquiryid": "INQUIRY ID", –- Numeric
    "partnerdata": "",
    "transactiondate": "",
    "billerdetails":"",
    {
        "billdetails":
        {
            {
                "billid": "1",
                "denom": "5000",  -- Alpha Numeric
                "price": "Billing amount",  -- Numeric
                "remarks": "remarks for denom ie, active period, credit balance. etc.",  -- Note
            }
            {
                "billid": "2...n",
                "denom": "10000",  -- Alpha Numeric
                "price": "Billing amount",  -- Numeric
                "remarks": "remarks for denom ie, active period, credit balance. etc.",  -- Note
            }
                [data array]
          }
       }
}
```

### Payment

Payment request is used for make a purchase or billing payment.

#### Request

<table><thead><tr><th width="55.29296875">No</th><th width="174.890625">Name</th><th width="74.1484375" align="center">Type</th><th width="88.3671875" align="center">Length</th><th width="92.18359375" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td><code>MALLID</code></td><td align="center">N</td><td align="center">10</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Code to determine partner.</td></tr><tr><td>2</td><td><code>BILLERID</code></td><td align="center">N</td><td align="center">7</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Code to determine product.</td></tr><tr><td>3</td><td><code>ACCOUNTNUMBER</code></td><td align="center">AN</td><td align="center">20</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>similar with "ID Pelanggan", "Phone number", "No Tagihan", etc.</td></tr><tr><td>4</td><td><code>SYSTRACE</code></td><td align="center">N</td><td align="center">7</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Unique number in one day generated by partner.</td></tr><tr><td>5</td><td><code>WORDS</code></td><td align="center">AN</td><td align="center">255</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Security combination for verification: <strong>SHA1</strong>(<em>MALLID + SYSTRACE + Sharedkey + ACCOUNTNUMBER</em>)</td></tr><tr><td>6</td><td><code>ADDITIONALDATA1</code></td><td align="center">N</td><td align="center">255</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Value = 5000</td></tr><tr><td>7</td><td><code>ADDITIONALDATA2</code></td><td align="center">N</td><td align="center">255</td><td align="center"></td><td></td></tr><tr><td>8</td><td><code>ADDITIONALDATA3</code></td><td align="center">N</td><td align="center">255</td><td align="center"></td><td>Conditional for each biller: <br>- PLN Prepaid (Mandatory): Fill with denom. i.e: 50000, 100000, etc.<br>- Others (Optional) : Leave it blank.</td></tr><tr><td>9</td><td><code>PARTNERDATA</code></td><td align="center">ANS</td><td align="center">255</td><td align="center"></td><td>Will return with the same value to partner in response</td></tr><tr><td>10</td><td><code>BILLID</code></td><td align="center">N</td><td align="center"></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>The selected billid that customer wants to pay</td></tr><tr><td>11</td><td><code>AMOUNT</code></td><td align="center">N</td><td align="center"></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>Total amount from inquiry response.</td></tr><tr><td>12</td><td><code>INQUIRYID</code></td><td align="center">N</td><td align="center"></td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td>The id from inquiry response.</td></tr></tbody></table>

#### Response 1

The response below is the response format for the types of billers that have bills. \
i.e: PLN POSTPAID, TELKOM, PDAM, MULTIFINANCE, etc.

```json
{
    "billername": "BILLER NAME", -- Alpha Numeric
    "referencenumber": "Reference number from biller", -- Alpha Numeric
    "transactionid": "ID transaction from DOKU", -- Alpha Numeric
    "subscriberid": "CustomerID", -- Alpha Numeric
    "subscribername": "Customer Name", -- Alpha Numeric
    "paymenttype": "CLOSE/OPEN PAYMENT", -- Alpha Numeric
    "responsecode": "0000", -- Alpha Numeric
    "responsemessage": "RESPONSE MESSAGE", -- Alpha Numeric
    "systrace": "Systrace number", -- Numeric
    "transactiondate": "transaction date time", -- Numeric
    "partnerdata": "",
    "billerdetails":"",
    {
        "billdetails":
        {
            "billid": "1",
            "adminfee": "Admin fee",  -- Numeric
            "amount": "Billing amount",  -- Numeric
            "totalamount": "billing amount + admin fee"  -- Numeric
        }
        "display":
        {
            {
                "name":"FIELD NAME 1...n",
                "value":"VALUE of FIELD NAME 1..n"
            }
            [data array, different data for each biller]
        }
     },
}
```

#### Response 2

The response below is the response format for the types of billers that doesn't have bills, and have denomination. \
i.e: TELCO RELOAD (PULSA), DATA PACKAGE, TOP UP GAME, TOP UP E-MONEY, etc.

```json
{
    "billername": "BILLER NAME", -- Alpha Numeric
    "referencenumber": "Reference number from biller", -- Alpha Numeric
    "transactionid": "ID transaction from DOKU", -- Alpha Numeric
    "subscriberid": "CustomerID", -- Alpha Numeric
    "subscribername": "Customer Name", -- Alpha Numeric
    "paymenttype": "CLOSE/OPEN PAYMENT", -- Alpha Numeric
    "responsecode": "0000", -- Alpha Numeric
    "responsemessage": "RESPONSE MESSAGE", -- Alpha Numeric
    "systrace": "Systrace number", -- Numeric
    "transactiondate": "transaction date time", -- Numeric
    "partnerdata": "",
    "billerdetails":"",
    {
        "billdetails":
        {
            "billid": "1",
            "price": "the price of selected denom."  -- Numeric
            "code": "the code."  -- Alpha Numeric
        }
        "display":
        {
            {
                "name":"FIELD NAME 1...n",
                "value":"VALUE of FIELD NAME 1..n"
            }
            [data array, different data for each biller]
         }
     },
}
```

### Advice

The **Advice** function is used to verify the status of a transaction. Its request and response formats are similar to those of a payment transaction.

### Callback

The callback request sent to the partner's endpoint follows **the same format** as a payment response.
