Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

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

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Card.charge({"cardno": "5438898014560229","cvv": "564","expirymonth": "10","expiryyear": "20","currency": "NGN","country": "NG","amount": "10","email": "user@gmail.com","phonenumber": "0902620185","firstname": "temi","lastname": "desola","IP": "355426087298442","txRef": "MC-"+Date.now(),// your unique merchant reference"meta": [{metaname: "flightID",metavalue: "123949494DC"}],"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment","device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"}).then(resp=>{// console.log(resp.body);rave.Card.validate({"transaction_reference":resp.body.data.flwRef,"otp":12345}).then(response=>{console.log(response.body.data.tx);})}).catch(err=>{console.log(err);})

Tokenized Charge

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.TokenCharge.card({"currency":"NGN","SECKEY":"FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X","token":"flw-t0876849e016386b2d-k3n-mock","country":"NG","amount":1000,"email":"desola.ade1@gmail.com","firstname":"temi","lastname":"Oyekole","IP":"190.233.222.1","txRef":"MC-7666-YU"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Tranfers

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',

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Transfer.initiate({"account_bank": "044","account_number": "0690000044","amount": 500,"narration": "New transfer","currency": "NGN","reference": "mk-902837-jk"}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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"}',
rave.Transfer.bulk({"title":"May Staff Salary","bulk_data":[{"Bank":"044","Account Number": "0690000032","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 1","reference": "mk-82973029"},{"Bank":"044","Account Number": "0690000034","Amount":500,"Currency":"NGN","Narration":"Bulk transfer 2","reference": "mk-283874750"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Transfer.fetch('<id="transfer ID" e.g mk-902837-jk>').then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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

rave.Transfer.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.getApplicableFee()

This retrieves the fee for a transfer

rave.Transfer.getApplicableFee().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.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": 177337.24,"LedgerBalance": 177337.24}}

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subaccount.create({"account_bank": "044","account_number": "0690000035","business_name": "JK Services","business_email": "jk@services.com","business_contact": "Seun Alade","business_contact_mobile": "090890382","business_mobile": "09087930450","meta": [{"metaname": "MarketplaceID","metavalue": "ggs-920900"}]}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

rave.Subaccount.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This allows you fetch a single subaccount using the subaccount ID

rave.Subaccount.fetch(subaccount_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.create({amount: '10',name: 'fosm',interval: 'daily',duration: 5,},json: true}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

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.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Paymentplan.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to fetch a single payment plan

rave.Paymentplan.fetch(plan_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting payment plan

rave.Paymentplan.cancel({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.edit()

This function allows you to edit a payment plan

rave.Paymentplan.edit({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

Subscriptions

Functions included:

  • .list

  • .fetch

  • .cancel

  • .activate

.list()

This function allows you to list all subscriptions on a merchant account.

varRavepay=require('ravepay');varrave=newRavepay(PUBLICK_KEY,SECRET_KEY,false);rave.Subscription.list().then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.fetch()

This function allows you to get a particular subscription on a merchant account.

rave.Subscription.fetch(subscription_id).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.cancel()

This function allows you to cancel an exisiting subscription

rave.Subscription.cancel({"id": 912}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

.activate()

This page describes how to activate a subscription

rave.Subscription.activate({"id": 912,}).then(resp=>{console.log(resp.body);}).catch(err=>{console.log(err);})

About

Rave by Flutterwave Nodejs SDK.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages