> For the complete documentation index, see [llms.txt](https://foodcommerce-api-help.onlinesales.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foodcommerce-api-help.onlinesales.ai/billing-api/charge-api.md). Agents can also search and read this documentation through its [MCP server](https://foodcommerce-api-help.onlinesales.ai/~gitbook/mcp).

# Charge API

<mark style="color:green;">`POST`</mark> `services.onlinesales.ai/osBillingServiceV2/marketplace/charge`

#### Request Body

| Name                                                          | Type    | Description                                                                                                                                                                          |
| ------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| amount<mark style="color:red;">\*</mark>                      | Double  | <p>The amount for which the transaction is done.<br>The amount should be a non-negative number greater than or equal to 1.</p>                                                       |
| merchantId                                                    | String  | <p>Merchant id of seller/brand.<br>The merchant should be a valid merchant in OS systems.</p>                                                                                        |
| currency<mark style="color:red;">\*</mark>                    | String  | <p>Currency of the amount specified in the request:</p><p>Valid currency format : INR, USD, AED<br><br>Currency cannot be null or empty.</p><p>Should be a 3 letter valid value.</p> |
| token<mark style="color:red;">\*</mark>                       | String  | <p>Valid app token shared by Onlinesales.ai<br>NOTE: do not use this token in any application on the client side.</p>                                                                |
| partnerTransactionId                                          | String  | <p>Transaction id for this transaction at marketplace’s side. OS will handle duplicates with this id. <br>valid string. Maximum of 128 characters</p>                                |
| merchantType<mark style="color:red;">\*</mark>                | String  | <p>Merchant type of the merchant for which the transaction is being carried out.<br>Expected Values (case insensitive) brand OR seller</p>                                           |
| transactionTime(epoch time)<mark style="color:red;">\*</mark> | Integer | <p>The time at which the transaction for this merchant took place.<br>The transaction time will be a epoch time (in milliseconds)</p>                                                |
| Description                                                   | String  | Description of the transaction if any The description should not be greater than 128 character                                                                                       |
| 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. <br>Expected Values<br>Shared by OS</p>                                      |
| creditType                                                    | String  | <p>This indicates the type of charge. <br>Should be one of Prepaid OR INCENTIVE<br>Default Value: Prepaid</p>                                                                        |

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

```javascript
{
    "clientId": 92172,
    "merchantId": "KAKASJ-123",
    "partnerTransactionId": "87645364"
    "id": 2434, // transaction id generated by OS  
    "status" : "SUCCESS" ,
    "marketplaceClientId":<Marketplace Client Id>,
    "details" : {}
}
```

{% endtab %}
{% endtabs %}

### Request Body

```
{
    "amount": 100000
    "currency": "USD",
    "merchantId": "XYZ-123",
    "partnerTransactionId": "87645364", // this will be used to handle duplicates
    "merchantType": "seller",
    "transactionTime": 1585191090000, // epoch in ms
    "description": "description if any regarding the transaction. This will be shown on the UI to merchants",
    "token": <token>,  //token shared by onlinesales.
    "marketplaceClientId": <Marketplace Client Id>//clientId provided by OS
    "creditType": "INCENTIVE"  // Default - Prepaid 
}
```

### Response Field Description

| Field                | Data Type | Description                                                                                                                                                                                         |
| -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| clientId             | Integer   | OS created id for merchant                                                                                                                                                                          |
| merchantId           | String    | Marketplace merchant id                                                                                                                                                                             |
| merchantType         | String    | Expected Values (case insensitive) brand OR seller                                                                                                                                                  |
| id                   | Integer   | OS transaction id                                                                                                                                                                                   |
| partnerTransactionId | String    | <p>Transaction id for this transaction at Marketplace’s side. OS will handle duplicates with this id.</p><p>valid string. Maximum of 128 characters</p>                                             |
| status               | String    | status of the request SUCCESS, FAILED                                                                                                                                                               |
| details              | JSON      | <p>Any details regarding the transaction</p><p>"details": { <br>  "error": { <br>    "code": "IP0000",  "message": "Invalid Parameters Error", "description": \[ “\<error message>” <br> ]<br>}</p> |
| marketplaceClientId  | Integer   | Unique client id defined by OS for the marketplace. It will be different for staging and production.                                                                                                |
