Top-up
DocsTop-up

チャージ(Top-up)

ウォレット残高を使ってアクティブなプロキシパッケージに GB を追加し、過去のチャージ履歴を確認します。

POST /packages/{id}/top-up

ウォレット残高から請求し、要求されたトラフィックを整数 GB でパッケージに追加します。価格は元の購入と同じボリュームティアを使用。成功時、パッケージのクォータは即時に増加し、トラフィックはアップストリームプロバイダーで同一リクエスト内にプロビジョニングされます。

ウォレットのみで支払い

このエンドポイントはコストをウォレット残高で全額カバーする必要があります。残高不足の場合 402 を返し、副作用なし。新規パッケージ購入や暗号通貨 / Stripe でのウォレットチャージは web チェックアウトを使用してください。 Billing · Buy.

POST/api/v1/packages/{id}/top-up
request.json
{ "quantity_gb": 25 }
response.json
{
  "data": {
    "order_id":            8421,
    "traffic_added_gb":    25,
    "new_quota_gb":        125.0,
    "amount_charged_usd":  42.25,
    "balance_usd":         157.7500
  },
  "meta": { "version": "v1" }
}
402.json
{
  "error": { "code": "payment_required", "message": "Insufficient balance" },
  "meta":  { "version": "v1" }
}

GET /packages/{id}/top-ups

このパッケージの過去のチャージを新しい順で返します。limit と offset でページネーション;デフォルトは 50 と 0。

GET/api/v1/packages/{id}/top-ups?limit=50&offset=0
history.json
{
  "data": {
    "package_id": 12,
    "limit":      50,
    "offset":     0,
    "top_ups": [
      { "order_id": 8421, "traffic_gb": 25.0, "amount_usd": 42.25, "paid_at": "2026-05-29T11:00:00+00:00" },
      { "order_id": 8127, "traffic_gb": 10.0, "amount_usd": 16.90, "paid_at": "2026-05-15T08:32:00+00:00" }
    ]
  },
  "meta": { "version": "v1" }
}

コード例

topup.sh
curl -X POST https://raxyproxy.com/api/v1/packages/12/top-up \
     -H "Authorization: Bearer raxy_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
     -H "Content-Type: application/json" \
     -d '{"quantity_gb": 25}'

# History (paginated)
curl "https://raxyproxy.com/api/v1/packages/12/top-ups?limit=20&offset=0" \
     -H "Authorization: Bearer raxy_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
topup.py
import requests, sys

API_KEY    = 'raxy_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
PACKAGE_ID = 12

# Top up by 10 GB; on insufficient balance the call returns 402
r = requests.post(
    f'https://raxyproxy.com/api/v1/packages/{PACKAGE_ID}/top-up',
    headers={'Authorization': f'Bearer {API_KEY}'},
    json={'quantity_gb': 10},
    timeout=15,
)

if r.status_code == 402:
    sys.exit('Wallet balance too low — top up your wallet via the web app first.')

r.raise_for_status()
data = r.json()['data']
print(f"Now {data['new_quota_gb']} GB quota; balance left $${data['balance_usd']:.2f}")