# Balance API

<mark style="color:blue;">`GET`</mark> `https://services.onlinesales.ai/osBillingServiceV2/marketplace/balance`

#### Query Parameters

| Name                                                  | Type    | Description                                                                                                                                        |
| ----------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| token<mark style="color:red;">\*</mark>               | String  | Valid app token shared by Onlinesales.ai \**note: do not use this token in any application on the client side.*                                    |
| merchantId<mark style="color:red;">\*</mark>          | String  | <p>Merchant id of seller / brand.</p><p>Merchant should be a valid merchant in OS systems.</p>                                                     |
| merchantType<mark style="color:red;">\*</mark>        | String  | <p>Merchant type of the merchant for which the transaction is being carried out.</p><p>Expected Values:<br>brand seller</p>                        |
| marketplaceClientId<mark style="color:red;">\*</mark> | Integer | <p>Unique client id defined by OS for the marketplace. It will be different for staging and production.</p><p>Expected Values:<br>Shared by OS</p> |

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

```javascript
{
    "balanceAmount": 200,
    "marketplaceClientId": <Marketplace Client Id>,
    "totalCredit" : 1000,
    "totalSpend" : 800,
    "currency" : "USD"
}
```

{% endtab %}
{% endtabs %}

### Request Body

```
{
    "token": <token> <Token shared by onlinesales>,
    "merchantType" : "seller",
    "merchantId" : "8979879123",
    "marketplaceClientId": <Marketplace Client Id>
}
```

### Sample Request

```
curl --location --request GET 
'https://services.onlinesales.ai/osBillingServiceV2/marketplace/balance?
merchantType=seller&merchantId=TOQ-15126
&marketplaceClientId=110600&token=376eae4b770b0efe50b6242bfd4aac47'
```

### Response Field Description

| Field               | Data Type                | Description                                                                                          |
| ------------------- | ------------------------ | ---------------------------------------------------------------------------------------------------- |
| balanceAmount       | Double (till 2 decimals) | This is the remaining amount for the specified merchant.                                             |
| totalCredit         | Double (till 2 decimals) | Total valid topups (payments) done till now.                                                         |
| totalSpend          | Double (till 2 decimals) | Total spend reported in the system                                                                   |
| currency            | String                   | Currency in which balanceAmount totalCredit totalSpend is specified.                                 |
| marketplaceClientId | Integer                  | Unique client id defined by OS for the marketplace. It will be different for staging and production. |


---

# 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://foodcommerce-api-help.onlinesales.ai/billing-api/balance-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.
