# PoS Transaction API

## API Flow Overview

<figure><img src="/files/FZNyUEah4FYNBUv0dYl3" alt=""><figcaption></figcaption></figure>

## 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&#x20;

{% tabs %}
{% tab title="Sandbox" %}
<https://sandbox01-offline.indodanafinance.co.id/api>
{% endtab %}

{% tab title="Production" %}
<https://offline.indodanafinance.co.id/api>
{% endtab %}
{% endtabs %}

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

## PoS Checkout

<mark style="color:green;">`POST`</mark> `https://base_url/public/v3/qr-checkout`

`*` means the parameter is required

#### Request Body

| Name                                                | Type   | Description                                                                                              |
| --------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------- |
| server\_key<mark style="color:red;">\*</mark>       | string | Will be provided by Indodana for your integration.                                                       |
| amount<mark style="color:red;">\*</mark>            | number | Non negative value of grand total of customer's transaction                                              |
| source<mark style="color:red;">\*</mark>            | string | Please send us static value of "QR" for now                                                              |
| order\_id<mark style="color:red;">\*</mark>         | string | Unique order id of your transaction. Never use the same order\_id twice or the request will be rejected. |
| sub\_merchant\_id<mark style="color:red;">\*</mark> | string | Will be provided by Indodana for your integration.                                                       |
| push\_uri<mark style="color:red;">\*</mark>         | string | Valid url. This will be used by Indodana to perform callback once the payment is complete.               |
| items<mark style="color:red;">\*</mark>             | object | Array of JSON, consist of each customer's transaction details.                                           |

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

```
{
    "status": "OK",
    "qr_image": "https://indodana-qr-image.com/please/load/from/here",
    "raw_string_qr": "0002I101021226890015id.indodana.www01194fef0cca-6a76-11e9-02364fef0cca-6a76-11e9-a923-1681be663d3e03034fe5802ID5903wat62400136233c6099-bae1-11ec-9ca9-25e05126faf4"
    "transaction_id": "a7d2b836-c429-11eb-887a-b330815b2e37"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Please follow this [doc](/indodana-paylater/api-reference/api-reference.md#handling-transaction-confirmation-notification) to learn about callback
{% endhint %}

```
// sample request
{
    "server_key": "7F89lL7JIYKqX5UuPhg34lZWhoL54pFm",
    "amount": 95000,
    "source": "QR",
    "order_id": "9YUy8Z5s",
    "sub_merchant_id": "19cd5c6c-a24a-11e9-93c5-00163e013bb4",
    "push_uri": "https://your.url/any/path/is/ok",
    "items": [{
        "id": "001",
        "name": "Es Teh",
        "price": 10000,
        "type": "Drink",
        "quantity": 2
    }, {
        "id": "002",
        "name": "Nasi Goreng",
        "price": 25000,
        "type": "Food",
        "quantity": 3
    }]
}
```

## Object Type References

### items

<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>id</td><td>string</td><td>64</td><td><strong>Required.</strong> Item catalog identifier</td></tr><tr><td>name</td><td>string</td><td>128</td><td><strong>Required.</strong> Item name</td></tr><tr><td>price</td><td>number</td><td>16,2</td><td><strong>Required.</strong> Item price per quantity</td></tr><tr><td>type</td><td>string</td><td>64</td><td><strong>Required.</strong> Item category type</td></tr><tr><td>quantity</td><td>number</td><td>5</td><td><strong>Required.</strong> Total purchase quantity for this item</td></tr></tbody></table>

## 422-Error Debugging

{% tabs %}
{% tab title="MethodArgumentNotValidException" %}
check **error.message** in the response body, some required fields might not be provided in the request body.
{% endtab %}

{% tab title="GenericException" %}

1. Check if the order\_id is unique or not.
2. The amount might not be supported for Indodana's Rate Policy such as the value is too small or too big.
3. Contact Indodana's Developer
   {% endtab %}
   {% endtabs %}


---

# Agent Instructions: 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:

```
GET https://dev.indodana.id/indodana-paylater/api-reference/pos-transaction-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
