> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-60c89f9a-mintlify-audit-missing-sections-1778528421.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an Instant Settlement

> **POST** `/v1/settlements/ondemand`

Use this endpoint to create an Instant Settlement.

### Request

````cURL: Curl theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/settlements/ondemand \
-H "content-type: application/json" \
-d '{
  "amount": 200000,
  "settle_full_balance": false,
  "description": "Need this to make vendor payments.",
  "notes": {
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf."
  }
}'

```java: Java
RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

JSONObject settlementRequest = new JSONObject();
settlementRequest.put("amount", 200000);
settlementRequest.put("settle_full_balance", false);
settlementRequest.put("description", "Need this to make vendor payments.");
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
settlementRequest.put("notes", notes);       
        
Settlement settlement = razorpay.settlement.create(settlementRequest);

```python: Python
import razorpay
client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

client.settlement.create_ondemand_settlement({
  "amount": 200000,
  "settle_full_balance": False,
  "description": "Need this to make vendor payments.",
  "notes": {
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf."
  }
})

```go: Go
import ( razorpay "github.com/razorpay/razorpay-go" )
client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

data:= map[string]interface{}{
  "amount": 200000,
  "settle_full_balance": false,
  "description": "Need this to make vendor payments.",
  "notes": map[string]interface{}{
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf.",
  },
}
body, err := client.Settlement.CreateOnDemandSettlement(data, nil)

```php: PHP
$api = new Api($key_id, $secret);

$api->settlement->createOndemandSettlement(array("amount"=> 200000, "settle_full_balance"=> false, "description"=>"Need this to make vendor payments.","notes" => array("notes_key_1"=> "Tea, Earl Grey, Hot","notes_key_2"=> "Tea, Earl Grey… decaf.")));

```ruby: Ruby
require "razorpay"
Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

param_attr = {
  "amount": 200000,
  "settle_full_balance": 0,
  "description": "Need this to make vendor payments.",
  "notes": {
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf."
  }
}
Razorpay::Settlement.create(param_attr)

```javascript: Node.js
var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

instance.settlements.createOndemandSettlement({
  "amount": 200000,
  "settle_full_balance": false,
  "description": "Need this to make vendor payments.",
  "notes": {
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf."
  }
})

```csharp: .NET
RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

Dictionary settlementRequest = new Dictionary();
settlementRequest.Add("amount", 100);
settlementRequest.Add("settle_full_balance", false);
settlementRequest.Add("description", "Testing");
Dictionary notes = new Dictionary();
notes.Add("notes_key_1", "Tea, Earl Grey, Hot");
notes.Add("notes_key_2", "Tea, Earl Grey� decaf.");
settlementRequest.Add("notes", notes);

Settlement settlement = client.Settlement.Create(settlementRequest);
````

### Response

````json: Success theme={null}
{
  "id": "setlod_FNj7g2YS5J67Rz",
  "entity": "settlement.ondemand",
  "amount_requested": 200000,
  "amount_settled": 0,
  "amount_pending": 199410,
  "amount_reversed": 0,
  "fees": 590,
  "tax": 90,
  "currency": "INR",
  "settle_full_balance": false,
  "status": "initiated",
  "description": "Need this to make vendor payments.",
  "notes": {
    "notes_key_1": "Tea, Earl Grey, Hot",
    "notes_key_2": "Tea, Earl Grey… decaf."
  },
  "created_at": 1596771429,
  "ondemand_payouts": {
    "entity": "collection",
    "count": 1,
    "items": [
      {
        "id": "setlodp_FNj7g2cbvw8ueO",
        "entity": "settlement.ondemand_payout",
        "initiated_at": null,
        "processed_at": null,
        "reversed_at": null,
        "amount": 200000,
        "amount_settled": null,
        "fees": 590,
        "tax": 90,
        "utr": null,
        "status": "created",
        "created_at": 1596771429
      }
    ]
  }
}
```json: Failure
{
    "error": {
        "code": "BAD_REQUEST_ERROR",
        "description": "Minimum amount that can be settled is ₹ 1.",
        "source": "NA",
        "step": "NA",
        "reason": "NA",
        "metadata": {}
    }
}
````

### Parameters

`amount` *mandatory*
: `integer` The amount, in paise, you want to instantly settle.

**SUCCESS**

**What's New**

Settlement amounts of ₹1 or lower are now supported.

`settle_full_balance` *optional*
: `boolean` Indicates whether full balance is settled. Possible values:

* `true`:  Razorpay will settle the maximum amount possible. Values passed in the `amount` parameter are ignored.
* `false` (default): Razorpay will settle the amount requested in the `amount` parameter.

`description` *optional*
: `string` This is a custom note you can pass for the instant settlement for your reference. For example, `Need this to make vendor payments.`.

* Maximum length: 30 characters.
* Allowed characters: a-z, A-Z, 0-9 and space.

`notes` *optional*
: `object` Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `Beam me up Scotty`.

### Parameters

`id`
: `string` The unique identifier of the instant settlement transaction. For example, `setlod_FNj7g2YS5J67Rz`.

`entity`
: `string` Indicates the type of entity. Here it is `settlement.ondemand`.

`amount_requested`
: `integer` The settlement amount, in paise, requested by you. For example, `200000`.

`amount_settled`
: `integer` Total amount (minus fees and tax), in paise, settled to the bank account. For example, `199410`.

`amount_pending`
: `integer` Portion of the requested amount, in paise, yet to be settled to you.

`amount_reversed`
: `integer` Portion of the requested amount, in paise, that was not settled to you. This amount is reversed to your PG current balance.

`fees`
: `integer` Total amount (fees+tax), in paise, deducted for the instant settlement. For example, `590`.

`tax`
: `integer` Total tax, in paise, charged for the fee component. For example, `90`.

`currency`
: `string` The 3-letter ISO currency code for the settlement. Here it is `INR`.

`settle_full_balance`
: `boolean` Indicates whether full balance is settled. Possible values:

* `true`:  Razorpay will settle the maximum amount possible. Values passed in the `amount` parameter are ignored.
* `false` (default): Razorpay will settle the amount requested in the `amount` parameter.

`status`
: `string` Indicates the state of the instant settlement. Possible values:

* `created`: The instant settlement request has been created.
* `initiated`: The instant settlement process has been initiated.
* `partially_processed`: The instant settlement is being processed.
* `processed`: The instant settlement has been processed and the amount has been transferred to your bank account.
* `reversed`: The instant settlement could not be processed for some reason and the amount has been transferred back to your PG balance.

`description`
: `string` This is a custom note you can pass for the instant settlement for your reference. For example, `Need this to make vendor payments.`.

`notes`
: `object` Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `"note_key": "Beam me up Scotty”`.

`created_at`
: `integer` Unix timestamp at which the instant settlement was created. For example, `1596771429`.

`ondemand_payouts`
: `object` List of payouts created for the instant settlement.

`entity`
: `string` Indicates the type of `ondemand_payouts` entity. Here it is `collection`.

`count`
: `integer` The number of items in the array. For example, `1`.

`items`
: `array` List of payouts created for the instant settlement.

`id`
: `string` The unique identifier for the payout. For example, `setlodp_FNj7g2cbvw8ueO`.

`entity`
: `string` Indicates the type of `items` entity. Here it is `settlement.ondemand_payout`.

`initiated_at`
: `integer` Unix timestamp at which the payout was initiated. For example, `1596771430`.

`processed_at`
: `integer` Unix timestamp at which the payout was processed. For example, `1596778752`.

`reversed_at`
: `integer` Unix timestamp at which the payout was reversed. For example, `1596778752`.

`amount`
: `integer` The amount, in paise, settled through this payout. For example, `200000`.

`amount_settled`
: `integer` Amount (minus fees and tax), in paise, settled through this payout. For example, `199410`.

`fees`
: `integer` Amount (fees+tax), in paise, deducted for this payout. For example, `590`.

`tax`
: `integer` Tax charged, in paise, for the fee component. For example, `90`.

`utr`
: `string` The unique transaction number linked to a payout.

`status`
: `string` Status of the payout. Possible values:

* `created`: The payout has been created.
* `initiated`: The payout has been initiated.
* `processed`: The payout has been processed. The amount has been transferred to your bank account.
* `reversed`: The payout has been reversed. The amount has been transferred back to your PG balance.

`created_at`
: `integer` Unix timestamp at which the payout was created.

### Errors

The API \{key/secret} provided is invalid.

* code: 4xx
* description: The API credentials passed in the API call differ from the ones generated on the Dashboard.
* solution: The API keys must be active and entered correctly with no whitespace before or after.
