# Balance and buying GB

> Check your GB balance and buy packages by Pix, card or crypto through the API, at the reseller price.
> Page: https://rh7proxys.com/en/docs/revenda-saldo · Index: https://rh7proxys.com/llms.txt

Your GB balance is where your customers' GB comes from. You buy packages at the reseller price, in the panel or through the API.

## Check the balance

```bash
curl https://api.rh7proxys.com/quota/me \
  -H "x-api-key: rh7_your_key"
```

```json
{ "gb_total": 500, "gb_used": 312, "gb_committed": 312, "gb_available": 188, "discount_pct": 30, "updated_at": "2026-11-26T18:00:00Z" }
```

`gb_available` is what you can still move to customers.

## Packages

```bash
curl https://api.rh7proxys.com/pool/packages \
  -H "x-api-key: rh7_your_key"
```

The response lists the packages with your price (`currency: "BRL"`). Use the package `id` when you buy.

## Buy GB

`POST /pool/orders` requires the `billing:write` permission and the `Idempotency-Key` header.

```bash
curl -X POST https://api.rh7proxys.com/pool/orders \
  -H "x-api-key: rh7_your_key" \
  -H "Idempotency-Key: 3d8f1b2a-6c5e-4f0d-9b7a-1e2c3d4f5a6b" \
  -H "Content-Type: application/json" \
  -d '{"package_id": "PACKAGE_ID", "payment_method": "pix"}'
```

| Method | Fee | What comes in the response |
|---|---|---|
| `pix` (default) | No fee | `pix.copy_paste`, `pix.qr_code_base64` and `pix.expires_at` |
| `card` | +3.5% | `card.checkout_url` to pay |
| `crypto` | +3.5% | `crypto.checkout_url` to pay |

Response (201):

```json
{
  "order": { "id": "uuid", "status": "awaiting_payment", "payment_method": "pix", "gb": 100, "amount_brl": 450, "fee_brl": 0, "total_brl": 450 },
  "pix": { "copy_paste": "00020126...", "qr_code_base64": "data:image/png;base64,...", "expires_at": "2026-11-26T19:00:00Z" }
}
```

The values are for illustration only. Your price comes from `/pool/packages`.

About the `Idempotency-Key`:

- 8 to 128 characters, with letters, numbers and `_ - : .`.
- Repeating with the same code, package and payment method returns the same order for 24 hours.
- Changing the package or the payment method creates another order.
- Two identical calls at the same time: the second one gets `409 request_in_progress`. Wait 5 seconds.

Errors: `idempotency_key_required`, `package_id_required`, `invalid_payment_method`, `pix_unavailable` (502), `payment_unavailable` (502). If you get `order_status_unknown`, check `GET /pool/orders` before buying again.

## Check the payment

```bash
curl https://api.rh7proxys.com/pool/orders/ORDER_ID \
  -H "x-api-key: rh7_your_key"
```

This route checks the payment in real time (at most once every 15 seconds per order). The `status` goes from `awaiting_payment` to `paid`, or `expired` if the Pix expires. Once paid, the GB goes into your balance.

Even better: register a [webhook](https://rh7proxys.com/en/docs/revenda-webhooks) for the `pool.recharge.confirmed` event and get the alert without having to poll.

## History

`GET /pool/orders?limit=20&offset=0` lists your GB purchases (`limit` up to 100), from newest to oldest.

The history of purchases made through the old system is still at `GET /gb/purchases`.
