@sen-pay/node
v0.1.0
Published
SenPay Node.js client — unified Senegalese payment SDK
Downloads
92
Maintainers
Readme
@sen-pay/node
Client Node.js pour SenPay — SDK unifié pour les paiements sénégalais.
C'est le package principal à installer. Il inclut automatiquement @sen-pay/core et le provider PayDunya.
Installation
npm install @sen-pay/node
# ou
pnpm add @sen-pay/nodeUsage
import { SenPay } from "@sen-pay/node";
const client = new SenPay({
provider: "paydunya",
mode: "test",
});
// Créer un paiement
const payment = await client.createPayment({
amount: 5000,
currency: "XOF",
methods: ["wave", "orange-money"],
customer: {
name: "Moussa Diop",
phone: "+221771234567",
},
returnUrl: "https://myapp.com/return",
cancelUrl: "https://myapp.com/cancel",
callbackUrl: "https://myapp.com/webhook",
});
console.log(payment.checkoutUrl);
// Vérifier le statut
const status = await client.getPaymentStatus(payment.paymentId);Configuration
Les clés API sont lues automatiquement depuis les variables d'environnement. Vous pouvez aussi les passer explicitement :
const client = new SenPay({
provider: "paydunya",
mode: "test",
credentials: {
masterKey: "...",
privateKey: "...",
publicKey: "...",
token: "...",
},
});API
| Méthode | Description |
|---|---|
| createPayment(request) | Créer un paiement |
| getPaymentStatus(paymentId) | Vérifier le statut |
| verifyWebhook(payload, signature) | Vérifier un webhook |
| refundPayment(paymentId, amount?) | Rembourser (si supporté) |
| createPayout(request) | Déboursement (si supporté) |
| getCapabilities() | Lister les capacités du provider |
| getProviderName() | Nom du provider actuel |
