# Payment



# Invoice checkout (ONDELIVERY)

#### Flowchart

##### Source:  
[https://cahskuy.stoplight.io/docs/OND/3c78799259e69-payment-checkout](https://cahskuy.stoplight.io/docs/OND/3c78799259e69-payment-checkout)  


Reference:  
[Transaction Flowchart](https://documentation.onindonesia.id/books/getting-started/page/transaction-flowchart)

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td><td>**Authentication**</td></tr><tr><td><div><div>/sys/payment-checkout</div></div></td><td>POST</td><td>Yes</td></tr></tbody></table>

##### Authentication (Basic)

<table border="1" id="bkmrk-endpoint-method-serv" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 29.8172%;"></col><col style="width: 70.1828%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Param**  
</td><td style="height: 29.8785px;">**Value**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">username</td><td style="height: 29.8785px;"><div><div><div><div>on-booking</div></div><div><div>  
</div></div></div></div></td></tr><tr><td><div><div>password</div></div></td><td><div><div><div><div><div><div>iRiLiODOSV1X8WMVCThlOhpwnOYdsRYXiaJI3hIfeDZKaiOkKioUBQr1Y7PlnXhM</div></div></div></div></div></div></td></tr></tbody></table>

##### Body request example

```json
{
    "total_amount": 40000,
    "service": "ONDELIVERY",
    "source": "XENDIT",
    "client": "usernew1",
    "waybill_number": "OND123456789",
    "xendit_methods": ["QRIS"]
}
```

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 5.19159%;"></col><col style="width: 15.9456%;"></col><col style="width: 11.3731%;"></col><col style="width: 13.1015%;"></col><col style="width: 10.5068%;"></col><col style="width: 43.8813%;"></col></colgroup><tbody><tr><td>**No.**</td><td>**Properties**  
</td><td>**Properties of**</td><td>**Data type**</td><td>**Required**</td><td>**Description**</td></tr><tr><td>1</td><td>total\_amount</td><td>  
</td><td>integer</td><td>yes</td><td>Total nominal amount for the invoice.</td></tr><tr><td>2</td><td>service</td><td>  
</td><td>string</td><td>yes</td><td>ONINDONESIA services.  
Possible values:

- ONDELIVERY means the source of the transaction comes from ondelivery.
- ONTICKET means the source of the transaction comes from onticket.
- ONMARKET means the source of the transaction comes from onmarket.

</td></tr><tr><td>3</td><td>source</td><td>  
</td><td>string</td><td>yes</td><td>A way that users pay for a product or service. Possible values: XENDIT or BALANCE.</td></tr><tr><td>4</td><td>client</td><td> </td><td>string</td><td>yes</td><td>Username sender of ONDELIVERY.</td></tr><tr><td>5</td><td>waybill\_number</td><td>  
</td><td>string</td><td>yes</td><td>Waybill Number or AWB created from OSAS.</td></tr><tr><td>6</td><td>xendit\_methods</td><td>  
</td><td>array&lt;string&gt;</td><td>no</td><td>The specific payment channel used to pay the invoice. Possible values for bank transfer: BCA, BNI, BSI, BRI, MANDIRI, PERMATA. Possible values for ewallet:

- DANA
- OVO
- LINKAJA
- SHOPEEPAY
- GCASH
- GRABPAY
- PAYMAYA
- QRIS

QRIS is only payment method for now.

</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Response example</summary>

<p class="callout info">200 (OK)</p>

<p class="callout info">Example response for ONMARKET</p>

```json
{
    "xendit_invoice": "qr_dbc7200c-ed8a-4088-9430-dae9f529f6bb",
    "invoice": "OD0001N12C00006",
    "expired_at": "2024-02-14T10:02:10.065027Z",
    "amount": 40000,
    "qr_string": "0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB"
}
```

<table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 16.9448%;"></col><col style="width: 14.6341%;"></col><col style="width: 15.7895%;"></col><col style="width: 52.6316%;"></col></colgroup><tbody><tr><td>**Properties**  
</td><td>**Properties of**</td><td>**Data type**</td><td>**Description**</td></tr><tr><td>xendit\_invoice</td><td>  
</td><td>string</td><td>invoice ID generated by XENDIT and translated by USAPI</td></tr><tr><td>expired\_at</td><td>  
</td><td>timestampz</td><td>ISO date and time that the invoice expires.

</td></tr><tr><td>invoice</td><td>  
</td><td>string</td><td>Invoice ID generated by USAPI

</td></tr><tr><td>qr\_string</td><td>  
</td><td>string</td><td>QR String created by XENDIT

</td></tr></tbody></table>

</details><details id="bkmrk-error-example-body-r"><summary>Error response</summary>

<p class="callout danger">400 Bad Request</p>

> Some parameters may contain invalid values or some parameters are not present.

```json
{
    "message": "Invalid JSON Format"
}
```

> Balance is not enough for doing transaction

```json
{
    "message": "Insufficient balance"
}
```

<p class="callout danger">401 Unauthorized</p>

> Authentication header is not valid or missing

```json
{
    "message": "Auth Error"
}
```

<p class="callout danger">500 Internal server error</p>

> Internal server error

```json
{
    "message": "Internal server error"
}
```

</details>