الشحن
Docsالشحن

الشحن (Top-up)

أضف GB إلى حزمة وكيل نشطة باستخدام رصيد محفظتك، وراجع عمليات الشحن السابقة للحزمة.

POST /packages/{id}/top-up

يخصم من رصيد المحفظة ويضيف حركة المرور المطلوبة بـ GB صحيحة إلى الحزمة. التسعير وفق نفس شرائح الحجم في الشراء الأصلي. عند النجاح يزداد حدّ الحزمة فورًا ويُزوَّد الترافيك لدى المزوّد الخلفي في نفس الطلب.

الدفع من المحفظة فقط

تتطلب هذه النقطة تغطية التكلفة بالكامل من رصيد المحفظة. إذا كان غير كافٍ يُعاد 402 دون أي أثر. لشراء حزمة جديدة أو شحن المحفظة بالعملات الرقمية / Stripe استخدم سداد الويب. 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}")