PesapalJS
Goal
Make it easy to integrate PesaPal into a website or mobile app AND most importantly allow one to customize the payment user interface.
Core Features
-
paymentListener
:express
middleware that parses PesaPal payment notifications. -
getPaymentStatus(options)
: Get status of a payment.options
should contain either areference
alone or areference
andtransaction
together. -
getPaymentDetails(options
): Get all information about a payment.options
should contain areference
and atransaction
. -
getPaymentURL(order, callbackURI)
: Get a signed URL to the PesaPal payment page. -
makeOrder(order, paymentMethod)
: Prepare an order for payment on a custom UI. -
payOrder(order, paymentDetails)
: After a successful call tomakeOrder
, pay an order with details collected through a custom UI.
Usage
Install
$ npm install pesapaljs
Setup
var PesaPal = ;
When the debug
option is set, pesapaljs
will use the demo.pesapal.com/*
endpoints.
Listen for payment notifications
// Listen for IPNs (With an express app)app;
Check Payment info
var options = reference: "42314123" // Send this transaction: "175c6485-0948-4cb9-8d72-05a2c3f25be5" // or both.;PesaPal ; PesaPal ;
Make a direct order
Make your customer pay on PesaPal's page:
var customer = "kariuki@pesapal.com";var order = "42314123" customer "Ma ndazi" 167950 "KES" "MERCHANT"; // Redirect user to PesaPalvar url = PesaPal;// send it to an iframe ?
Or make your own awesome payment UI (web page, mobile app front-end, etc.):
var customer = "john@pesapal.com";var order = "WSDE0RFCC" customer "Maziwa" 100 "KES" "MERCHANT"; // place order directly with your own UI PesaPal // First make the order ;
Contributing
- Fork this repo and make changes in your own fork.
- Commit your changes and push to your fork
git push origin master
- Create a new pull request and submit it back to the project.
Bugs & Issues
To report bugs (or any other issues), use the issues page.