e-Wallet (PHP / Node)

Charge Waafi, eDahab, or Premier Wallet with curl, PHP, and Node.

📘

Testing on staging? Use the .net hosts from Sandbox. Examples below use live hosts.

1. API keys

Create keys, enable 2FA, export SIFALO_API_USER and SIFALO_API_KEY.

2. Debit

cURL

curl -X POST "https://api.sifalopay.com/gateway/" \
  -u "$SIFALO_API_USER:$SIFALO_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 120 \
  -d '{
    "account": "25262XXXXXXX",
    "gateway": "edahab",
    "amount": "100",
    "currency": "USD",
    "order_id": "DEMO-001"
  }'

PHP

<?php
$ch = curl_init('https://api.sifalopay.com/gateway/');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
    CURLOPT_USERPWD        => getenv('SIFALO_API_USER') . ':' . getenv('SIFALO_API_KEY'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'account'  => '25262XXXXXXX',
        'gateway'  => 'edahab',
        'amount'   => '100',
        'currency' => 'USD',
        'order_id' => 'DEMO-001',
    ]),
    CURLOPT_TIMEOUT        => 120,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);

Node

const auth = Buffer.from(
  `${process.env.SIFALO_API_USER}:${process.env.SIFALO_API_KEY}`
).toString('base64');

const result = await fetch('https://api.sifalopay.com/gateway/', {
  method: 'POST',
  headers: {
    Authorization: `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    account: '25262XXXXXXX',
    gateway: 'edahab',
    amount: '100',
    currency: 'USD',
    order_id: 'DEMO-001',
  }),
  signal: AbortSignal.timeout(120_000),
}).then((r) => r.json());

Placeholders, not sandbox numbers. Test wallets: Sandbox. eDahab: 62… or 25262…. Waafi: 61… / 63… or 25261… / 25263… ("gateway": "waafi", including EVC, ZAAD, SAHAL).

3. Handle the result

codeAction
601Save sid, mark the order paid
603Ask them to approve, then poll verify. Don’t charge again. Stop on 601 or 600/604.
604Insufficient balance — ask them to top up
600Show response

Timeout? Verify by order_id before retrying. Full reference: e-Wallet API.


Did this page help you?