kobara-js
v1.0.1
Published
SDK JavaScript/TypeScript officiel pour l'API Kobara
Maintainers
Readme
Kobara JavaScript / TypeScript SDK
Le SDK officiel pour interagir avec l'API Kobara depuis vos applications Node.js ou frontend.
Installation
npm install kobara-jsConfiguration
Initialisez le client avec votre clé API secrète :
import { KobaraClient } from 'kobara-js';
const kobara = new KobaraClient({
apiKey: 'kobara_sk_votre_cle_secrete_ici'
});Utilisation
Créer un paiement MonCash
const payment = await kobara.payments.create({
amount: 1500,
currency: 'HTG',
description: 'Achat sur ma boutique',
customer: {
name: 'Jean Dupont',
email: '[email protected]'
},
successUrl: 'https://maboutique.com/success',
errorUrl: 'https://maboutique.com/error'
});
console.log(payment.payment_url); // URL pour rediriger le client vers MonCashCréer un lien de paiement
const paymentLink = await kobara.paymentLinks.create({
title: 'Paiement pour service X',
amount: 5000,
currency: 'HTG'
});
console.log(paymentLink.url); // Le lien de paiement généréLister les paiements
const payments = await kobara.payments.list({ limit: 10 });
console.log(payments.data);Build depuis les sources
npm run build