{"id":19658163,"url":"https://github.com/kingflamez/rave-javascript-sdk","last_synced_at":"2025-04-28T20:31:16.363Z","repository":{"id":57348529,"uuid":"126963785","full_name":"kingflamez/Rave-Javascript-SDK","owner":"kingflamez","description":"To integrate Rave easily with Javascript Libraries and Frameworks","archived":false,"fork":false,"pushed_at":"2018-04-13T14:05:20.000Z","size":160,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-20T01:46:02.789Z","etag":null,"topics":["flutterwave","flutterwave-api","flutterwave-rave","flutterwave-ravepay-api","kingflamez","nuxt","nuxtjs","payment-gateway","payment-integration","reactjs","sdk-js","transaction","transaction-requery","transaction-verification","vuejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kingflamez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-27T09:38:58.000Z","updated_at":"2022-03-14T16:52:31.000Z","dependencies_parsed_at":"2022-08-24T18:20:39.241Z","dependency_job_id":null,"html_url":"https://github.com/kingflamez/Rave-Javascript-SDK","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingflamez%2FRave-Javascript-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingflamez%2FRave-Javascript-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingflamez%2FRave-Javascript-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingflamez%2FRave-Javascript-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingflamez","download_url":"https://codeload.github.com/kingflamez/Rave-Javascript-SDK/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251383653,"owners_count":21580916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutterwave","flutterwave-api","flutterwave-rave","flutterwave-ravepay-api","kingflamez","nuxt","nuxtjs","payment-gateway","payment-integration","reactjs","sdk-js","transaction","transaction-requery","transaction-verification","vuejs"],"created_at":"2024-11-11T15:36:19.466Z","updated_at":"2025-04-28T20:31:15.757Z","avatar_url":"https://github.com/kingflamez.png","language":"JavaScript","readme":"# Rave-Javascript-SDK\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![npm version](https://badge.fury.io/js/rave-javascript-sdk.svg)](https://badge.fury.io/js/rave-javascript-sdk)\n[![npm](https://img.shields.io/npm/dt/rave-javascript-sdk.svg)](https://www.npmjs.com/package/rave-javascript-sdk)\n\n\n\u003e Implement Rave by Flutterwave easily with Javascript frameworks and Libraries\n\n- Go to [Flutterwave Rave Live](https://rave.flutterwave.com) to get your **`LIVE`** public and private key\n- Go to [Flutterwave Rave Test](https://raveappv2.herokuapp.com) to get your **`TEST`** public and private key\n\n## Tested on\n- VueJS\n- NuxtJS\n- ReactJS\n\n## Installation\n```bash\nnpm install rave-javascript-sdk --save\n```\n### ReactJS and VueJS\n\nAdd this Rave Inline Script to your `index.html` for a test account\n```html\n\u003cscript src=\"https://rave-api-v2.herokuapp.com/flwv3-pug/getpaidx/api/flwpbf-inline.js\"\u003e\u003c/script\u003e\n```\n\nAdd this Rave Inline Script to your `index.html` for a live account\n```html\n\u003cscript src=\"https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js\"\u003e\u003c/script\u003e\n```\n\n### Nuxt\nAdd this to your `nuxt.config.js` or in `Vue Page` head for a test account\n```javascript\nhead: {\n    script: [\n      ---\n      { src: 'https://rave-api-v2.herokuapp.com/flwv3-pug/getpaidx/api/flwpbf-inline.js', body: true }\n      ---\n    ]\n  },\n```\n\nAdd this to your `nuxt.config.js` or in `Vue Page` head for a live account\n```javascript\nhead: {\n    script: [\n      ---\n      { src: 'https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js', body: true }\n      ---\n    ]\n  },\n```\n\n## Basic Usage\n\n### VueJS Sample\n\n```html\n  \u003ctemplate\u003e\n    \u003cbutton v-on:click=\"buy\"\u003eBuy\u003c/button\u003e\n  \u003c/template\u003e\n  \u003cscript\u003e\n  import Rave from 'rave-javascript-sdk'\n  export default {\n    methods: {\n      buy() {\n        var rave = new Rave();\n        \n        rave.setEmail('flamekeed@gmail.com')\n            .setAmount(\"3000\")\n            .setPublicKey(\"FLWPUBK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\")\n            .setModalTitle(\"Flamez fresh\")\n            .setMeta([\n                      { metaname: 'Room', metavalue: \"36A\" },\n                      { metaname: 'Colour', metavalue: \"Blue\" }\n                    ])\n            .initialize()\n      }\n    }\n  }\n  \u003c/script\u003e\n```\n\n### ReactJS Sample\n\n```javascript\nimport React, { Component } from 'react';\nimport Rave from 'rave-javascript-sdk';\n\nclass Events extends Component {\n  constructor(props) {\n    super(props);\n    this.buy = this.buy.bind(this);\n  }\n\n  buy() {\n    var rave = new Rave();\n        \n    rave.setEmail('flamekeed@gmail.com')\n        .setAmount(\"3000\")\n        .setPublicKey(\"FLWPUBK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\")\n        .setModalTitle(\"Flamez fresh\")\n        .setMeta([\n                  { metaname: 'Room', metavalue: \"36A\" },\n                  { metaname: 'Colour', metavalue: \"Blue\" }\n                ])\n        .initialize()\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n          \u003cbutton onClick={this.buy}\u003eBuy\u003c/button\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n```\n\n## Available Rave methods\n| Name               | Type         | Default  | Required | Description |\n| ------------------ | ------------ | -------- | -------- | ----------- |\n| setPublicKey  | String  |          | Yes       | Your merchant public key provided when you sign up for rave. |\n| setEmail     | String       |          | Yes       | Email of the customer. |\n| setAmount    | String  |        | Yes       | Amount to charge. |\n| setPhone     | String       |          | No       | Phone number of the customer. |\n| setPaymentMethod     | String       | `both`   | No       | This allows you select the payment option you want for your users, this can be `both`, `card`, `ussd` or `account`. |\n| setMeta           | Object Array | `[]`     | No       | These are additional information you want to pass through the payment gateway .|\n| setCurrency           | String       | `NGN`    | No       | The currency you want to charge the customer. |\n| setRedirectURL       | String       |          | No       | URL to redirect to when transaction is completed. |\n| setCountry            | String       | `NG`     | No       | The country of operation. |\n| setFirstname | String       |          | No       | First name of the customer. |\n| setLastName  | String       |          | No       | Last name of the customer. |\n| setModalTitle       | String       |          | No       | Text to be displayed as the title of the payment modal. |\n| setDescription | String       |          | No       | Text to be displayed as a short modal description. |\n| setLogo        | String       |          | No       | Link to the Logo image. |\n| setTransactionReference              | String | It will be generated automatically when left blank | No | Unique transaction reference provided by the merchant. |\n| setCallback           | Function     |          | No      | A function to be called on successful card charge. User’s can always be redirected to a successful or failed page supplied by the merchant here based on response. |\n| setCancel            | Function     |          | No      | A function to be called when the pay modal is closed. |\n\n## Available Functions\n1. `RequeryTransaction({ live, txref, SECKEY })`\n\n\u003e This requeries a transaction, useful to check if a failed transaction is successful\n\n- `live`: `false` or `true` Set to true if you are using a live account and vice versa\n- `txref`: The transaction reference\n-  `SECKEY`: Your API secret key\n\n```javascript\nRequeryTransaction({ live: false, txref: response.tx.txRef, SECKEY: \"FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXX-X\" })\n.then(function (resp) {\n  // console.log(resp);\n})\n.catch(function (error) {\n  // console.log(error);\n});\n```\n\n2. `VerifyTransaction({ live, txref, SECKEY })`\n\n\u003e This validates a transaction, you can get your metas passed through this\n\n- `live`: `false` or `true` Set to true if you are using a live account and vice versa\n- `txref`: The transaction reference\n-  `SECKEY`: Your API secret key\n\n```javascript\n\nvar currency = \"NGN\"; //Gotten from server or hardcoded\nvar amount = \"3000\"; //Gotten from server or hardcoded\n\nVerifyTransaction({ live: false, txref: response.tx.txRef, SECKEY: \"FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXX-X\" })\n.then(function (resp) {\n  // console.log(resp);\n  var chargeResponse = resp.data.data.flwMeta.chargeResponse;\n  var chargeAmount = resp.data.data.amount;\n  var chargeCurrency = resp.data.data.transaction_currency;\n\n\n  if ((chargeResponse == \"00\" || chargeResponse == \"0\") \u0026\u0026 (chargeAmount == amount) \u0026\u0026 (chargeCurrency == currency)) {\n    console.log(\"Successful\");\n    \n    console.log(resp.data);\n    \n    //Give Value and return to Success page\n  } else {\n    console.log(\"Error\");\n    console.log(resp);\n    \n    \n    //Dont Give Value and return to Failure page\n  }\n})\n.catch(function (error) {\n  // console.log(error);\n});\n```\n\n\n## More Samples\n\n### VueJS with Transaction Verification\n\n\n```html\n  \u003ctemplate\u003e\n    \u003cbutton v-on:click=\"buy\"\u003eBuy\u003c/button\u003e\n  \u003c/template\u003e\n  \u003cscript\u003e\n  import Rave from 'rave-javascript-sdk'\n  export default {\n    methods: {\n      buy() {\n        var rave = new Rave();\n        \n        rave.setEmail('flamekeed@gmail.com')\n            .setAmount(\"3000\")\n            .setPublicKey(\"FLWPUBK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\")\n            .setModalTitle(\"Flamez fresh\")\n            .setCancel(this.cancel)\n            .setCallback(this.callback)\n            .setMeta([\n                      { metaname: 'Room', metavalue: \"36A\" },\n                      { metaname: 'Colour', metavalue: \"Blue\" }\n                    ])\n            .initialize()\n      },\n      callback(resp) {\n        return VerifyTransaction({ live: false, txref: resp.tx.txRef, SECKEY: \"FLWSECK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\" })\n          .then(function (response) {\n            console.log(response);\n            ;\n          })\n          .catch(function (error) {\n            console.log(error);\n\n          });\n      },\n      cancel() {\n        console.log(\"closed\"); \n      }\n    }\n    }\n  }\n  \u003c/script\u003e\n```\n\n### ReactJS with Transaction Verification\n\n```javascript\nimport React, { Component } from 'react';\nimport Rave, { VerifyTransaction } from 'rave-javascript-sdk';\n\nclass Events extends Component {\n  constructor(props) {\n    super(props);\n    this.buy = this.buy.bind(this);\n  }\n\n  buy() {\n    var rave = new Rave();\n\n    rave.setEmail('flamekeed@gmail.com')\n        .setAmount(\"3000\")\n        .setPublicKey(\"FLWPUBK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\")\n        .setModalTitle(\"Flamez fresh\")\n        .setCancel(this.cancel)\n        .setCallback(this.callback)\n        .setMeta([\n                  { metaname: 'Room', metavalue: \"36A\" },\n                  { metaname: 'Colour', metavalue: \"Blue\" }\n                ])\n        .initialize()\n  }\n\n\n  callback(resp) {\n    return VerifyTransaction({ live: false, txref: resp.tx.txRef, SECKEY: \"FLWSECK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X\" })\n      .then(function (response) {\n        console.log(response);\n      })\n      .catch(function (error) {\n        console.log(error);\n\n      });\n  }\n\n  cancel() {\n    console.log(\"closed\");\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n          \u003cbutton onClick={this.buy}\u003eBuy\u003c/button\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n```\n\n\n## Contributing\nPlease feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.\n\nKindly star the GitHub repo and share ❤️.  I ❤️ Flutterwave\n\nKindly [follow me on twitter](https://twitter.com/mrflamez_)!\n\n## Credits\n\n- [Oluwole Adebiyi (KingFlamez)](https://github.com/kingflamez)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingflamez%2Frave-javascript-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingflamez%2Frave-javascript-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingflamez%2Frave-javascript-sdk/lists"}