1.2.0 • Published 4 years ago

nativescript-rave v1.2.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

Rave-Nativescript

Version 1.2.0

Version 1.1.0

  • Upgraded to rave-android:1.0.43
  • Fixed few noticed bugs

Version 1.0.0

  • Using rave-android:1.0.39
  • Initial Release

This plugin allows you to use flutterwave payment platform with Nativescript. For more information visit https://developer.flutterwave.com

Plugin demo

Requirements

  • Add the required permission <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" />
## REQUIRED PERMISSION
This library requires the READ_PHONE_PERMISSION to get the build number for fraud detection and flagging as recommended here https://developer.android.com/training/articles/user-data-ids.html#i_abuse_detection_detecting_high_value_stolen_credentials

Installation

tns plugin add rave-nativescript

Usage

The best way to explore the usage of the plugin is to inspect demo apps in the plugin repository. In demo folder you can find the usage of the plugin.

In addition to the plugin usage, both apps are webpack configured.

In short here are the steps:

Import the plugin

TypeScript import * as RaveNativescript from 'rave-nativescript';

Javascript var Expresspay = require("rave-nativescript");

Start RavePayManager

 let context = RaveNativescript.prepare({
      country: "country",
      currency: "currency here",
      fName: "Customer first name",
      lName: "Customer last name",
      email: "customer email",
      narration: "Your narration here",
      publicKey: "your public key here",
      encryptionKey: "your encryption key here",
      txRef: "txRef",
      amount: amount,
      acceptAccountPayments: true,
      acceptCardPayments: true,
      acceptGHMobileMoneyPayments: true,
      onStagingEnv: true,
      shouldDisplayFee: true,
      showStagingLabel: false,
      setSubAccounts: [{
        subAccountId : "subAccountId",
        transactionSplitRatio: 1
      }],
      setMeta: [{ metaname: "Meta name here", metavalue: "meta value here"}]
    });

Full usage

context.checkoutPayment()
    .then((response) => {
      console.log("payment process complete")
      console.log(response)
    })
    .catch(e => {
    console.log("handle errors")
    })

API

Methods

OptionStatusDefaultDescription
amountrequirednullThis is the amount to be charged from card/account
countryrequirednullThis is the route country for the transaction with respect to the currency. You can find a list of supported countries and currencies here
currencyrequirednullThis is the specified currency to charge the card in
fNamerequirednullThis is the first name of the card holder or the customer
lNamerequirednullThis is the last name of the card holder or the customer
emailrequirednullThis is the email address of the customer
narrationoptionalnullThis is a custom description added by the merchant. For Bank Transfer payments, this becomes the account name of the account to be paid into. See more details here
publicKeyrequirednullMerchant's public key. Get your merchant keys here for staging and live
encryptionKeyrequirednullMerchant's encryption key. Get your merchant keys here for staging and live
txRefrequirednullThis is the unique reference, unique to the particular transaction being carried out. It is generated by the merchant for every transaction
acceptAccountPayments(boolean)optionalfalseSet to true if you want to accept payments via cards, else set to false
acceptCardPayments(boolean)optionalfalseSet to true if you want to accept payments via cards, else set to false
acceptMpesaPayments(boolean)optionalfalseSet to true if you want to accept Mpesa payments, else set to false . For this option to work, you should set your country to KE and your currency to KES
acceptGHMobileMoneyPayments(boolean)optionalfalseSet to true if you want to accept Ghana mobile money payments, else set to false . For this option to work, you should set your country to GH and your currency to GHS
acceptUgMobileMoneyPayments(boolean)optionalfalseSet to true if you want to accept Uganda mobile money payments, else set to false . For this option to work, you should set your country to UG and your currency to UGX
acceptAchPayments(boolean)optionalfalseSet to true if you want to accept US ACH charges from your customers, else set to false . For this option to work, you should set your country to US and your currency to USD. You also have to set acceptAccountPayments(true)
acceptBankTransferPayments(boolean)optionalfalseSet to true if you want to accept payments via bank transfer from your customers, else set to false . This option is currently only available for Nigerian Naira. See more details in the API Location
onStagingEnv(boolean)requiredfalseSet to true if you want your transactions to run in the staging environment otherwise set to false. Defaults to false
txRefrequirednullPass in any other custom data you wish to pass. It takes an array of Meta object {}
txRefrequirednullThis is the unique reference, unique to the particular transaction being carried out. It is generated by the merchant for every transaction

Contribute

We love PRs!. If you want to contribute, but you are not sure where to start - look for issues labeled help wanted.

Get Help

Please, use github issues strictly for reporting bugs or requesting features.