> For the complete documentation index, see [llms.txt](https://developers.doku.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.doku.com/accept-payments/direct-api/non-snap/paylater/kredivo.md).

# Kredivo

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

***

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

Here is the overview of how to integrate with Kredivo :

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

<figure><img src="/files/dghk3fCi8OQnAGqtebQl" 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/kredivo-peer-to-peer/v2/generate-order` |
| **API endpoint (Production)** | `https://api.doku.com/kredivo-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": "Test-Devex-002-jesj123",
    "line_items": [
      {
        "name": "AyamA",
        "price": 30000,
        "quantity": 1,
        "id": "1008",
        "type": "ELECTRONIC",
        "url": "https://merchant.com/product_1002/a",
        "image_url": "https://merchant.com/product_1002/image/a",
        "parent_type": "SELLER",
        "parent_id": "SELLER01"
      },
      {
        "name": "AyamB",
        "price": 10000,
        "quantity": 4,
        "id": "1009",
        "type": "ELECTRONIC",
        "url": "https://merchant.com/product_1002/b",
        "image_url": "https://merchant.com/product_1002/image/b",
        "parent_type": "SELLER",
        "parent_id": "SELLER02"
      }
    ],
    "amount": 70000,
    "callback_url": "https://merchant.com/cancel-url",
    "callback_url_cancel": "https://merchant.com/cancel-url"
  },
  "peer_to_peer_info": {
    "expired_time": 60,
    "merchant_unique_reference": "MURQ001-Test-Devex002-jes-123"
  },
  "sellers": [
    {
      "id": "SELLER",
      "name": "Sunrise",
      "email": "sunrise@gmail.com",
      "url": "https://onlineshop/seller/sunrise",
      "address": {
        "first_name": "Irfan",
        "last_name": "Sutandro",
        "address": "Jalan Tentara Pelajar no 4",
        "city": "Jakarta Utara",
        "postal_code": "12960",
        "phone": "08123456789",
        "country_code": "IDN"
      }
    },
    {
      "id": "SELLERB",
      "name": "SunriseB",
      "email": "sunriseb@gmail.com",
      "url": "https://onlineshop/seller/sunriseb",
      "address": {
        "first_name": "IrfanB",
        "last_name": "SutandroB",
        "address": "Jalan Tentara Pelajar no 4B",
        "city": "Jakarta UtaraB",
        "postal_code": "129601",
        "phone": "081234567892902",
        "country_code": "IDN"
      }
    }
  ],
  "customer": {
    "first_name": "andreas",
    "last_name": "dharmawan",
    "phone": "081398154809",
    "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.line_items.name`                       | `string`  | Mandatory | <p>Name of the product item<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>255</code></p>                                                                   |
| `order.line_items.price`                      | `double`  | Mandatory | <p>Price of the product item. Total price and quantity must be match with the <code>order.amount</code><br>Allowed chars: <code>numeric</code><br>Max Length: <code>12</code></p>                   |
| `order.line_items.quantity`                   | `integer` | Mandatory | <p>Quantity of the product item<br>Allowed chars: <code>numeric</code><br>Max Length: <code>4</code></p>                                                                                            |
| `order.line_items.id`                         | `string`  | Mandatory | Item ID No/SKU number on this transaction (new)                                                                                                                                                     |
| `order.line_items.type`                       | `string`  | Mandatory | Type / Category of the item in this transaction.                                                                                                                                                    |
| `order.line_items.url`                        | `string`  | Mandatory | URL to the product item on merchant site                                                                                                                                                            |
| `order.line_items.image_url`                  | `string`  | Optional  | URL to the product item image                                                                                                                                                                       |
| `order.line_items.parent_type`                | `string`  | Optional  | You can assign the fee to either SELLER or ITEM. If not specified, this will be tied to transaction level                                                                                           |
| `order.line_items.parent_id`                  | `string`  | Optional  | This is either the seller Id or item Id                                                                                                                                                             |
| `order.amount`                                | `double`  | Mandatory | <p>In IDR currency and without decimal<br>Allowed chars: <code>numeric</code><br>Max length: <code>12</code></p>                                                                                    |
| `order.callback_url`                          | `string`  | Mandatory | <p>Merchant URL that will redirected to after the order completed<br>Allowed chars: <code>alphabetic, numeric, special chars</code></p>                                                             |
| `order.callback_url_cancel`                   | `string`  | Optional  | <p>URI that the customer is sent to if the customer chooses to cancel the Kredivo payment before completion<br>Allowed chars: <code>alphabetic, numeric, special chars</code></p>                   |
| `peer_to_peer_info.expired_time`              | `number`  | Optional  | <p>Order expiration time in minutes format<br>Allowed chars: <code>numeric</code><br>Maximum length: <code>5</code><br>Default value: <code>1440</code></p>                                         |
| `peer_to_peer_info.merchant_unique_reference` | `string`  | Mandatory | Unique reference number generated by merchant, used as order id in acquirer api.                                                                                                                    |
| `sellers.id`                                  | `string`  | Optional  | Seller's ID                                                                                                                                                                                         |
| `sellers.name`                                | `string`  | Optional  | Seller's name                                                                                                                                                                                       |
| `sellers.email`                               | `string`  | Optional  | Seller's email                                                                                                                                                                                      |
| `sellers.url`                                 | `string`  | Optional  | Seller's URL                                                                                                                                                                                        |
| `sellers.legal_id`                            | `string`  | Optional  | Seller's Legal ID ( KTP, SIM or Passport Number)                                                                                                                                                    |
| `sellers.address.first_name`                  | `string`  | Optional  | Seller's first name                                                                                                                                                                                 |
| `sellers.address.last_name`                   | `number`  | Optional  | Seller's last name                                                                                                                                                                                  |
| `sellers.address.address`                     | `string`  | Optional  | Seller's address                                                                                                                                                                                    |
| `sellers.address.city`                        | `string`  | Optional  | Seller's address city                                                                                                                                                                               |
| `sellers.address.postal_code`                 | `string`  | Optional  | Seller's address postal code.                                                                                                                                                                       |
| `sellers.address.phone`                       | `string`  | Optional  | Seller's phone                                                                                                                                                                                      |
| `sellers.address.country_code`                | `string`  | Optional  | Seller's country code. ISO 3166-1 alpha-3                                                                                                                                                           |
| `customer.first_name`                         | `string`  | Mandatory | <p>Customer's first name<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>255</code></p>                                                                      |
| `customer.last_name`                          | `string`  | Optional  | <p>Customer's last name<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max length: <code>255</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>                     |
| `customer.email`                              | `string`  | Mandatory | <p>Customer address<br>Allowed chars: <code>alphabetic, numeric, special chars</code><br>Max Length: <code>400</code></p>                                                                           |
| `billing_address.first_name`                  | `string`  | Optional  | Billing address of the customer/shopper. Customer's first name                                                                                                                                      |
| `billing_address.last_name`                   | `string`  | Optional  | Billing address of the customer/shopper. Customer's last name                                                                                                                                       |
| `billing_address.address`                     | `string`  | Optional  | Billing address of the customer/shopper. Customer's address                                                                                                                                         |
| `billing_address.city`                        | `string`  | Optional  | Billing address of the customer/shopper. Customer's city                                                                                                                                            |
| `billing_address.postal_code`                 | `string`  | Optional  | Billing address of the customer/shopper. Customer's postal code                                                                                                                                     |
| `billing_address.phone`                       | `string`  | Optional  | Billing address of the customer/shopper. Customer's phone                                                                                                                                           |
| `billing_address.country_code`                | `string`  | Optional  | Billing address of the customer/shopper. Customer's country code                                                                                                                                    |
| `shipping_address.first_name`                 | `string`  | Mandatory | Shipping address of the customer/shopper. Shipping is required for goods (excluding ticket/voucher). Customer's first name                                                                          |
| `shipping_address.last_name`                  | `number`  | Optional  | Shipping address of the customer/shopper. Customer's last name                                                                                                                                      |
| `shipping_address.address`                    | `string`  | Mandatory | Shipping address of the customer/shopper. Customer's address                                                                                                                                        |
| `shipping_address.city`                       | `number`  | Mandatory | Shipping address of the customer/shopper. Customer's city                                                                                                                                           |
| `shipping_address.postal_code`                | `string`  | Mandatory | Shipping address of the customer/shopper. Customer's postal code                                                                                                                                    |
| `shipping_address.phone`                      | `number`  | Mandatory | Shipping address of the customer/shopper. Customer's phone                                                                                                                                          |
| `shipping_address.country_code`               | `string`  | Mandatory | Shipping address of the customer/shopper. Customer's country code                                                                                                                                   |
| `additional_info.override_notification_url`   | `string`  | Optional  | This parameter is intended to override the configured `Notification URL` with another URL. Click [here](/get-started-with-doku-api/notification/override-notification-url.md) 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": 70000,
        "invoice_number": "Test-Devex-002-jesj123"
    },
    "payment": {
        "status": "PENDING",
        "url": "https://pay-sandbox.kredivo.com/signIn?tk=d8e9f2a5-7abb-4696-9872-963b15c1c937"
    },
    "peer_to_peer_info": {
        "identifier": [
            {
                "value": "05521636616142675MURQ001-Test-Devex002-jes-123",
                "name": "KREDIVO_ORDER_ID"
            }
        ],
        "created_date": "20220328120315",
        "expired_date": "20220328130315",
        "created_date_utc": "2022-03-28T12:03:15Z",
        "expired_date_utc": "2022-03-28T13:03:15Z",
        "merchant_unique_reference": "MURQ001-Test-Devex002-jes-123"
    },
    "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.status`                              | `string` | Mandatory   | <p>The current payment status<br>Possible value:<br><code>PENDING</code>: continue redirect the customer to <code>payment.url</code>.<br><code>FAILED</code>: Retry generate order with different <code>order.invoice\_number</code> and <code>payment.merchant\_unique\_reference</code></p> |
| `payment.url`                                 | `string` | Optional    | Kredivo payment page URL to display for the customer                                                                                                                                                                                                                                          |
| `peer_to_peer_info.identifier`                | `object` | Optional    | List of transaction identifier that coming from the acquiring. Merchant can save these data for reference                                                                                                                                                                                     |
| `peer_to_peer_info.created_date`              | `string` | Conditional | Date time of URL generated with the format of yyyyMMddHHmmss.                                                                                                                                                                                                                                 |
| `peer_to_peer_info.expired_date`              | `string` | Conditional | Date time of URL EXPIRED with the format of yyyyMMddHHmmss.                                                                                                                                                                                                                                   |
| `peer_to_peer_info.created_date_utc`          | `string` | Conditional | Date time of URL generated with the format of yyyyMMddHHmmss. The generated date uses UTC+7 time.                                                                                                                                                                                             |
| `peer_to_peer_info.expired_date_utc`          | `string` | Conditional | Date time of URL will be expired in UTC. Use this to set the expiry order on merchant side                                                                                                                                                                                                    |
| `peer_to_peer_info.merchant_unique_reference` | `string` | Conditional | Same as the request                                                                                                                                                                                                                                                                           |
| `additional_info.override_notification_url`   | `string` | Optional    | Same as the request                                                                                                                                                                                                                                                                           |

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

Once you have the `payment.url`, you can now display the payment page by redirecting your customer to the Kredivo 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](/get-started-with-doku-api/notification/http-notification-sample-for-snap.md)

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.doku.com/accept-payments/direct-api/non-snap/paylater/kredivo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
