Ravepay Nodejs Library v1.0.0
Ravepay Services exposed by the library
- Card Charge
- Tokenized Charge
- Fees
- Banks
- Account Charge
- Transfers
- Subaccount
- Subscription
- Payment Plan
- Card PreAuthorization
For more information on the services listed above, visit the Ravepay website
How to use
npm install ravepay
You can get your PUBLICK_KEY and SECRET_KEY from the Rave dashboard.
Go here to get your live keys. Go here to get your live keys.
var Ravepay = require('ravepay');
var rave = new Ravepay(PUBLICK_KEY, SECRET_KEY, PRODUCTION_FLAG);
If you pass true as the value for PRODUCTION_FLAG, the library will use the production url as the base for all calls. Otherwise it will use the staging base url;
var rave = new Ravepay(PUBLICK_KEY, SECRET_KEY, PRODUCTION_FLAG); //Base url is 'https://ravesandboxapi.flutterwave.com'
var rave = new Ravepay(PUBLICK_KEY, SECRET_KEY, true); //Base url is 'http://api.ravepay.co'
Card Charge
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; raveCard
Tokenized Charge
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; raveTokenCharge
Transfers
When a transfer is initiated, it comes with a status NEW
this means the transfer has been queued for processing, and you would need to use the reference
you passed to call the Fetch a Transfer endpoint to retrieve the updated status of the transfer.
Available countries you can transfer to
Country Currency
NG (Nigeria) NGN
GH (Ghana) GHS
KE (Kenya) KES
UG (Ugandan) UGX
US (United States) USD
OT (Other countries) GBP, EUR, AUD etc.
Functions included:
-
.initiate
-
.bulk
-
.fetch
-
.list
-
.getApplicableFee
-
.getBalance
.initiate()
This is called to start a transfer. The payload should contain the following card information:
-
'account_bank', 'required:true, eg:044'
, -
'account_number 'required:true,validators:isNumeric, eg:06900021'
, -
'amount', 'required:true, eg:10'
, -
'secKey', 'required:true,eg:FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X'
, -
'narration', 'required:false,eg:New transfer'
, -
'currency', 'required:required,eg:NGN'
, -
'reference', 'required:required,eg:mk-902837-jk'
,
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; raveTransfer
Returns
A sample response is:
"status": "success" "message": "TRANSFER-CREATED" "data": "id": 542 "account_number": "0690000044" "bank_code": "044" "fullname": "Mercedes Daniel" "date_created": "2018-06-06T10:56:12.000Z" "currency": "NGN" "amount": 500 "fee": 45 "status": "NEW" "reference": "rave-transfer-1528159847480966" "narration": "New transfer" "complete_message": "" "requires_approval": 0 "is_approved": 1 "bank_name": "ACCESS BANK NIGERIA"
.bulk()
This allows you send bulk transfers.
The payload should contain the following parameters
'bulk_data', 'required:true, eg:{ "Bank":"044","Account Number":"0690000032"},{"Bank":"044","Account Number":"0690000032"}'
,
raveTransfer
Returns
A sample response is:
"status": "success" "message": "BULK-TRANSFER-CREATED" "data": "id": 21 "uuid": 21 "date_created": "2018-05-17T08:39:54.000Z" "approver": "N/A"
.fetch()
This allows you retrieve a single transfer. It uses a GET method.
raveTransfer
Returns
A sample response is:
"status": "success" "message": "QUERIED-TRANSFERS" "data": "page_info": "total": 1 "current_page": 1 "total_pages": 1 "payouts": "id": 247 "account_number": "0690000032" "bank_code": "044" "fullname": "Pastor Bright" "date_created": "2018-05-17T08:39:55.000Z" "currency": "NGN" "amount": 500 "fee": 45 "status": "FAILED" "narration": "Bulk transfer 1" "approver": null "complete_message": "NO AUTH CONTEXT FOUND" "requires_approval": 0 "is_approved": 1 "bank_name": "ACCESS BANK NIGERIA"
.list()
This allows you fetch all transfers using a GET method
raveTransfer
.getApplicableFee()
This retrieves the fee for a transfer
raveTransfer
.getBalance()
This helps you get your balance for transfers.
'currency', 'required:required,eg:NGN'
,
Returns
A sample response is:
"status": "success" "message": "WALLET-BALANCE" "data": "Id": 3570 "ShortName": "NGN" "WalletNumber": "5070000106866" "AvailableBalance": 17733724 "LedgerBalance": 17733724
Subaccounts
This is used to create and manage subaccounts
Functions included:
-
.create
-
.list
-
.fetch
.create()
This function helps you to create a subaccount on rave.
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; raveSubaccount
Returns
This call returns:
"status": "success" "message": "SUBACCOUNT-CREATED" "data": "id": 10 "account_number": "0690000047" "account_bank": "044" "fullname": "Ben Fowler" "date_created": "2018-05-22T23:08:07.000Z" "meta": "metaname": "MarketplaceID" "metavalue": "ggs-920800" "subaccount_id": "RS_D87A9EE339AE28BFA2AE86041C6DE70E" "bank_name": "ACCESS BANK NIGERIA"
A sample .err
contains
"status": "error" "message": "Sorry we couldn't verify your account number kindly pass a valid account number." "data": null
.list()
This allows you to list all or specific subaccounts.
raveSubaccount
.fetch()
This allows you fetch a single subaccount using the subaccount ID
raveSubaccount
Payment Plans
Rave helps you collect payments recurrently from your customers using a payment plan. Payment plans allow you create a subscription for your customers.
When you have created a payment plan you can subscribe a customer to it by simply passing the plan ID in your request to charge the customers card.
Functions included:
-
.create
-
.list
-
.fetch
-
.cancel
-
.edit
.create()
This function allows you to create payment plans on rave.
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; ravePaymentplan
Returns
A sample response is seen below:
"status": "success" "message": "CREATED-PAYMENTPLAN" "data": "id": 933 "name": "fosm" "amount": "10" "interval": "daily" "duration": 5 "status": "active" "currency": "NGN" "plan_token": "rpp_8b87056c262128afbe56" "date_created": "2018-10-15T16:35:10.000Z"
.list()
This function allows you to list all the payment plans on an account.
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; ravePaymentplan
.fetch()
This function allows you to fetch a single payment plan
ravePaymentplan
.cancel()
This function allows you to cancel an existing payment plan
ravePaymentplan
.edit()
This function allows you to edit a payment plan
ravePaymentplan
Subscriptions
Functions included:
-
.list
-
.fetch
-
.cancel
-
.activate
.list()
This function allows you to list all subscriptions on a merchant account.
var Ravepay = ; var rave = PUBLICK_KEY SECRET_KEY false; raveSubscription
.fetch()
This function allows you to get a particular subscription on a merchant account.
raveSubscription
.cancel()
This function allows you to cancel an existing subscription
raveSubscription
.activate()
This page describes how to activate a subscription
raveSubscription