Portal Revandè
Yon sèl espas pou demann aksè, idantifyan API, pwodui, dokimantasyon, kòmand ak sipò.
Tout sa ou bezwen nan yon sèl paj
Jwenn aksè
Voye yon sèl demann ak enfòmasyon sou sit ou ak fason ou pral itilize API a.
Konekte sit ou
Sèvi ak API Key + Secret nan backend sit ou. Pa mete Secret la nan JavaScript piblik.
Pase kòmand
Li katalòg la, verifye Player ID lè sa nesesè, epi kreye lòd ak yon external_order_id inik.
Demann pou vin revandè
Dokimantasyon pou konekte sit ou
Katalòg
GET /catalogPran tout pwodwi ki aktive, pri revandè, currency ak chan kliyan pwodwi a bezwen.
Balans
GET /balanceVerifye konbyen lajan ki disponib anvan ou pase lòd.
Verifye jwè
POST /catalog/{id}/verify-playerPou pwodwi jwèt ki mande Player ID.
Kreye lòd
POST /orderVoye product_id/SKU, external_order_id inik ak done jwèt la.
Estati lòd
GET /order/{id}Li lòd la ak external_order_id oswa ID entèn API a.
Headers obligatwa
X-API-Key: YOUR_API_KEY
X-API-Secret: YOUR_API_SECRET
Content-Type: application/json1. Egzanp repons katalòg
{
"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
{
"player_id": "123456789",
"server_id": "",
"charname": ""
}3. Kreye yon lòd
{
"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"
}{
"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.
<?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.
X-Reseller-Timestamp: 1720000000
X-Reseller-Signature: sha256=...
X-Reseller-Signature-V2: sha256=...
Content-Type: application/jsonHTTP, estati ak erè ou dwe jere
| HTTP | Siyifikasyon | Sa plugin kliyan an dwe fè |
|---|---|---|
| 200 | Demann lan reyisi. | Li JSON la epi mete done lokal yo ajou. |
| 201 | Lòd la kreye. | Sove order_id, external_order_id ak status. |
| 202 | Lòd la deja ap kreye. | Tann epi rele GET /order/{id}. |
| 400 | Done manke oswa pa valid. | Montre mesaj erè API a; pa repete menm demann lan san koreksyon. |
| 401 | API Key/Secret pa bon. | Verifye credentials yo. |
| 402 | Balans 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. |
| 403 | Kont pa apwouve oswa sispann. | Bloke nouvo lòd epi kontakte founisè a. |
| 404 | Pwodwi/lòd pa jwenn. | Resenkronize katalòg la oswa verifye ID lòd la. |
| 409 | Konfli 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. |
| 422 | Pwodwi/Player ID pa valab pou demann lan. | Montre mesaj API a epi mande kliyan an korije done yo. |
| 429 | Twòp demann. | Fè retry ak yon ti reta; pa spam API a. Pou rsa_daily_quota, tann jou swivan an. |
| 5xx | Pwoblè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
{
"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
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.
