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

# Get Balance

This endpoint retrieves the current financial status of a merchant’s account. It provides real-time information on:

* Collection Pool Balance – the total amount currently available in all collection pools.
* Payout Pool Balance – the total amount currently available for payouts.
* Today’s Total Collections – the sum of all collections received for the current day.<br>

This API is useful for monitoring cash flow and ensuring transparency in both collections and payouts.

## Endpoint

<table data-header-hidden><thead><tr><th width="73.109375">Method</th><th>Endpoint</th></tr></thead><tbody><tr><td><mark style="color:green;">GET</mark></td><td><pre><code>https://api.payright.my/api/v1/merchant/balance
</code></pre></td></tr></tbody></table>

### Usage Examples

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

```bash
curl -X GET "https://api.payright.my/api/v1/merchant/balance" \
  -H "auth-token: eyJhbGciO...XZI3CLi_a0BeUOJMPUK00"
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client
import urllib.parse

# Parse the URL
url = "https://api.payright.my/api/v1/merchant/balance"
parsed_url = urllib.parse.urlparse(url)

# Create HTTPS connection
conn = http.client.HTTPSConnection(parsed_url.hostname)

# Prepare headers
headers = {
    "auth-token": "eyJhbGciO...XZI3CLi_a0BeUOJMPUK00" #Insert auth-token here
}

# Send GET request
conn.request("GET", parsed_url.path, headers=headers)

# Read response
response = conn.getresponse()
print("Status:", response.status)
print("Response body:", response.read().decode())

# Close connection
conn.close()
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

# Parse the URL
url = URI.parse("https://api.payright.my/api/v1/merchant/balance")

# Create HTTP request
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["auth-token"] = "eyJhbGciO...XZI3CLi_a0BeUOJMPUK00" #Insert auth-token here

# Execute request
response = http.request(request)

# Output result
puts "Status: #{response.code}"
puts "Response body: #{response.body}"
```

{% endtab %}
{% endtabs %}

## Authentication

`string` `header` <mark style="color:red;">`required`</mark>

To authenticate requests, include an Authorization header with the value

<table><thead><tr><th width="114.81640625">Key</th><th>Value</th></tr></thead><tbody><tr><td>auth-token</td><td>&#x3C;Your Payright auth token></td></tr></tbody></table>

{% hint style="info" %}
You can retrieve your token by visiting your [Payright dashboard](https://portal.payright.my/) and clicking `Accounts > API Keys > View API Keys (magnify icon) > Auth Token`
{% endhint %}

## Response

`application/json`

{% tabs %}
{% tab title="Success Example" %}

```json
{
    "status": "ok",
    "code": 200,
    "data": {
        "collection_balance": 1031.0,
        "payout_balance": 97419.1,
        "total_transaction_today": 1020.0
    },
    "uuid": "408ed601-0cf9-4835-9bef-f734410741dc",
    "message": null,
    "error": null
}
```

{% endtab %}

{% tab title="Error Example" %}

```json
{
    "status": "fail",
    "code": 403,
    "data": {
        "host": "api.payright-sandbox.my"
    },
    "uuid": null,
    "message": "INVALID_TOKEN",
    "error": null
}
```

{% endtab %}
{% endtabs %}

### Response Attributes

<details>

<summary>status  <sup><sub><code>string</code></sub></sup> </summary>

Response status indicator (e.g., "ok" or "fail").

</details>

<details>

<summary>code  <sup><sub><code>number</code></sub></sup></summary>

HTTP-like status code representing result (200 = success).

</details>

<details>

<summary>data  <sup><sub><code>object | null</code></sub></sup></summary>

<table><thead><tr><th width="208.50390625">Field</th><th width="88.3359375">Type</th><th>Description</th></tr></thead><tbody><tr><td>collection_balance</td><td>number</td><td>Current available amount in the collection pool.</td></tr><tr><td>payout_balance</td><td>number</td><td>Current available amount in the payout pool.</td></tr><tr><td>total_transaction_today</td><td>number</td><td>Total transaction amount collected for the current day.</td></tr></tbody></table>

</details>

<details>

<summary>uuid  <sup><sub><code>string | null</code></sub></sup> </summary>

Unique request identifier useful for debugging or tracing logs.

</details>

<details>

<summary>message  <sup><sub><code>string | null</code></sub></sup> </summary>

Optional human-readable message (e.g., for error or info).

</details>

<details>

<summary>error  <sup><sub><code>string | null</code></sub></sup> </summary>

Optional error description if something went wrong.

</details>
