1. Home
  2. Interswitch Payment Gateway – Mobile InApp/SDK Implementation
  3. Cordova

Cordova

Cordova Payment Plugin

Interswitch cordova payment plugin allows you to accept payments from customers within your cordova mobile application.

Please Note: The current supported currency is naira (NGN), support for other currencies would be added later

The first step to ​using the plugin is to register as a merchant. This is described [here] (merchantxuat.interswitchng.com)

First steps

  • Create a new cordova project. To do so refer to the documentation here

Plugin installation instructions for Android

  • cd to the directory of your cordova project.
  • Add the cordova-payment-plugin from CLI, using this command

Replace clientId and clientSecret in the command below with your clientId and clientSecret

  • NOTE: To use the inapp change your manifest theme to android:theme=”@style/Theme.AppCompat.Light”

Please Note: Ensure your cordova.js file is the first Javascript file to be included in your index.html

Plugin installation instructions for iOS

  • You’ll need to have Xcode 8.3.2 or later installed.
  • cd to the directory of your cordova project.
  • Add cordova payment plugin

  • Add ios platform. Make sure to add the platform after adding the plugin.

  • In Finder, go to the YourCordovaApp/platforms/ios directory. Open the .xcodeproj file in XCode. A dialog may appear asking: Convert to latest Swift Syntax? Click the Cancel button.
  • In Finder, go to the /platforms/ios/<NameOfApp>/Plugins/com.interswitchng.sdk.payment directory. You should see a number of files like .framework file.
  • Drag all the ​ .framework files from Finder to XCode’s Embedded Binaries section for your app’s TARGETS settings. This will be found under the General tab.
  • In the dialog that appears, make sure Copy items if needed is unchecked.
  • Important: You can only test the SDK on an actual device.

 

  • Follow the remaining steps in the documentation.
  • call the init function inside the onDeviceReady function of your cordova app
  • NOTE: When going into Production mode, use the Client Id and the Client Secret got from the Production Tab of Developer Console instead.

 

Using the Plugin with UI (In PCI-DSS Scope: No )

Pay with Card

  • To allow for Payment with Card
  • Create a Pay button
  • In the onclick event of the Pay button, use this code

 

  1. Set up payment request like this:

 

  1. Create a button to make payment and use this code in the onclick event of the button

Pay with Card

  • To allow for Payment with Card only
  • Create a Pay button and set the payment request *Set up payment request like this:

  • In the onclick event of the Pay button, use this code.

 

 

Using the Plugin without UI (In PCI-DSS Scope: Yes)

Pay with Card

  • To allow for Payment with Card or Token
  • Create a UI to collect amount and card details
  • Create a Pay button
  • Set up payment request like this:

 

 

Authorize Transaction With OTP

  • To authorize transaction with OTP
  • Create a UI to collect OTP
  • Create authorize otp button
  • Set up otp request using this code

  • In the onclick event of the authorize otp button, use this code.

 

Checking Payment Status

  • To check payment status
  • Create a UI to collect transaction identifier
  • Create payment status button
  • Set up payment status request using this code

  • To check the status of a payment made, use the code below

 

 

 

 

 

Articles

Was this article helpful to you? Yes No

How can we help?