Welcome to the SarfiPay Developer Portal. SarfiPay represents the premium financial operating layer designed explicitly for scale, developer speed, and bulletproof security in the Algerian digital market.
Our REST APIs allow you to interact with double-entry ledgers, manage multi-currency user wallets (primary DZD), process secure e-commerce gateway transactions, execute automated payouts, and receive immediate event alerts through custom webhook channels.
API Environments:
- Sandbox Base URL: https://api.sarfipay.com/v1 (Set sandbox headers or test keys)
- Production Base URL: https://api.sarfipay.com/v1
Create a Merchant Account
Before you can write active API code, you need a verified Merchant profile. The setup takes less than two minutes:
Verify your business email address using the secure code sent to your inbox.
Enable Multi-Factor Authentication (MFA) via Google Authenticator in your profile settings for high-value operations.
Once logged in, you will be in Sandbox mode automatically, letting you play and simulate integration features with zero credit risks.
Applications
SarfiPay structures business operations via the concept of Applications. An Application represents a distinct payment environment—for instance, a specific mobile app, an e-commerce website, or an in-store physical POS terminal.
Within your dashboard, you can provision separate applications, allowing you to:
Isolate transaction reporting and logs for different stores.
Create unique API credentials for each interface.
Configure dedicated webhook endpoints depending on checkout locations.
Test and Live Modes
The SarfiPay portal has a strict separation between Test (Sandbox) and Live environments. This structure guarantees that code changes and simulations never impact real money or live compliance rails.
Safety First: Data is completely partitioned. A user profile, ledger balance, or API key created in Test mode does not exist and is entirely invalid in Live mode.
Feature
Test (Sandbox) Mode
Live Mode
Base URL
https://api.sarfipay.com/v1/...
https://api.sarfipay.com/v1/...
Key Prefixes
sk_test_... / pk_test_...
sk_live_... / pk_live_...
Ledger Balances
Simulated, infinite refill
Real Algerian DZD funds
CCP Recharge
Simulated cards & vouchers
Real Algérie Poste vouchers
API Keys
Your API requests are authorized using secret key pairs. Every application receives two key pairs:
Public Key (pk_...): Suitable for client-side JavaScript or mobile clients. It only grants authorization to initiate checkout links.
Secret Key (sk_...): Intended solely for secure backend servers. It grants access to execute transfers, sign payouts, and manage wallets. Never expose this key in frontend code!
To authenticate requests, pass your secret key in the request headers:
curl -X GET https://api.sarfipay.com/v1/auth/profile \
-H "Authorization: Bearer sk_test_51MzZ7xSrfyP"
To comply with the Bank of Algeria regulations and anti-money laundering policies, all merchants must undergo identity verification. Our automated KYC (Know Your Customer) framework splits limits into tiers:
Tier Level
Requirements
Single Transaction Limit
Monthly Volume Limit
Tier 1 (Instant)
Email, verified Phone number, and full name.
10,000 DZD
50,000 DZD
Tier 2 (Basic)
National Identity Card (NID/Biometric passport) + Selfie verification.
100,000 DZD
500,000 DZD
Tier 3 (Enterprise)
Commercial Registry (Registre du Commerce), Tax ID (NIF), and bank rib statement.
Unlimited
Unlimited
Webhooks System
Webhooks are absolute requirements for premium application scaling. Instead of continuously polling our APIs to check if a user finished a transaction, SarfiPay sends an HTTP POST event payload directly to your server as soon as the state transitions.
Supported Webhook Events
Event Name
Trigger Point
payment.succeeded
A customer successfully completes a checkout link payment. Balance is debited in customer's wallet and credited to merchant's.
payment.failed
An attempted charge is declined due to lack of funds, system risk block, or timeouts.
recharge.completed
A customer's wallet recharge via CCP or CIB bank card clears successfully.
dispute.created
A customer files a transaction challenge, immediately moving the equivalent amount to a frozen escrow account.
System Fees & Commissions
SarfiPay offers a highly transparent, competitive pricing matrix tailored to empower local growth without hidden costs:
Wallet-to-Wallet (P2P) transfers: Always 100% Free. No fees for peer transactions.
E-commerce Payment Checkout: 1.5% commission per completed invoice.
Bank Settlement Payouts: Flat 50 DZD transfer fee to local bank RIB accounts.
Start The Integration
SarfiPay's integration engine is designed for flexibility. Whether you want to configure a fast checkout redirect for your shop, or build a complex, deep in-app native wallet transaction ledger, we support your architectural roadmap.
Our team provides official software libraries in various backend technologies, enabling fast integrations with robust transaction validation.
Before You Start
Please complete this checklist before writing checkout scripts:
Retrieve your sandbox secret API key (sk_test_...) from the applications settings page.
Ensure your development server supports HTTPS (even with localhost self-signed certificates or services like ngrok) to enable testing webhook deliveries locally.
Set up your database migrations to store SarfiPay transaction reference IDs securely.
The Quick Guide (Checkout Redirect)
If you want to accept payments quickly, use the simple redirect flow. Your backend initiates a payment request, receiving a secure checkout URL to redirect the customer to. Once paid, the customer returns to your success page.
For premium platforms, you can construct deep e-wallet checkout flows with atomic double-entry verification. This allows your app to process wallet transfers directly, verify credit limits, and check transaction ledger signatures for total immutability.
Double-Entry Wallet Transfer Execution
Use this code on your secure server to deduct funds from a customer's wallet and credit a merchant's wallet atomically, incorporating custom idempotency keys to prevent duplicate transactions:
Security is paramount. When your endpoint receives a POST request from our webhook system, you **MUST** verify that the payload is authentic and was sent by SarfiPay. Every application has a unique **Webhook Signing Secret** (visible in your dashboard settings).
SarfiPay includes an X-SarfiPay-Signature header in every webhook POST request. This signature is generated by hashing the raw body JSON with your Webhook Signing Secret using the **HMAC SHA-256** algorithm.