@paylend/flutterwave
v1.0.2
Published
Flutterwave wrapper
Downloads
8
Readme
Installation
To install the package do this
npm install @paylend/flutterwave
You can require the package as follows:
const { Flutterwave } = require('@paylend/flutterwave')
To require payload encryption function, do as follows:
const { encryption } = require('@paylend/flutterwave')
MobileMoney charge
The example shown below shows how to make mobileMoney charge request.
For example, for mobile money zambia, provide:
"type" to be "mobile_money_zambia"
"currency" to be "ZMW"
"network" to be either "MTN", "Airtel" or "Zamtel" depending on the phone number's mobile network operatior.
const MobileMoneyCharge = Flutterwave.MobileMoneyCharge({
type,
secretKey,
phoneNumber,
amount,
currency,
txRef,
network,
email,
fullName,
redirectUrl
})
const response = await MobileMoneyCharge.payWithFlutter()
Cards charge
The example shown below shows how to make cards charge request.
const CardCharge = Flutterwave.CardCharge({
type,
secretKey,
encryptionKey,
cardNumber,
cvv,
expiryMonth,
expiryYear,
currency,
amount,
fullName,
email,
txRef,
redirectUrl,
city,
address,
state,
country,
zipcode
})
const response = await CardCharge.payWithFlutter()
MobileMoney transfer
The example shown below shows how to make mobileMoney transfer request.
The example below is for mobile money zambia. Other countries may require additional information to be able to transfer money to the user's mobile number.
Mobile money transfers work the same as regular bank account transfers. The key difference is that the account number is the mobile number on the account (including the country code, like "254"), while the account bank is a code representing the mobile money operator (for example, "MPS" for Rwanda (RWF), Tanzania (TZS), Uganda (UGX), Zambia (ZMW) and Mpesa). A beneficiary_name is also required.
const MobileMoneyTransfer = Flutterwave.MobileMoneyTransfer({
secretKey,
accountBank,
accountNumber,
amount,
narration,
currency,
reference,
beneficiaryName,
callbackUrl
})
const response = await MobileMoneyTransfer.payWithFlutter()
Also note that you can add any other KYC needed in the body request for both mobile money and cards.