La bibliothèque Javascript simplifie l'utilisation des API de Notch Pay dans vos applications Javascript. Elle masque la complexité de l'intégration directe, facilitant ainsi des appels rapides et efficaces aux API.
Available functionalities include:
- Payment : Paypal, Mobile Money,
- Node 12 or higher.
- Notch Pay API Keys
To install the package, run the following command in your Node terminal:
npm install notchpay.js
import NotchPay from 'notchpay.js';
const notchpay = NotchPay(
"YOUR_PUBLIC_KEY",
{ debug : true, }
);
For staging (Test environment), use the Sandbox Public Keys and for production, use LIVE Public KEYS. You can obtain your PUBLIC_KEY and PRIVATE_KEY keys from the Notch Pay dashboard: https://business.notchpay.co/developer/api-keys.
This section describes how you can collect payments in the SDK. Find out more about the payment method.
const paymentInitiated = await notchpay.payments.initializePayment({
currency: "XAF",
amount: "5000",
email: "WWWWW",
phone: "XXXXX",
reference: "ref." + (Math.floor(Math.random() * (2000 - 100 + 1)) + 100),
description: "Payment for testing the Notch Pay SDK"
});
// console.log("Payment Initialized Informations: ", paymentInitiated);
const paymentDetails = await notchpay.payments.verifyAndFetchPayment(paymentInitiated.transaction.reference);
const paymentCompleted = await notchpay.payments.completePayment(
paymentInitiated.transaction.reference,
{
channel: 'string',
data: {
phone: 'MTN Mobile or Orange mobile money number to be charged'
}
}
);
- List Payments : This endpoint allows you to retrieve a paginated list of all your payments.
const paymentList = await notchpay.payments.listPayments({perpage: 10, page: 2});
- Cancel Payment : Cancel a payment.
const paymentCancelled = await notchpay.payments.cancelPayment(response.transaction.reference);
// console.log(paymentCancelled);
Pour toute aide supplémentaire concernant l'utilisation de cette bibliothèque, contactez l'équipe technique via email ou sur Telegram. Vous pouvez également nous suivre sur Twitter et nous faire part de vos commentaires.
We understand that you may encounter errors when integrating our library. You can read more about our error messages here.
For error responses authorization 401
and validation 422
, please check your API keys and your request. If you get a server
error, please contact the team for support.
By contributing to this library, you agree that your contributions may be placed under the MIT license. Copyright (c) Notch Pay Sarl.