PSLWallet API v1
Integrate USD payments into your platform. Simple, secure, fast.
Version 1.0 Currency: USD REST / JSON OTP Email
Base URL
https://pslwallet.com/pslwallet/api/v1

Authentication

All requests (except /health) require your API key in the HTTP header:

HTTP Header
X-API-Key: votre_api_key_ici

Or via Bearer token:

HTTP Header
Authorization: Bearer votre_api_key_ici
⚠️ Never expose your API key in client-side JavaScript frontend code. Always make calls from your backend server.

TEST / LIVE Mode

Two modes available to develop and test safely.

ModeHow to enableBehavior
LIVE5364b6aaec51f74c...Real USD debit on the customer's balance
TESTtest_5364b6aaec51f74c...Simulation — no real debit
💡 In TEST mode, references start with PSL-TEST- and transactions are recorded with mode=test.
Add the prefix test_ before your API key to enable TEST mode.

Payment Flow

① Your site
POST /initiate
② order_id + payment_url
③ Redirect
④ Customer pays
⑤ Webhook
Your site calls /payment/initiate → receives order_id + payment_url

Your site saves order_id + reference to DB, then redirects to payment_url

The customer logs into PSLWallet, receives an OTP by email and confirms the payment

PSLWallet sends the webhook to your webhook_url with order_id + tx_id

Your site receives the webhook → identifies the order by order_id → grants access

Endpoints

GET /health Check API status — no authentication required
curl
curl https://pslwallet.com/pslwallet/api/v1/health
Response 200
{ "success": true, "status": "ok", "api": "PSLWallet v1", "mode": "live", "db": "connected" }
POST /payment/initiate Create a payment request

Body JSON Parameters

FieldTypeStatusDescription
amountfloatrequiredAmount in USD — e.g. 25.00
descriptionstringrequiredPayment description
customer_emailstringrequiredPSLWallet customer email
order_idstringoptionalYour order reference — returned in the webhook. If absent, PSLWallet generates automatically.
redirect_urlstringoptionalReturn URL after payment
webhook_urlstringoptionalOverrides the webhook from your partner account
metadataobjectoptionalFree data returned in the webhook — product_id, user_id, etc.
expires_inintoptionalExpiration in minutes — default: 30
curl
curl -X POST https://pslwallet.com/pslwallet/api/v1/payment/initiate \ -H "X-API-Key: votre_api_key" \ -H "Content-Type: application/json" \ -d '{ "amount": 25.00, "description": "Commande #1042", "customer_email": "client@email.com", "order_id": "CMD-1042", "redirect_url": "https://monsite.com/confirm", "metadata": { "product_id": "42", "user_id": "789" } }'
Response 201
{ "success": true, "order_id": "CMD-1042", "reference": "PSL-71F9B1C08DA0EA84", "payment_url": "https://pslwallet.com/pslwallet/pay/PSL-71F9B1C08DA0EA84", "amount": 25.00, "currency": "USD", "status": "pending", "mode": "live", "expires_at": "2026-03-16T21:30:00+00:00", "customer": { "name": "Jean Dupont", "can_pay": true, "balance": 100.00 } }
⚠️ Important: Save order_id and reference to the database immediately after receiving the response, before redirecting the customer.
GET /payment/status Check status — by order_id or reference

Two ways to query — by order_id (your reference) or by PSLWallet reference:

By order_id — recommended
curl "https://pslwallet.com/pslwallet/api/v1/payment/status?order_id=CMD-1042" \ -H "X-API-Key: votre_api_key"
By PSLWallet reference
curl "https://pslwallet.com/pslwallet/api/v1/payment/status?ref=PSL-71F9B1C08DA0EA84" \ -H "X-API-Key: votre_api_key"

Possible statuses

pending completed failed expired refunded
GET /payment/verify/{ref} Verify by reference in URL
curl
curl https://pslwallet.com/pslwallet/api/v1/payment/verify/PSL-71F9B1C08DA0EA84 \ -H "X-API-Key: votre_api_key"
POST /payment/refund Refund a completed payment
FieldTypeStatusDescription
order_idstringor referenceYour order_id passed to /initiate
referencestringor order_idPSLWallet reference — PSL-...
reasonstringoptionalReason for refund
curl
curl -X POST https://pslwallet.com/pslwallet/api/v1/payment/refund \ -H "X-API-Key: votre_api_key" \ -H "Content-Type: application/json" \ -d '{ "order_id": "CMD-1042", "reason": "Client annulé" }'
GET /balance?email=... Check your own USD balance
⚠️ Restricted access: You can only view the balance of the account linked to your API key. Any attempt to check another email returns 403 FORBIDDEN.
curl
curl "https://pslwallet.com/pslwallet/api/v1/balance?email=votre@email.com" \ -H "X-API-Key: votre_api_key"
Response 200
{ "success": true, "has_account": true, "customer_name": "Jean Dupont", "balance": 100.00, "pending_holds": 0.00, "available": 100.00, "currency": "USD", "can_pay": true }
Response 403
{ "success": false, "error": { "code": "FORBIDDEN", "message": "Vous ne pouvez consulter que le solde de votre propre compte." } }

Error Codes

All errors return this JSON format with the appropriate HTTP code.

HTTPCodeCause and solution
401UNAUTHORIZEDHeader X-API-Key missing or invalid key
403FORBIDDENRequested email differs from account linked to your API key — /balance only
404NOT_FOUNDorder_id or reference not found for this partner account
409CANNOT_REFUNDIncompatible status — only completed payments can be refunded
409DUPLICATE_ORDER_IDThis order_id is already used — use a unique ID per payment
422MISSING_FIELDSRequired JSON fields missing — check amount, description, customer_email
422INVALID_AMOUNTAmount ≤ 0 or greater than 100,000 USD
422INVALID_EMAILInvalid email format
500DB_ERRORPSLWallet server error — retry after 30 seconds
JSON error format
{ "success": false, "error": { "code": "INVALID_AMOUNT", "message": "Montant doit être > 0" } }

Webhook

PSLWallet sends a POST JSON to your webhook_url (configured in your partner account) after each payment event. Your endpoint must respond HTTP 200.

Payload — payment.completed

JSON received on your server
{ "event": "payment.completed", "order_id": "CMD-1042", "reference": "PSL-71F9B1C08DA0EA84", "amount": 25.00, "currency": "USD", "customer": "client@email.com", "customer_name": "Jean Dupont", "description": "Commande #1042", "partner": "Solisyon", "tx_id": 471, "metadata": { "product_id": "42", "user_id": "789" }, "mode": "live", "paid_at": "2026-03-16T21:00:00+00:00" }
⚠️ Always verify that mode === "live" before validating an order. In test mode, log the event without modifying your database.

Receiving the webhook — PHP

PHP — webhook/pslwallet.php
$payload = json_decode(file_get_contents('php://input'), true); if (!$payload) { http_response_code(400); exit; } if ($payload['event'] === 'payment.completed' && $payload['mode'] === 'live') { $orderId = $payload['order_id']; $txId = $payload['tx_id']; $order = get_order($orderId); if ($order && $order['status'] === 'pending') { mark_order_paid($orderId, $txId); send_confirmation_email($payload['customer'], $orderId); unlock_product_access($orderId); } } http_response_code(200); echo 'OK';

Full PHP Integration

Helper file pslgateway.php

PHP — pslgateway.php
define('PSL_KEY', getenv('PSL_API_KEY')); define('PSL_URL', 'https://pslwallet.com/pslwallet/api/v1'); function psl($method, $path, $body = []) { $ch = curl_init(PSL_URL . $path); curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => ['X-API-Key: '.PSL_KEY, 'Content-Type: application/json'], CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15, ...($body ? [CURLOPT_POSTFIELDS => json_encode($body)] : []), ]); $r = json_decode(curl_exec($ch), true); curl_close($ch); return $r; }

Checkout page — initiate payment

PHP — checkout.php
require_once 'pslgateway.php'; $r = psl('POST', '/payment/initiate', [ 'amount' => 25.00, 'description' => 'Commande #1042', 'customer_email' => 'client@email.com', 'order_id' => 'CMD-1042', 'redirect_url' => 'https://monsite.com/confirm', 'metadata' => ['product_id' => '42'], ]); if ($r['success']) { db_query("UPDATE orders SET psl_order_id=?, psl_ref=? WHERE id=?", [$r['order_id'], $r['reference'], '1042']); header('Location: ' . $r['payment_url']); exit; } else { $error = $r['error']['message']; }

Node.js Integration

JavaScript — pslgateway.js + Express
const PSL = { key: process.env.PSL_API_KEY, url: 'https://pslwallet.com/pslwallet/api/v1', async req(method, path, body) { const r = await fetch(this.url + path, { method, headers: { 'X-API-Key': this.key, 'Content-Type': 'application/json' }, ...(body ? { body: JSON.stringify(body) } : {}), }); const data = await r.json(); if (!data.success) throw new Error(data.error?.message); return data; }, initiate(amount, desc, email, orderId, meta = {}) { return this.req('POST', '/payment/initiate', { amount, description: desc, customer_email: email, order_id: orderId, redirect_url: `${process.env.APP_URL}/confirm`, metadata: meta, }); }, status(orderId) { return this.req('GET', `/payment/status?order_id=${orderId}`); }, refund(orderId, reason) { return this.req('POST', '/payment/refund', { order_id: orderId, reason }); }, }; // Checkout app.post('/checkout/pslwallet', async (req, res) => { const { orderId, amount, email } = req.body; const payment = await PSL.initiate(amount, `Commande #${orderId}`, email, `CMD-${orderId}`); await Order.update(orderId, { pslOrderId: payment.order_id, pslRef: payment.reference }); res.json({ payment_url: payment.payment_url }); }); // Webhook app.post('/webhook/pslwallet', (req, res) => { const { event, order_id, tx_id, mode } = req.body; if (event === 'payment.completed' && mode === 'live') Order.markPaid(order_id, tx_id); res.json({ ok: true }); });

WooCommerce

📁 📁 Create the folder wp-content/plugins/psl-gateway/ and place this file in it. Then activate in Plugins → Payment Methods.
PHP — psl-gateway.php
/* * Plugin Name: PSL Gateway * Description: Paiements USD via PSL Wallet * Version: 1.0 */ add_filter('woocommerce_payment_gateways', fn($g) => [...$g, 'WC_PSL_Gateway']); add_action('plugins_loaded', function() { class WC_PSL_Gateway extends WC_Payment_Gateway { public function __construct() { $this->id = 'psl_gateway'; $this->method_title = 'PSL Wallet'; $this->method_description = 'Paiement USD sécurisé via PSL Wallet'; $this->has_fields = false; $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option('title'); $this->api_key = $this->get_option('api_key'); add_action('woocommerce_update_options_payment_gateways_psl_gateway', [$this, 'process_admin_options']); } public function init_form_fields() { $this->form_fields = [ 'title' => ['title'=>'Titre affiché', 'type'=>'text', 'default'=>'PSL Wallet (USD)'], 'api_key' => ['title'=>'Clé API PSLWallet', 'type'=>'password'], ]; } public function process_payment($wc_order_id) { $order = wc_get_order($wc_order_id); $order_id = 'WC-' . $wc_order_id; $ch = curl_init('https://pslwallet.com/pslwallet/api/v1/payment/initiate'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['X-API-Key: '.$this->api_key, 'Content-Type: application/json'], CURLOPT_POSTFIELDS => json_encode([ 'amount' => (float)$order->get_total(), 'description' => 'Commande #'.$wc_order_id.' — '.get_bloginfo('name'), 'customer_email' => $order->get_billing_email(), 'order_id' => $order_id, 'redirect_url' => $this->get_return_url($order), 'webhook_url' => home_url('/wp-json/psl/webhook'), 'metadata' => ['wc_order_id' => $wc_order_id], ]), ]); $r = json_decode(curl_exec($ch), true); curl_close($ch); if ($r['success']) { $order->update_meta_data('_psl_order_id', $r['order_id']); $order->update_meta_data('_psl_reference', $r['reference']); $order->save(); return ['result'=>'success', 'redirect'=>$r['payment_url']]; } wc_add_notice($r['error']['message'] ?? 'Erreur PSL Wallet', 'error'); return ['result'=>'failure']; } } }); // Webhook REST WooCommerce add_action('rest_api_init', function() { register_rest_route('psl', '/webhook', [ 'methods' => 'POST', 'permission_callback' => '__return_true', 'callback' => function($req) { $p = $req->get_json_params(); if (($p['mode'] ?? '') !== 'live') return new WP_REST_Response(['ok'=>true]); if ($p['event'] === 'payment.completed') { $wc_id = $p['metadata']['wc_order_id']; $order = wc_get_order($wc_id); if ($order && $order->get_status() === 'pending') { $order->payment_complete($p['tx_id']); $order->add_order_note('Payé via PSL Wallet · order: '.$p['order_id']); } } return new WP_REST_Response(['ok'=>true], 200); }, ]); });