Portal Revandè

RESELLER API

Portal Revandè

Yon sèl espas pou demann aksè, idantifyan API, pwodui, dokimantasyon, kòmand ak sipò.

Byenvini

Tout sa ou bezwen nan yon sèl paj

Ou ka li dokimantasyon an, men ou dwe konekte pou voye yon demann aksè.
1

Jwenn aksè

Voye yon sèl demann ak enfòmasyon sou sit ou ak fason ou pral itilize API a.

2

Konekte sit ou

Sèvi ak API Key + Secret nan backend sit ou. Pa mete Secret la nan JavaScript piblik.

3

Pase kòmand

Li katalòg la, verifye Player ID lè sa nesesè, epi kreye lòd ak yon external_order_id inik.

Aksè

Demann pou vin revandè

Konekte anvan

Nou bezwen lye demann lan ak kont ou.

Konekte
Entegrasyon

Dokimantasyon pou konekte sit ou

Règ sekirite: API Secret la dwe rete sou sèvè sit ou. Pa janm mete li nan JavaScript, aplikasyon frontend, oswa yon paj piblik.
1

Katalòg

GET /catalog

Pran tout pwodwi ki aktive, pri revandè, currency ak chan kliyan pwodwi a bezwen.

2

Balans

GET /balance

Verifye konbyen lajan ki disponib anvan ou pase lòd.

3

Verifye jwè

POST /catalog/{id}/verify-player

Pou pwodwi jwèt ki mande Player ID.

4

Kreye lòd

POST /order

Voye product_id/SKU, external_order_id inik ak done jwèt la.

5

Estati lòd

GET /order/{id}

Li lòd la ak external_order_id oswa ID entèn API a.

Headers obligatwa

Headers
X-API-Key: YOUR_API_KEY
X-API-Secret: YOUR_API_SECRET
Content-Type: application/json

1. Egzanp repons katalòg

GET https://boutik-pam.com/wp-json/reseller/v1/catalog
{
    "success": true,
    "catalog": [
        {
            "product_id": 123,
            "sku": "RSA-123",
            "name": "Free Fire 100 Diamonds",
            "price": 1.5,
            "currency": "HTG",
            "requires_player_id": true,
            "requires_server_id": false,
            "customer_fields": [
                {
                    "key": "player_id",
                    "label": "Player ID",
                    "required": true,
                    "type": "text"
                }
            ]
        }
    ]
}

customer_fields, requires_player_id ak requires_server_id se sous verite pou konnen ki chan pou montre sou sit ou.

2. Verifye Player ID

POST /catalog/123/verify-player
{
    "player_id": "123456789",
    "server_id": "",
    "charname": ""
}

3. Kreye yon lòd

POST /order
{
    "external_order_id": "KOMAND-10001",
    "product_id": 123,
    "quantity": 1,
    "player_id": "123456789",
    "server_id": "",
    "charname": "",
    "webhook_url": "https://sit-kliyan.com/api/reseller-webhook"
}
external_order_id obligatwa: bay chak lòd sou sit ou yon ID inik. Si menm demann lan repete ak menm ID a, sistèm nan pap debite kliyan an 2 fwa.
Repons 201
{
    "success": true,
    "order_id": 42,
    "wc_order_id": 9801,
    "external_order_id": "KOMAND-10001",
    "product_id": 123,
    "sku": "RSA-123",
    "quantity": 1,
    "status": "processing",
    "payment_status": "charged",
    "total_price": 1.5,
    "currency": "HTG",
    "new_balance": 48.5,
    "refunded": false,
    "refund_status": "none"
}

4. Modèl WordPress/PHP pou plugin konektè ou

Kòd sa a se yon baz pou backend WordPress ou. Mete Key/Secret nan paramèt prive plugin ou, pa nan kòd frontend.

class-api-client.php
<?php
class Mon_Reseller_API_Client {
    private $base   = 'https://boutik-pam.com/wp-json/reseller/v1';
    private $key    = 'YOUR_API_KEY';
    private $secret = 'YOUR_API_SECRET';

    private function request($method, $path, $body = null) {
        $args = [
            'method'  => $method,
            'timeout' => 30,
            'headers' => [
                'X-API-Key'    => $this->key,
                'X-API-Secret' => $this->secret,
                'Content-Type' => 'application/json',
            ],
        ];
        if ($body !== null) $args['body'] = wp_json_encode($body);

        $response = wp_remote_request($this->base . $path, $args);
        if (is_wp_error($response)) return $response;

        $status = wp_remote_retrieve_response_code($response);
        $data   = json_decode(wp_remote_retrieve_body($response), true);
        return ['http_status' => $status, 'data' => $data];
    }

    public function catalog() {
        return $this->request('GET', '/catalog');
    }

    public function balance() {
        return $this->request('GET', '/balance');
    }

    public function verify_player($product_id, $player_id, $server_id = '') {
        return $this->request('POST', '/catalog/' . absint($product_id) . '/verify-player', [
            'player_id' => $player_id,
            'server_id' => $server_id,
        ]);
    }

    public function create_order($external_id, $product_id, $player_id = '', $server_id = '') {
        return $this->request('POST', '/order', [
            'external_order_id' => $external_id,
            'product_id'        => absint($product_id),
            'quantity'          => 1,
            'player_id'         => $player_id,
            'server_id'         => $server_id,
        ]);
    }

    public function order_status($external_id) {
        return $this->request('GET', '/order/' . rawurlencode($external_id));
    }
}

Webhook

Si ou mete yon URL webhook sou kont ou oswa nan lòd la, API a voye yon POST lè estati a chanje. Verifye siyati a ak Kle verifikasyon webhook (V2) ki nan paj API mwen an (header X-Reseller-Signature-V2). Ansyen header X-Reseller-Signature rete pou kompatibilite, men li itilize API Secret ou: migre sou V2 epi pa mete API Secret la nan sistèm webhook ou. Si ou rate yon webhook, rele GET /order/{id} pou estati aktyèl la.

Headers webhook
X-Reseller-Timestamp: 1720000000
X-Reseller-Signature: sha256=...
X-Reseller-Signature-V2: sha256=...
Content-Type: application/json
Repons

HTTP, estati ak erè ou dwe jere

HTTPSiyifikasyonSa plugin kliyan an dwe fè
200Demann lan reyisi.Li JSON la epi mete done lokal yo ajou.
201Lòd la kreye.Sove order_id, external_order_id ak status.
202Lòd la deja ap kreye.Tann epi rele GET /order/{id}.
400Done manke oswa pa valid.Montre mesaj erè API a; pa repete menm demann lan san koreksyon.
401API Key/Secret pa bon.Verifye credentials yo.
402Balans ensifizan.Mande kliyan an rechaje kont revandè li. Apre sa, retry ak MENM external_order_id: lòd la re-ouvri si pa t gen debit.
403Kont pa apwouve oswa sispann.Bloke nouvo lòd epi kontakte founisè a.
404Pwodwi/lòd pa jwenn.Resenkronize katalòg la oswa verifye ID lòd la.
409Konfli idempotence.Pa reutilize menm external_order_id pou yon lòt lòd. rsa_previous_attempt_failed vle di lòd la te debite oswa ranbouse deja: kreye yon nouvo external_order_id.
422Pwodwi/Player ID pa valab pou demann lan.Montre mesaj API a epi mande kliyan an korije done yo.
429Twòp demann.Fè retry ak yon ti reta; pa spam API a. Pou rsa_daily_quota, tann jou swivan an.
5xxPwoblèm tanporè sou sèvis la.Log erè a, tann, epi retry ak menm external_order_id. Si repons lan di pa gen debit, lòd la re-ouvri. Si ou pa sèten, verifye ak GET /order/{external_order_id}.

Fòma erè API

Egzanp erè
{
    "code": "rsa_insufficient_balance",
    "message": "Balans lan pa sifi. K\u00f2mand lan bezwen 5.00 USD, ou gen 3.20 USD; li manke 1.80 USD.",
    "data": {
        "status": 402,
        "reason": "insufficient_balance",
        "required_balance": 5,
        "available_balance": 3.2,
        "missing_amount": 1.8,
        "currency": "USD"
    }
}

Sèvi ak data.status pou desizyon teknik la, epi montre message bay kliyan an lè li itil.

Estati lòd

creatingLòd la ap rezève.
pendingPeman/debit fini, livrezon pral kòmanse.
processingSistèm livrezon an ap trete.
completedLivrezon fini.
failed / cancelledLivrezon echwe oswa anile.
refundedLajan retounen selon reconciliation la.
Asistans

Bezwen èd?

?

Sipò pou entegrasyon API

Si yon endpoint, Player ID, webhook oswa kòmand pa mache jan ou espere a, voye detay teknik yo bay ekip la.

External Order IDHTTP statusKòd erè API aDat/lè pwoblèm nan
Ekri sipò

Bon retou!

Konekte pou kontinye

Kreye kont ou

Gratis epi rapid

Lè ou kreye kont, ou aksepte tèm itilizasyon nou yo.

Reyinisyalize modpas

N ap voye yon kòd 6 chif nan imel ou.

Antre kòd ou a

Verifye imel ou epi antre kòd 6 chif la.

Pa jwenn kòd?

Nouvo modpas

Chwazi yon modpas solid pou kont ou.

✕
Boutik Pam

GRATUIT
VOIR