mr-satim-pay
v0.1.2
Published
React Native SDK for MR SATIM Pay-As-You-Go (redirect-based SATIM payments via your backend).
Downloads
353
Maintainers
Readme
@mr-digital/mr-satim-pay
React Native SDK for MR Digital – SATIM Pay-As-You-Go.
This SDK provides a redirect-based payment flow for SATIM (Algeria), using your backend as the payment orchestrator.
⚠️ The SDK never communicates with SATIM directly. All sensitive operations (credentials, confirmation, webhooks) are handled by your server.
Features
Redirect-based SATIM payments
Works with React Native (Expo & CLI)
Backend-driven (secure, PCI-friendly)
Optional webhook notification after payment confirmation
Simple, Stripe-like API
Installation npm install mr-satim-pay
or
yarn add mr-satim-pay
Basic Usage import { MRSatimPay } from "mr-satim-pay";
const satim = new MRSatimPay({ apiKey: "sk_test_xxx", baseUrl: "https://api.yourdomain.com", // Provided with your API keys });
await satim.pay({ orderNumber: "ORDER_001", amount: 1500, // Amount in DZD (major unit) returnUrl: "myapp://payment/success", failUrl: "myapp://payment/fail", });
This will:
Register the payment on your backend
Receive a SATIM payment URL
Redirect the user to the SATIM payment page
With Webhook Notification (Recommended)
You can provide a webhookUrl so your backend notifies a third-party service once the payment is confirmed.
await satim.pay({ orderNumber: "ORDER_002", amount: 8500, returnUrl: "https://yourapp.com/payment/success", failUrl: "https://yourapp.com/payment/fail",
webhookUrl: "https://api.partner.com/webhooks/payment-paid", });
How webhooks work
The SDK sends webhookUrl to your backend
The backend stores it with the payment
After SATIM confirmation, the backend sends a POST request to the webhook
The SDK itself never calls the webhook
API Reference new MRSatimPay(config) const satim = new MRSatimPay({ apiKey: string; // Required baseUrl: string; // Required timeoutMs?: number; // Optional (default: 20000) });
satim.pay(params)
Registers a payment and redirects the user to SATIM.
await satim.pay({ orderNumber: string; // Your internal order reference amount: number; // Amount in DZD (minimum 50) returnUrl: string; // Redirect after success failUrl?: string; // Redirect after failure webhookUrl?: string; // Optional webhook (server-side) language?: "FR" | "AR" | "EN"; });
Returns
{ orderId: string; // SATIM mdOrder }
satim.register(params)
Registers a payment without redirecting.
const { orderId, formUrl } = await satim.register({ orderNumber: "ORDER_003", amount: 2000, returnUrl: "https://example.com/success", });
satim.open(formUrl)
Opens the SATIM payment page.
await satim.open(formUrl);
Important Notes
Minimum payment amount: 50 DZD
SATIM credentials are stored only on your backend
This SDK is not a SATIM client, but a secure frontend bridge
Webhooks are triggered after confirmation, not after redirect
Typical Flow Mobile App ↓ mr-satim-pay SDK ↓ Your Backend (/payments/register) ↓ SATIM Payment Page ↓ SATIM Redirect (/return/success) ↓ Your Backend (/payments/confirm) ↓ Webhook (optional)
License
MIT © MR Digital Solutions
