Note: Not maintained anymore. Use https://github.com/Flutterwave/cordova-rave
A Cordova extension to add Rave Pay Button into your hybrid apps builds.
These instructions will get you up and running on your local machine for development and testing purposes. See Deployment section for notes on how to deploy the project on a live system.
-
Ensure that you have signed up for a Rave account. If not, go here to sign up for a
live
account or here to sign up for atest
account. -
Ensure that you have
node
andnpm
installed. If not, visit nodejs.org for instructions on how to install for your specific environment. Installingnode
will also installnpm
. -
As this package is for Cordova and Cordova-based projects, ensure you all your required dependencies installed. e.g Cordova.
The following steps will get you up and running.
-
In the root of your project, run
npm install cordova-rave
-
Then:
cd node_modules/cordova-rave && npm start
Once the second command installs all the necessary dependencies, you will be prompted to enter some information. An example is shown below:prompt: PBFPubKey: FLWPUBK-98765445678900987698765567-X prompt: amount: 1 prompt: customer_email: user@user.com prompt: currency: NGN prompt: country: Nigeria prompt: custom_title: Cordovey prompt: custom_description: Testing prompt: redirect_url: https://yourredirecturl.com prompt: payment_plan_id: 1000 prompt: payment_options: prompt: subaccounts: [] prompt: custom_logo: logo.png prompt: liveMode: yes
PBFPubKey: This is your Rave public key and can be gotten from your Rave dashboard
amount: The amount you want to charge your customers. You can omit this and set an amount when calling the pay button (see below)
customer_email: This is the customer's email address. You can omit this and set a value when calling the pay button (see below)
currency: The currency you want to charge your customers in. If omitted, it defaults to NGN
country: The merchant's country. Defaults to Nigeria
custom_title: Text to be displayed as the title of the payment modal
custom_description: Text describing what your customers are paying for
redirect_url: This is the url that rave sends the response of your transaction to. It should be configured to handle a get request. If not supplied, no response will be sent from Rave
payment_plan_id: If you want to bill your customers recurrently, pass in the payment plan id here. It must be an integer
payment_options: This allows you select the payment options you want for your users.
subaccounts: This is an array of objects containing the subaccount IDs to split the payment into.
custom_logo: Link to the Logo image.
liveMode: This determines if you want to use the Live APIs (yes) or the Test APIs (no). It is required
-
Generate rave.js. While you're still in the
node_modules/cordova-rave
directory, run:npm run build
This ultimately creates a
rave.js
file into your www directory. -
Link the rave.js file to index.html in www directory
Add the following script tag just before your closing script tag
<script type="text/javascript" src="rave.js"></script>
With rave.js now linked, you can call the function below (as you please), passing in an object containing the properties for that specific transactionn. An example is shown below
initRavePay({ 'amount': 5000, 'customer_email': 'user@example.com', 'customer_firstname': 'Jon', 'customer_lastname': 'Snow', 'pay_button_text': 'Pay now', 'redirect_url': 'https://www.example.com/payment-successful', 'txref': 'CD-102297-RV098299' });
Here are a few things to note
- If you set
liveMode
tono
then ensure that you're using your Rave Sandbox API key i.e public key - If you set
liveMode
toyes
then ensure that you're using your Rave Live API keys
- For any bugs (and questions) about this module, please feel free to report here.
- And you are welcome to fork and submit pull requests.
This project is licensed under the MIT License - see the LICENSE.md file for details