# Online Transaction API

## HTTP Response Code

All the APIs here are based on the HTTP request. The following are the response codes of an HTTP request that the Indodana Paylater API may response.

| HTTP Response Code | Remarks                     |
| -----------------: | --------------------------- |
|                200 | Everything work as expected |
|                400 | Bad request                 |
|                401 | Unauthorized                |
|                422 | Validation Error            |
|                404 | Not found                   |
|                409 | Conflict                    |
|                429 | Too many requests           |
|                50X | Server errors               |

## API Method References

In this section, `{base_url}` will correspond to `https://sandbox01-api.indodanafinance.co.id/chermes/merchant` for `sandbox` environment. Subsequently, the `{base_url}` will correspond to `https://api.indodanafinance.co.id/chermes/merchant` for `production` environment.

{% hint style="info" %}
You can find our IP list [here](https://dev.indodana.id/indodana-paylater/go-live-preparation/whitelist-ip).
{% endhint %}

## Get Payment Calculation

<mark style="color:green;">`POST`</mark> `https://{base_url}/v2/payment_calculation`

This endpoint is used when you want to display the list of eligible payment types on your page to calculate and display the installment breakdown on your checkout page. It is recommended to show this calculation in your website to provide a better experience to the Customer.

`*` means the parameter is required

#### Headers

| Name                                            | Type   | Description                                                                               |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | The generated Authentication signature with format `Bearer {api_key}:{nonce}:{signature}` |

#### Request Body

| Name                                     | Type   | Description                                                                                              |
| ---------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark> | string | Total amount of the transaction. Should be equal to the sum of all the ***\<Item>***&#x73;' costs below. |
| items<mark style="color:red;">\*</mark>  | array  | Array of ***\<Item>***. Details of the shopping items in the transaction.                                |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "status": "OK",
    "payments": [
        {
            "amount": 2022000,
            "installmentAmount": 2754000,
            "monthlyInstallment": 229500,
            "tenure": 12,
            "tenureTimeUnit": "MONTH",
            "totalInterest": 732000,
            "provision": 22000,
            "paymentType": "Bayar dalam 12 bulan",
            "rate": 3,
            "id": "12_months",
            "merchantDiscountRate": 40000,
            "totalTransactionAmount": 2000000
        },
        {
            "amount": 2022000,
            "installmentAmount": 2388000,
            "monthlyInstallment": 398000,
            "tenure": 6,
            "tenureTimeUnit": "MONTH",
            "totalInterest": 366000,
            "provision": 22000,
            "paymentType": "Bayar dalam 6 bulan",
            "rate": 3,
            "id": "6_months",
            "merchantDiscountRate": 40000,
            "totalTransactionAmount": 2000000
        },
        {
            "amount": 2020500,
            "installmentAmount": 2203500,
            "monthlyInstallment": 734500,
            "tenure": 3,
            "tenureTimeUnit": "MONTH",
            "totalInterest": 183000,
            "provision": 20500,
            "paymentType": "Bayar dalam 3 bulan",
            "rate": 3,
            "id": "3_months",
            "merchantDiscountRate": 40000,
            "totalTransactionAmount": 2000000
        },
        {
            "amount": 2020000,
            "installmentAmount": 2020000,
            "monthlyInstallment": 2020000,
            "tenure": 1,
            "tenureTimeUnit": "MONTH",
            "totalInterest": 0,
            "provision": 20000,
            "paymentType": "Bayar dalam 30 hari",
            "rate": 0,
            "id": "1_months",
            "merchantDiscountRate": 40000,
            "totalTransactionAmount": 2000000
        }
    ]
}
```

{% endtab %}

{% tab title="401 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "Unauthorized"
    "message": "<String>"
  }
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "NotFoundError"
    "message": "<String>"
  }
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "GenericValidationError"
    "message": "<Object>"
  }
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "InternalServerError"
    "message": "InternalServerError"
  }
}
```

{% endtab %}
{% endtabs %}

## Purchase Transaction Checkout

<mark style="color:green;">`POST`</mark> `https://{base_url}/v2/checkout_url`

This endpoint is used once the customer has confirmed their installment option and you want to initiate checkout through Paylater by Indodana as the payment method.

`*` means the parameter is required

#### Headers

| Name                                            | Type   | Description                                                                               |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | The generated Authentication signature with format `Bearer {api_key}:{nonce}:{signature}` |

#### Request Body

| Name                                                      | Type   | Description                                                                                                                                                  |
| --------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| transactionDetails<mark style="color:red;">\*</mark>      | object | ***\<Transaction> -*** Detail of the transaction.                                                                                                            |
| customerDetails<mark style="color:red;">\*</mark>         | object | ***\<Customer> -*** Detail of the customer.                                                                                                                  |
| sellers<mark style="color:red;">\*</mark>                 | object | Array of ***\<Seller> -*** Detail of the sellers involved in the transaction. May contain more than 1 seller.                                                |
| billingAddress<mark style="color:red;">\*</mark>          | object | ***\<Address>** -* Billing address of the customer for the transaction.                                                                                      |
| shippingAddress<mark style="color:red;">\*</mark>         | string | (Required only for goods, for service / digital product is not required) ***\<Address> -*** Shipping address of the customer for the transaction.            |
| paymentType                                               | string | Installment options / payment terms chosen by the customer. ***Possible values:***  `30_days`, `3_months`, `6_months`, `12_months`, `15_months`, `18_months` |
| approvedNotificationUrl<mark style="color:red;">\*</mark> | string | The URL that will be called by Indodana when the transaction is approved and successful.                                                                     |
| cancellationRedirectUrl                                   | string |                                                                                                                                                              |
| backToStoreUrl                                            | string |                                                                                                                                                              |
| expirationAt                                              | string |                                                                                                                                                              |
| metadata                                                  | object | Key-value pair contains additional information about the transaction.                                                                                        |
| couponCode                                                | string | Optional promo code. If valid, discount is applied. If invalid or already used, the transaction may continue without the promo at the user’s discretion.     |

{% tabs %}
{% tab title="200 " %}

```javascript
// Checkout successful
{
  "redirectUrl": "https://sandbox01.indodanafinance.co.id/product-installment/payment?purchaseTransactionId=<generated-purchase-transaction-id>&tenure=3",
  "transactionId": "<INDODANA-TRANSACTION-ID>"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "GenericValidationError"
    "message": "<Object>"
  }
}
```

{% endtab %}
{% endtabs %}

## Check Transaction Status

<mark style="color:blue;">`GET`</mark> `https://{base_url}/v1/transactions/check_status`

You can use this endpoint to check the transaction status on Indodana.

`*` means the parameter is required

#### Query Parameters

| Name                                              | Type   | Description                                                       |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------- |
| merchantOrderId<mark style="color:red;">\*</mark> | string | The transaction order ID that is sent by merchant on the checkout |

#### Headers

| Name                                            | Type   | Description                                                                               |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | The generated Authentication signature with format `Bearer {api_key}:{nonce}:{signature}` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "status": "OK",
  "fraudStatus": "ACCEPT",
  "legalName": "<INDODANA-CUSTOMER-NAME>",
  "amount": 4500000,
  "indodanaUserId": "<INDODANA-USER-ID>",
  "paymentType": "3_months",
  "transactionStatus": "INITIATED",
  "merchantOrderId": "<MERCHANT-ORDER-ID>",
  "transactionTime": "2019-09-26T06:24:26+0000",
  "transactionId": "<INDODANA-TRANSACTION-ID>"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "NotFound"
    "message": "<String>"
  }
}
```

{% endtab %}
{% endtabs %}

## QRIS Check Transaction Status

<mark style="color:blue;">`GET`</mark> `https://{base_url}/v1/transactions/qris/check_status`

You can use this endpoint to check the transaction status on Indodana.

`*` means the parameter is required

#### Query Parameters

| Name                                              | Type   | Description                                                       |
| ------------------------------------------------- | ------ | ----------------------------------------------------------------- |
| merchantOrderId<mark style="color:red;">\*</mark> | string | The transaction order ID that is sent by merchant on the checkout |

#### Headers

| Name                                            | Type   | Description                                                                               |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | The generated Authentication signature with format `Bearer {api_key}:{nonce}:{signature}` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "status": "OK",
  "fraudStatus": "ACCEPT",
  "legalName": "<INDODANA-CUSTOMER-NAME>",
  "amount": 4500000,
  "indodanaUserId": "<INDODANA-USER-ID>",
  "paymentType": "3_months",
  "transactionStatus": "INITIATED",
  "merchantOrderId": "<MERCHANT-ORDER-ID>",
  "transactionTime": "2019-09-26T06:24:26+0000",
  "transactionId": "<INDODANA-TRANSACTION-ID>"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "NotFound"
    "message": "<String>"
  }
}
```

{% endtab %}
{% endtabs %}

## QRIS Transaction Metadata Callback

<mark style="color:green;">`POST`</mark> `https://{base_url}/v1/transactions/qris/metadata`

#### Headers

| Name                                            | Type   | Description                                                                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | <p>The generated authentication signature with format<br><code>Bearer {api\_key}:{nonce}:{signature}</code></p> |

#### Request Body

| Name                                              | Type   | Description                                                                             |
| ------------------------------------------------- | ------ | --------------------------------------------------------------------------------------- |
| merchantOrderId<mark style="color:red;">\*</mark> | string | The same merchant order id given by Merchant Partner when generating Quickpay URL.      |
| paidAt<mark style="color:red;">\*</mark>          | string | Timestamp of the successful transaction on Merchant Partner side. ISO-8601 date format. |
| customerPan<mark style="color:red;">\*</mark>     | string | QRIS customer PAN.                                                                      |
| acquirer<mark style="color:red;">\*</mark>        | string | Name of QRIS acquirer.                                                                  |
| referenceNumber<mark style="color:red;">\*</mark> | string | QRIS transaction reference number from switcher.                                        |

{% tabs %}
{% tab title="API Request" %}

```javascript
{
  "merchantOrderId": "<MERCHANT-ORDER-ID>",
  "paidAt": "2024-01-01T13:00:00.000+07:00",
  "acquirer": "Indodana",
  "customerPan": "123456789",
  "referenceNumber": "REF-123456789"
}
```

{% endtab %}

{% tab title="API Response" %}

```javascript
{
    "status": "OK"
}
```

{% endtab %}
{% endtabs %}

## Transaction Cancellation / Refund

<mark style="color:green;">`POST`</mark> `https://{base_url}/v3/order_cancellation`

`*` means the parameter is required

#### Headers

| Name                                            | Type   | Description                                                                               |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | The generated Authentication signature with format `Bearer {api_key}:{nonce}:{signature}` |

#### Request Body

| Name                                                 | Type   | Description                                                                                  |
| ---------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------- |
| merchantOrderId<mark style="color:red;">\*</mark>    | string | Merchant Order Id from Purchase Transactions                                                 |
| refundId<mark style="color:red;">\*</mark>           | string | Refund Id for each unique Refund Request                                                     |
| cancellationAmount<mark style="color:red;">\*</mark> | number | If cancellation amount > transaction amount, OR cancellation amount <= 0, will return ERROR  |
| cancelationReason<mark style="color:red;">\*</mark>  | string | Reason why cancellation happens                                                              |
| cancelledBy<mark style="color:red;">\*</mark>        | string | Who requested the cancellation                                                               |
| cancellationDate<mark style="color:red;">\*</mark>   | string | Timestamp of cancellation. Please follow **ISO 8601** (ex: 2020-05-15) for timestamp format. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "status": "OK",
    "fraudStatus": "ACCEPT",
    "merchantOrderId": "ns-01-10-20-02",
    "originalTransactionAmount": 30000,
    "transactionAmountWithMDR": 30518.82,
    "cancellationAmount": 10000,
    "afterCancellationTransactionAmount": 20000,
    "afterCancellationTransactionAmountWithMDR": 20518.82,
    "transactionStatus": "PROCESSED",
    "transactionTime": "2020-10-01T15:28:01+0700",
    "paymentType": "30_days",
    "refundId": "refund-1",
    "refundRequestId": "95e99289-2a43-11eb-8d0f-d7fd2743d6f4",
    "refundTime": "2020-10-01T15:30:03.325085+07:00"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
    "status": "ERROR",
    "error": {
        "kind": "DuplicateRefundError",
        "message": "Duplicate refund detected with refund id refund-1",
        "body": {
            "fraudStatus": "ACCEPT",
            "merchantOrderId": "ns-01-10-20-02",
            "originalTransactionAmount": 30000,
            "transactionAmountWithMDR": 30518.82,
            "cancellationAmount": 10000,
            "afterCancellationTransactionAmount": 20000,
            "afterCancellationTransactionAmountWithMDR": 20518.82,
            "transactionStatus": "PROCESSED",
            "transactionTime": "2020-10-01T15:28:01+0700",
            "paymentType": "30_days",
            "refundId": "refund-1",
            "refundTime": "2020-10-01T15:30:03.325085+07:00"
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Object Type References

### Payment

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>id</strong></td><td>string</td><td>64</td><td>Payment type / installment option identifier. <em><strong>Possible values :</strong><strong>  </strong><strong><code>30_days</code></strong><strong>,</strong><strong> </strong><strong><code>3_months</code></strong><strong>,</strong><strong> </strong><strong><code>6_months</code></strong><strong>,</strong><strong> </strong><strong><code>12_months</code></strong></em></td></tr><tr><td><strong>tenure</strong></td><td>integer</td><td>4</td><td>Installment option tenure</td></tr><tr><td><strong>rate</strong></td><td>decimal</td><td>16, 2</td><td>Interest rate</td></tr><tr><td><strong>transitionTermRate</strong></td><td>decimal</td><td>16, 2</td><td>Special case interest rate</td></tr><tr><td><strong>amount</strong></td><td>decimal</td><td>16, 2</td><td>Total amount for the transaction</td></tr><tr><td><strong>monthlyInstallment</strong></td><td>decimal</td><td>16, 2</td><td>Amount of monthly installment need to be paid</td></tr><tr><td><strong>discountedMonthlyInstallment</strong></td><td>decimal</td><td>16, 2</td><td>Amount of monthly installment after taking into account the discounts</td></tr><tr><td><strong>installmentAmount</strong></td><td>decimal</td><td>16, 2</td><td>Total installment amount</td></tr><tr><td><strong>downPayment</strong></td><td>decimal</td><td>16, 2</td><td>Total down payment amount</td></tr></tbody></table>

### Transaction

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>merchantOrderId</strong></td><td>string</td><td>32</td><td><p><strong>Required</strong>. The ID of the transaction that should be generated by merchant. </p><p></p><p>Allowed characters: <code>a-z, A-Z, 0-9, =, ., -, _, +, @, :, &#x26;, ^, %, !, $</code></p></td></tr><tr><td><strong>amount</strong></td><td>decimal</td><td>16, 2</td><td><strong>Required</strong>. Total amount of transaction</td></tr><tr><td><strong>items</strong></td><td><strong>Array&#x3C;Item></strong></td><td></td><td><strong>Required</strong>. Detail of items in the transaction</td></tr></tbody></table>

###

### Item

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>id</strong></td><td>string</td><td>64</td><td><strong>Required</strong>. Can be product SKU. For item fee such as: shipping fee, admin fee etc you have to use one of these: <em><strong><code>shippingfee</code></strong></em>, <em><strong><code>adminfee</code></strong></em>, <em><strong><code>taxfee</code></strong></em>, <em><strong><code>discount</code></strong></em>, <em><strong><code>additionalfee</code></strong></em>, <em><strong><code>insurancefee</code></strong></em>.</td></tr><tr><td><strong>name</strong></td><td>string</td><td>128</td><td><strong>Required</strong>. Product name</td></tr><tr><td><strong>price</strong></td><td>decimal</td><td>16, 2</td><td><strong>Required</strong>. Price for the product</td></tr><tr><td><strong>url</strong></td><td>string</td><td>256</td><td>URL of the product in the merchant site / platform</td></tr><tr><td><strong>imageUrl</strong></td><td>string</td><td>256</td><td>URL of the image of the product in the merchant site / platform</td></tr><tr><td><strong>category</strong></td><td>enum</td><td>256</td><td><p><strong>Required</strong>. Category of the product, one of these:</p><p></p><p><code>airlines</code> <code>arts-crafts-and-collectibles</code> <code>automotive</code> <code>baby</code> <code>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></p></td></tr><tr><td><strong>quantity</strong></td><td>integer</td><td>8</td><td><strong>Required</strong>. Quantity of the product / item bought</td></tr><tr><td><strong>parentType</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. Possible values<em><strong>:</strong><strong>  </strong><strong><code>SELLER</code></strong></em></td></tr><tr><td><strong>parentId</strong></td><td>string</td><td>32</td><td><strong>Required</strong>. It will correspond to the <code>SELLER ID</code> if the <code>parentType</code> is <code>SELLER</code></td></tr></tbody></table>

###

### Customer

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>firstName</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. First name of the customer</td></tr><tr><td><strong>lastName</strong></td><td>string</td><td>16</td><td>Last name of the customer</td></tr><tr><td><strong>email</strong></td><td>string</td><td>64</td><td><strong>Required</strong>. Email of the customer that is registered in the merchant site / platform</td></tr><tr><td><strong>phone</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. Phone number of the customer that is registered in the merchant site / platform</td></tr></tbody></table>

###

### Seller

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>id</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. Seller's ID</td></tr><tr><td><strong>name</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. Seller's name</td></tr><tr><td><strong>url</strong></td><td>string</td><td>256</td><td><strong>Required</strong>. Seller's shop URL</td></tr><tr><td><strong>sellerIdNumber</strong></td><td>string</td><td>32</td><td>Seller's identifier number (KTP / SIM / etc)</td></tr><tr><td><strong>email</strong></td><td>string</td><td>64</td><td><strong>Required</strong>. Seller's email</td></tr><tr><td><strong>address</strong></td><td><code>Address</code></td><td></td><td>Seller's shop address</td></tr><tr><td><strong>officialSeller</strong></td><td>boolean</td><td></td><td>Whether Seller is if official or not. Non Mandatory</td></tr></tbody></table>

###

### Address

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>firstName</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. First name of customer</td></tr><tr><td><strong>lastName</strong></td><td>string</td><td>16</td><td>Last name of customer</td></tr><tr><td><strong>address</strong></td><td>string</td><td>256</td><td><strong>Required</strong>. Address for billing or shipping activity</td></tr><tr><td><strong>city</strong></td><td>string</td><td>32</td><td><strong>Required</strong>. City description for the address</td></tr><tr><td><strong>postalCode</strong></td><td>string</td><td>8</td><td><strong>Required</strong>. Postal code for the address</td></tr><tr><td><strong>phone</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. Phone number for billing or shipping activity</td></tr><tr><td><strong>countryCode</strong></td><td>string</td><td>16</td><td><strong>Required</strong>. <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3"><strong>ISO 3166-1 alpha-3</strong></a> (ex: <em>IDN</em> for Indonesia)</td></tr></tbody></table>

###

### Metadata

<table data-header-hidden><thead><tr><th>Name</th><th width="150">Type</th><th width="150">Length</th><th>Remarks</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Length</td><td>Remarks</td></tr><tr><td><strong>ipAddress</strong></td><td>String</td><td>45</td><td>Ipv4 of user</td></tr><tr><td><strong>userAgent</strong></td><td>String</td><td>256</td><td>Browser user agent of user</td></tr><tr><td><strong>deviceId</strong></td><td>String</td><td>256</td><td>User device id</td></tr><tr><td><strong>imsi</strong></td><td>String</td><td>15</td><td>User international mobile subscriber identity</td></tr><tr><td><strong>location</strong></td><td><code>Location</code></td><td>256</td><td><strong>Required for QRIS transaction from Merchant Partners.</strong> Information about the location of the transaction in Latitude and Longitude.</td></tr><tr><td><strong>qrisContent</strong></td><td>String</td><td>512</td><td><strong>Required for QRIS transaction from Merchant Partners.</strong> QRIS specific. String of QRIS content</td></tr><tr><td><strong>scanQrisLocation</strong></td><td><code>Location</code></td><td>256</td><td><strong>Required for QRIS transaction from Merchant Partners.</strong> QRIS specific. Information about the location of scan QRIS location in Latitude and Longitude.</td></tr><tr><td><strong>transactionPurpose</strong></td><td>String</td><td>128</td><td>The purpose of transactions. Value must be: <code>BUSINESS_DEVELOPMENT / PRODUCTIVE / CONSUMPTIVE / OTHERS</code> </td></tr><tr><td><strong>tipAmount</strong></td><td>Decimal</td><td>16, 2</td><td>QRIS specific. Fill if QRIS have tip.</td></tr></tbody></table>

###

### Location

<table><thead><tr><th width="214">Name</th><th width="163">Type</th><th width="164">Length</th><th>Remarks</th></tr></thead><tbody><tr><td><strong>lat</strong></td><td>decimal</td><td>3, 10</td><td>Latitude</td></tr><tr><td><strong>lng</strong></td><td>decimal</td><td>3, 10</td><td>Longitude</td></tr></tbody></table>

## Sample API Request & Response

### Get Installment Options

{% tabs %}
{% tab title="API Request" %}

```javascript
{
  "amount": 2000000,
  "items": [
    {
      "id": "<MERCHANT-ITEM-ID>",
      "name": "iPhone 6S",
      "category": "<ITEM-CATEGORY>",
      "price": 2000000,
      "url": "http://merchant.com/phone/iphone-6s",
      "imageUrl": "http://merchant.com/phone/iphone-6s/cover.jpg",
      "type": "Mobile Phone",
      "quantity": 1,
      "parentType": "SELLER",
      "parentId": "<MERCHANT-SELLER-ID>"
    }
  ]
}
```

{% endtab %}

{% tab title="API Response" %}

```javascript
{
  "status": "OK",
  "payments": [
    {
      "downPayment": 0,
      "paymentType": "Bayar dalam 3 bulan",
      "amount": 9450000,
      "installmentAmount": 10584000,
      "rate": 4,
      "monthlyInstallment": 3528000,
      "discountedMonthlyInstallment": 0,
      "tenure": 3,
      "id": "3_months"
    },
    {
      "downPayment": 0,
      "paymentType": "Bayar dalam 6 bulan",
      "amount": 9450000,
      "installmentAmount": 11718000,
      "rate": 4,
      "monthlyInstallment": 1953000,
      "discountedMonthlyInstallment": 0,
      "tenure": 6,
      "id": "6_months"
    },
    {
      "downPayment": 0,
      "paymentType": "Bayar dalam 12 bulan",
      "amount": 9450000,
      "installmentAmount": 13986000,
      "rate": 4,
      "monthlyInstallment": 1165500,
      "discountedMonthlyInstallment": 0,
      "tenure": 12,
      "id": "12_months"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

### Purchase Transaction Checkout

{% tabs %}
{% tab title="API Request" %}

```javascript
{
    "transactionDetails": {
      "merchantOrderId": "<MERCHANT-ORDER-ID>",
      "amount": 4500000,
      "items": [
        {
          "id": "<MERCHANT-ITEM-ID>",
          "name": "iPhone 6S",
          "category": "<ITEM-CATEGORY>",
          "price": 4500000,
          "url": "http://merchant.com/phone/iphone-6s",
          "imageUrl": "http://merchant.com/phone/iphone-6s/cover.jpg",
          "type": "Mobile Phone",
          "quantity": 1,
          "parentType": "SELLER",
          "parentId": "<MERCHANT-SELLER-ID>"
        }
      ]
    },
    "customerDetails": {
      "firstName": "First",
      "lastName": "Last",
      "email": "first.last@gmail.com",
      "phone": "081212345678"
    },
    "sellers": [
      {
        "id": "<MERCHANT-SELLER-ID>",
        "name": "Penjual iPhone",
        "url": "https://merchant.com/shop",
        "sellerIdNumber": "<MERCHANT-SELLER-ID-NUMBER>",
        "email": "seller@merchant.com",
        "officialSeller": false,
        "address": {
          "firstName": "Merchant",
          "lastName": "Seller",
          "address": "Kelapa Gading",
          "city": "Jakarta Utara",
          "postalCode": "11240",
          "phone": "081812345678",
          "countryCode": "IDN"
        }
      }
    ],
    "billingAddress": {
      "firstName": "First",
      "lastName": "Last",
      "address": "Tomang",
      "city": "Jakarta Barat",
      "postalCode": "11430",
      "phone": "081987654321",
      "countryCode": "IDN"
    },
    "shippingAddress": {
      "firstName": "First",
      "lastName": "Last",
      "address": "Tomang",
      "city": "Jakarta Barat",
      "postalCode": "11430",
      "phone": "081987654321",
      "countryCode": "IDN"
    },
    "paymentType": "3_months",
    "approvedNotificationUrl": "https://payment-notification.merchant.com/transaction-approval-handler",
    "cancellationRedirectUrl": "http://merchant.com/phone/iphone-6s",
    "backToStoreUrl": "http://merchant.com/phone/iphone-6s",
    "expirationAt": "2019-12-31T18:00:00+07:00"
}
```

{% endtab %}

{% tab title="API Response" %}

```javascript
{
  "status": "OK",
  "redirectUrl": "https://sandbox01.indodana.com/product-installment/payment?purchaseTransactionId=<generated-purchase-transaction-id>&tenure=3",
  "transactionId": "<INDODANA-TRANSACTION-ID>"
}
```

{% endtab %}
{% endtabs %}

### Handling Transaction Confirmation Notification

{% hint style="info" %}
Note that for this section, the ***API Request*** would be the payload that the merchant receives in their endpoint, and the ***API Response*** would be the payload that the merchant expected to send to Indodana as acknowledgement.
{% endhint %}

{% tabs %}
{% tab title="API Request" %}

```javascript
{
    "amount": 1876000.00,    
    "paymentType": "30_days",
    "transactionStatus": "PAID",
    "merchantOrderId": "<MERCHANT-ORDER-ID>",
    "transactionTime": "2018-12-21T18:18:18+07:00",
    "transactionId": "<INDODANA-TRANSACTION-ID>"
}    
```

{% endtab %}

{% tab title="API Response \[OK]" %}

```javascript
{
  "status":"OK",
  "message":"Message from merchant if any"
}
```

{% endtab %}

{% tab title="API Response \[REJECT]" %}

```javascript
{
  "status":"REJECT",
  "message":"Message from merchant if any"
}
```

{% endtab %}
{% endtabs %}

### Check Transaction Status

{% tabs %}
{% tab title="API Response" %}

```javascript
{
  "status": "OK",
  "fraudStatus": "ACCEPT",
  "legalName": "<INDODANA-CUSTOMER-NAME>",
  "amount": 4500000,
  "indodanaUserId": "<INDODANA-USER-ID>",
  "paymentType": "3_months",
  "transactionStatus": "<INDODANA-TRANSACTION-STATUS>",
  "merchantOrderId": "<MERCHANT-ORDER-ID>",
  "transactionTime": "2019-09-26T06:24:26+0000",
  "transactionId": "<INDODANA-TRANSACTION-ID>"
}
```

{% endtab %}
{% endtabs %}

### Purchase Transaction Cancellation / Refund

{% tabs %}
{% tab title="API Request" %}

```javascript
{
  "refundId":"<REFUND-ID>",
  "merchantOrderId":"<MERCHANT-ORDER-ID>",
  "cancellationAmount" : 4500000,  
  "cancellationReason":"Out of stock",
  "cancelledBy":"<SELLER/CUSTOMER>",
  "cancellationDate": "2019-09-12T18:18:18+07:00"
}
```

{% endtab %}

{% tab title="API Response" %}

```javascript
{
  "status": "OK",
  "fraudStatus": "ACCEPT",
  "merchantOrderId": "<MERCHANT-ORDER-ID>",
  "originalTransactionAmount": 4500000,
  "cancellationAmount": 4500000,
  "afterCancellationTransactionAmount": 0,
  "transactionStatus": "CANCELLED",
  "transactionTime": "2019-09-26T09:01:57+0000",
  "paymentType": "3_months"
}
```

{% endtab %}

{% tab title="(Failed) API Response" %}

```javascript
{
  "status": "ERROR",
  "error": {
    "kind": "BadRequest",
    "message": "Refund with purchase transaction id: <INDODANA-TRANSACTION-ID> is failed because refund amount: 9990000 is larger than purchase transaction total amount: 4450000.00"
  }
}
```

{% endtab %}
{% endtabs %}
