# Indodana

DOKU has partenered with various Paylater Providers and one of them is Indodana to provide Buy Now Pay Later. Learn more about how DOKU can help you integrate with Indodana here.

***

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

Here is the overview of how to integrate with Indodana:

1. Obtain `payment.url` by generating order
2. Display Indodana payment page to customer
3. Acknowledge payment result

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FCO9AT7Y7WaLDvk2H14i8%2Findodana.png?alt=media&#x26;token=d4675870-298a-471c-ac99-a5fbf7363ab4" alt=""><figcaption></figcaption></figure>

***

#### 1. Obtain `payment.url` by generating order <a href="#id-1-obtain-paymenturl-by-generating-order" id="id-1-obtain-paymenturl-by-generating-order"></a>

To generate order, 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/indodana-peer-to-peer/v2/generate-order` |
| **API endpoint (Production)** | `https://api.doku.com/indodana-peer-to-peer/v2/generate-order`         |

Here is the sample of request header to generate order:

```
Client-Id: MCH-0001-10791114622547
Request-Id: baec7d95-f30a-4b78-b711-6ebe0ccdf50b
Request-Timestamp: 2021-07-07T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
```

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://dashboard.doku.com/docs/docs/technical-references/generate-signature) to generate the signature |

Here is the sample request body to generate order:

```json
{
    "order": {
        "invoice_number": "MINV20201231468",
        "line_items": [
             {
               "name":"Ayam",
               "price":50000,
               "quantity":2,
               "id":"1002",
               "category":"ELECTRONIC",
               "url":"https://merchant.com/product_1002",
               "image_url":"https://merchant.com/product_1002/image",
               "type":"handphone"
             }
          ],
        "amount": 100000,
        "callback_url":"https://merchant.com/return-url",
        "callback_url_cancel":"https://merchant.com/cancel-url"
    },
    "peer_to_peer_info": {
        "expired_time":60,
        "merchant_unique_reference": "60123"
    },
    "customer": {
        "first_name":"andreas",
        "last_name":"dharmawan",
        "phone":"081939815480",
        "email":"andreas@email.com"
    },
    "billing_address": {
        "first_name":"andreas",
        "last_name":"dharmawan",
        "address":"Jalan Teknologi Indonesia No. 25",
        "city":"Jakarta",
        "postal_code":"12960",
        "phone":"081513114262",
        "country_code":"IDN"
    },
    "shipping_address": {
        "first_name":"andreas",
        "last_name":"dharmawan",
        "address":"Jalan Teknologi Indonesia No. 25",
        "city":"Jakarta",
        "postal_code":"12960",
        "phone":"081513114262",
        "country_code":"IDN"
    },
    "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<br>Allowed chars: <code>numeric</code><br>Max length: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `order.line_items.name`                       | `string`  | Mandatory | <p>Name of the product item<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>128</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `order.line_items.price`                      | `decimal` | Mandatory | <p>Price of the product item. Total price and quantity must match with the <code>order.amount</code><br>Allowed chars: <code>numeric</code><br>Max Length: <code>16.2</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `order.line_items.quantity`                   | `number`  | Mandatory | <p>Quantity of the product item<br>Allowed chars: <code>numeric</code><br>Max Length: <code>8</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `order.line_items.id`                         | `string`  | Mandatory | <p>SKU/item ID of the item in this transaction.<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>64</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `order.line_items.category`                   | `enum`    | Mandatory | <p>Category of the item in this transaction. Reference for list of enum : <code>airlines</code> <code>arts-crafts-and-collectibles</code> <code>automotive</code> <code>baby beauty-and-fragrances</code> <code>biller</code> <code>books-and-magazines</code> <code>business-to-business-including-mlm</code> <code>charity-and-non-profit</code> <code>clothing</code> <code>community</code> <code>digital-content</code> <code>electronics-and-telecom</code> <code>entertainment-and-media</code> <code>financial-services-and-products</code> <code>financial-services-and-technology</code> <code>food-and-beverage</code> <code>food-retail-and-service</code> <code>games-voucher</code> <code>gifts-and-flowers</code> <code>government</code> <code>health-and-personal-care</code> <code>home-and-garden</code> <code>hotel-and-travel</code> <code>insurance</code> <code>marketplace</code> <code>nonprofit</code> <code>offline-store</code> <code>others</code> <code>over-the-air</code> <code>overseas</code> <code>overseas</code> <code>pets-and-animals</code> <code>property</code> <code>public-services</code> <code>religion-and-spirituality</code> <code>retail</code> <code>services</code> <code>sports-and-outdoors</code> <code>telco</code> <code>ticketing</code> <code>toys-and-hobbies</code> <code>transportation</code> <code>travel</code> <code>vehicle-sales</code> <code>vehicles-service-and-accessories</code><br>If cannot find, you can use <code>others</code></p> |
| `order.line_items.url`                        | `string`  | Optional  | <p>URL of the product in the merchant site / platform.<br>Max Length: <code>256</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `order.line_items.image_url`                  | `string`  | Optional  | <p>URL of the image of the product in the merchant site / platform.<br>Max Length: <code>256</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `order.line_items.type`                       | `string`  | Optional  | Type of the item in this transaction                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `order.callback_url`                          | `string`  | Optional  | <p>Merchant URL that will redirected to after the order completed<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Only support: <code>^\[a-zA-Z0-9()\\-=\\\\.\\?;,+\\/:&\_ %]$#</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `order.callback_url_cancel`                   | `string`  | Mandatory | <p>Merchant URL that will redirected if order cancelled<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Only support: <code>^\[a-zA-Z0-9()\\-=\\\\.\\?;,+\\/:&\_ %]$#</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `peer_to_peer_info.expired_time`              | `number`  | Optional  | <p>Order expired time<br>Format in minute<br>Max length: <code>5</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `peer_to_peer_info.merchant_unique_reference` | `string`  | Mandatory | <p>Unique reference number generated by merchant<br>Allowed chars: <code>alphabetic, numeric, special chars</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `customer.first_name`                         | `string`  | Mandatory | <p>Customer name<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `customer.last_name`                          | `string`  | Optional  | <p>Customer name<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `customer.email`                              | `string`  | Mandatory | <p>Customer email address.<br>Max Length: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `customer.phone`                              | `string`  | Mandatory | <p>Customer phone number. Format: <code>{calling\_code}{phone\_number}</code>. Example: 6281122334455<br>Allowed chars: <code>numeric</code><br>Max Length: <code>16</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `billing_address`                             | `json`    | Mandatory | <p>Billing address of the customer for the transaction.<br>Allowed chars: <code>object</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `billing_address.first_name`                  | `string`  | Mandatory | Billing Address first name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `billing_address.last_name`                   | `string`  | Optional  | Billing Address last name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `billing_address.address`                     | `number`  | Mandatory | Billing address of the customer/shopper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `billing_address.city`                        | `number`  | Mandatory | Billing city of the customer/shopper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `billing_address.postal_code`                 | `number`  | Mandatory | Billing postal code of the customer/shopper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `billing_address.phone`                       | `number`  | Mandatory | Billing phone of the customer/shopper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `billing_address.country_code`                | `number`  | Mandatory | Billing country code of the customer/shopper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `shipping_address`                            | `json`    | Optional  | <p>Shipping address of the customer for the transaction.<br>Allowed chars: <code>object</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `shipping_address.first_name`                 | `string`  | Mandatory | Shipping address first name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `shipping_address.last_name`                  | `string`  | Optional  | Shipping address last name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `shipping_address.address`                    | `string`  | Mandatory | Shipping address of the customer/shopper. shipping is required for goods (excluding ticket/voucher)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `shipping_address.city`                       | `string`  | Mandatory | Shipping address city                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `shipping_address.postal_code`                | `string`  | Mandatory | Shipping address postal code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `shipping_address.phone`                      | `string`  | Mandatory | Shipping address phone                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `shipping_address.country_code`               | `string`  | Mandatory | Shipping address country code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `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: baec7d95-f30a-4b78-b711-6ebe0ccdf50b
Response-Timestamp: 2021-07-07T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
```

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
{
    "order": {
        "amount": 200000,
        "invoice_number": "INVQ01W"
    },
    "payment": {
        "status": "PENDING",
        "url": "https://sandbox01.indodana.com/product-installment/payment?purchaseTransactionId=<generated-purchase-transaction-id>&tenure=3"
    },
    "peer_to_peer_info": {
        "identifier": [
            {
                "name": "INDODANA_ORDER_ID",
                "value": "<MERCHANT-ORDER-ID>"
            }
        ],
        "created_date": "20220217222048",
        "expired_date": "20220217232048",
        "created_date_utc": "2022-02-17T15:20:48Z",
        "expired_date_utc": "2022-02-17T16:20:48Z",
        "merchant_unique_reference": "MURQ01W"
    },
    "additional_info": {
        "override_notification_url": "https://another.example.com/payments/notifications"
    }
}
```

Response Body Explanation

| Parameter                                     | Type     | Mandatory   | Description                                                                                               |
| --------------------------------------------- | -------- | ----------- | --------------------------------------------------------------------------------------------------------- |
| `order.invoice_number`                        | `string` | Mandatory   | Same as the request                                                                                       |
| `order.amount`                                | `number` | Mandatory   | Same as the request                                                                                       |
| `payment.url`                                 | `string` | Mandatory   | Indodana payment page URL to display for the customer                                                     |
| `payment.status`                              | `string` | Mandatory   | <p>The current payment status<br>Possible value:<br><code>PENDING, FAILED</code></p>                      |
| `peer_to_peer_info.identifier`                | `array`  | Optional    | List of transaction identifier that coming from the acquiring. Merchant can save these data for reference |
| `peer_to_peer_info.merchant_unique_reference` | `string` | Conditional | Same as the request                                                                                       |
| `peer_to_peer_info.created_date`              | `string` | Conditional | Date time of Indodana generated with the format of yyyyMMddHHmmss.                                        |
| `peer_to_peer_info.expired_date`              | `string` | Conditional | Date time of Indodana will be expired with the format of yyyyMMddHHmmss.                                  |
| `peer_to_peer_info.created_date_utc`          | `string` | Conditional | Date time of Indodana generated in UTC Format.                                                            |
| `peer_to_peer_info.expired_date_utc`          | `string` | Conditional | Date time of Indodana will be expired in UTC Format.                                                      |
| `additional_info.override_notification_url`   | `string` | Optional    | Same as the request                                                                                       |

#### 2. Display Indodana payment page to customer <a href="#id-2-display-indodana-payment-page-to-customer" id="id-2-display-indodana-payment-page-to-customer"></a>

Once you have the `payment.url`, you can now display the payment page by redirecting your customer to the Indodana payment page.

After the customer completed the payment, they will be redirected to the defined `order.callback_url` that you set on the API request.

***

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