# Ama-oda

> I-API ye-AfricaProxies: amaphakheji, amanani, ukuthenga ngemali esele nama-oda. Amapharamitha, izimpendulo nekhodi ye-curl, Python ne-Node.js.

- URL: https://africaproxies.com/zu/docs/api/orders/
- Kuvini okugcwele: 2026-10-15
- UmphRhizisheli: AfricaProxies (https://africaproxies.com)

Bhala uhlu lwamaphakheji namanani, uthenge iphakheji ngemali esele (isevisi entsha, idatha eningi noma ukwengeza isikhathi se-port), ufunde ama-oda angaphambili.

**Izindawo zokuxhumana kuleli khasi**

- `GET /v1/catalog/products`: Imikhiqizo, amaphakheji namanani
- `POST /v1/orders`: Thenga iphakheji ngemali esele (isevisi entsha, idatha eningi noma ukwengeza isikhathi se-port)
- `GET /v1/orders`: Bhala uhlu lwama-oda
- `GET /v1/orders/{orderId}`: Thola i-oda

I-URL eyisisekelo `https://africaproxies.com/api/v1`. Ukuqinisekisa ukungena, amaphutha nemikhawulo: bheka [isifinyezo se-API](/zu/docs/api/).

## Imikhiqizo, amaphakheji namanani

`GET /v1/catalog/products`

Yonke imikhiqizo namaphakheji namanani ayo, njengoba kukhokhiswa lapho u-oda.

Okungagqizile: akudingi i-key ye-API.

**Impendulo** `200 OK`

```json
{
  "data": [
    {
      "id": "residential",
      "name": "Residential proxies",
      "description": "Residential IPs across 49 African locations for public price research, local SEO and your application tests. Prepaid traffic, billed per GB.",
      "unit": "GB",
      "plans": [
        {
          "id": "res-10",
          "productId": "residential",
          "name": "Team",
          "quantity": 10,
          "unit": "GB",
          "durationDays": null,
          "price": "5.94",
          "pricePerUnit": "0.59",
          "popular": false,
          "features": [
            "Prepaid traffic never expires",
            "Country and city where available",
            "Project credentials and traffic caps"
          ],
          "available": true,
          "countries": null
        }
      ]
    }
  ]
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/catalog/products"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"

r = requests.get(f"{API}/catalog/products", timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/catalog/products`);
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Thenga iphakheji ngemali esele (isevisi entsha, idatha eningi noma ukwengeza isikhathi se-port)

`POST /v1/orders`

Kuhlala kukhokhwa ngemali esele ekhokhelwe: i-API ibala inani (inani lekhathalogi × `quantity`), imali idonswe ku-akhawunti, isevisi idalwe noma yengezwe isikhathi, i-oda libuye lingu-`completed` ne-`fulfillment` yalo. Imininingwane yokungena ye-proxy itholakala ngokushesha.

- **Idatha entsha yasekhaya**: `{ "planId": "res-10" }`.
- **Idatha entsha ye-4G/5G enamakheli ashintshayo (nge-GB)**: `{ "planId": "mgb-10" }` (ukubhalisa kwedatha okune-`productId: "mobile-gb"`, kunikezwa ku-`fulfillment.residentialSubscriptionId`).
- **Engeza idatha kokubhalisa okukhona**: `{ "planId": "res-10", "options": { "subscriptionId": "res_9x2m4k" } }`: iphakheji kufanele ibe ngeyomkhiqizo wokubhalisa.
- **Ama-port amasha eselula**: `{ "planId": "mob-30d", "quantity": 1, "options": { "country": "AE" } }`, kungafakwa ne-`carrier` (bheka izinkampani zezwe ku-[Ama-port eselula](/zu/docs/api/mobile/)). Amaphakheji ezindawo ahlanganisa amazwe endawo yawo kuphela (ngaphandle kwalokho `422` ku-`options.country`).
- **Engeza isikhathi se-port yeselula**: `{ "planId": "mob-7d", "options": { "portId": "mob_2v8k1q" } }` yengeza isikhathi sephakheji ku-`expiresAt`.

**Imali esele ayanele → `402 insufficient_balance`**, inani elishodayo nokwengeza imali okuphakanyisiwe ku-`error.details` (`missing`, `suggestedTopUp`). Akukho mali edonswayo uma kunoma yiliphi iphutha. Ukuze ukhokhe umehluko, qala ukwengeza imali okunesicelo esifanayo ku-`purchase` (`POST /v1/topups`): iphakheji ithengwa lapho imali eyengeziwe isifakiwe.

Ukungena: isikhonkeyi API ku-header `Authorization: Bearer API_KEY`.

**Izinhinto**

| Igama | Ku- | Uhlobo | Kudingekile | Incazelo |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | Cha | Ukhiye ohlukile (njenge-UUID) wokuphinda uzame i-POST ngokuphepha. Ugcinwa amahora 24. — izinhlamvu ezingadluli ku-128 |

**Umzimba wesicelo**

| Isibaya | Uhlobo | Kudingekile | Incazelo |
| --- | --- | --- | --- |
| `planId` | string | Yebo | — |
| `quantity` | integer | Cha | 1–100, okuzenzakalelayo `1` |
| `options` | object | Cha | — |

*Isibonelo: Ama-proxy asekhaya*

```json
{
  "planId": "res-10"
}
```

*Isibonelo: Ama-port eselula*

```json
{
  "planId": "mob-30d",
  "quantity": 1,
  "options": {
    "country": "AE",
    "carrier": "etisalat",
    "autoRenew": true
  }
}
```

*Isibonelo: Ngeza isikhathi se-port*

```json
{
  "planId": "mob-7d",
  "options": {
    "portId": "mob_2v8k1q"
  }
}
```

*Isibonelo: Idatha yeselula*

```json
{
  "planId": "mgb-10"
}
```

*Isibonelo: I-port yendawo*

```json
{
  "planId": "mob-30d",
  "options": {
    "country": "AE",
    "carrier": "etisalat"
  }
}
```

**Impendulo** `201 Created`

```json
{
  "id": "ord_4f8k2m9q",
  "status": "completed",
  "productId": "residential",
  "planId": "res-10",
  "planName": "Team",
  "quantity": 1,
  "unitPrice": "5.94",
  "subtotal": "5.94",
  "discount": "0.00",
  "total": "5.94",
  "promoCode": null,
  "currency": "USD",
  "topUpId": null,
  "options": {},
  "fulfillment": {
    "residentialSubscriptionId": "res_9x2m4k",
    "mobilePortIds": []
  },
  "createdAt": "2026-10-05T14:03:11Z",
  "paidAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://africaproxies.com/api/v1/orders" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"planId":"res-10"}'
```

*Python*

```python
import os, uuid
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}

r = requests.post(f"{API}/orders", headers=HEADERS, json={"planId": "res-10"}, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
import { randomUUID } from 'node:crypto';

const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Idempotency-Key': randomUUID(), 'Content-Type': 'application/json' },
  body: JSON.stringify({ planId: 'res-10' }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Bhala uhlu lwama-oda

`GET /v1/orders`

Ukungena: isikhonkeyi API ku-header `Authorization: Bearer API_KEY`.

**Izinhinto**

| Igama | Ku- | Uhlobo | Kudingekile | Incazelo |
| --- | --- | --- | --- | --- |
| `page` | query | integer | Cha | ≥ 1, okuzenzakalelayo `1` |
| `perPage` | query | integer | Cha | 1–100, okuzenzakalelayo `20` |
| `status` | query | `completed` · `cancelled` | Cha | Ama-oda adalwa esekhokhelwe (imali idonswe ku-akhawunti). I-`completed` — ikhokhelwe yanikezwa (imininingwane yokungena itholakala ngokushesha). |
| `productId` | query | string | Cha | Isihlonzi somkhiqizo esivela kukhathalogi. Amanani e-AfricaProxies: `residential` (GB), `mobile` (ama-port e-4G/5G abekelwe amakhasimende) ne-`mobile-gb` (idatha ye-4G/5G enamakheli ashintshayo nge-GB). Ama-app kufanele amukele namanani angawazi. |

**Impendulo** `200 OK`

```json
{
  "data": [
    {
      "id": "ord_4f8k2m9q",
      "status": "completed",
      "productId": "residential",
      "planId": "res-10",
      "planName": "Team",
      "quantity": 1,
      "unitPrice": "5.94",
      "subtotal": "5.94",
      "discount": "0.00",
      "total": "5.94",
      "promoCode": null,
      "currency": "USD",
      "topUpId": null,
      "options": {},
      "fulfillment": {
        "residentialSubscriptionId": "res_9x2m4k",
        "mobilePortIds": []
      },
      "createdAt": "2026-10-05T14:03:11Z",
      "paidAt": "2026-10-05T14:03:11Z"
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 1,
    "totalPages": 1
  }
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/orders" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/orders", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Thola i-oda

`GET /v1/orders/{orderId}`

Ukungena: isikhonkeyi API ku-header `Authorization: Bearer API_KEY`.

**Izinhinto**

| Igama | Ku- | Uhlobo | Kudingekile | Incazelo |
| --- | --- | --- | --- | --- |
| `orderId` | path | string | Yebo | — |

**Impendulo** `200 OK`

```json
{
  "id": "ord_4f8k2m9q",
  "status": "completed",
  "productId": "residential",
  "planId": "res-10",
  "planName": "Team",
  "quantity": 1,
  "unitPrice": "5.94",
  "subtotal": "5.94",
  "discount": "0.00",
  "total": "5.94",
  "promoCode": null,
  "currency": "USD",
  "topUpId": null,
  "options": {},
  "fulfillment": {
    "residentialSubscriptionId": "res_9x2m4k",
    "mobilePortIds": []
  },
  "createdAt": "2026-10-05T14:03:11Z",
  "paidAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/orders/ord_4f8k2m9q" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/orders/ord_4f8k2m9q", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders/ord_4f8k2m9q`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

---

AfricaProxies: AfricaProxies ingumhlinzeki wama-proxy e-IP yasekhaya e-Afrika eseningizimu yeSahara; kukhokhwa nge-crypto ngaphandle kokulayisha umazisi.
