Notch Pay Software Development Kit for Javascript
npm install notchpay.js
sh
npm install notchpay.js
`
3. Initialization
`javascript
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.
4. Usage
1. Collections : Paypal, Mobile Money
This section describes how you can collect payments in the SDK. Find out more about the payment method.
- Initialize Payment
`javascript
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);
`
- Verify and fetch Payment
`javascript
const paymentDetails = await notchpay.payments.verifyAndFetchPayment(paymentInitiated.transaction.reference);
`
- Complete Payment
`javascript
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.
`javascript
const paymentList = await notchpay.payments.listPayments({perpage: 10, page: 2});
`
- Cancel Payment : Cancel a payment.
`javascript
const paymentCancelled = await notchpay.payments.cancelPayment(response.transaction.reference);
// console.log(paymentCancelled);
`
5. Support
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.
6. Debugging Errors
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]().