NativeScript MobilePay 1.1.2
This plugin is a wrapper for the MobilePay AppSwitch SDK (https://github.com/MobilePayDev/MobilePay-AppSwitch-SDK). It allows your app to utilize and integrate directly with Mobile Pay if installed on the phone.
(Optional) Prerequisites / Requirements
To use the plugin you would have create an account at MobilePay.
Installation
Describe your plugin installation steps. Ideally it would be something like:
tns plugin add nativescript-mobilepay
Usage
First add the following lines to main.ts:
; ; ; // Do this for nativescript-mobilepay var mobilePay = ; mobilePay; ;
Simply import the MobilePay class as shown below and start using the features.
; ; ; declare var dk: any; @ implements OnInit private mobilePay: MobilePay; { // Use the component constructor to inject providers. } : void // Create an instance on init. Important! thismobilePay = ; thismobilePay; { const isInstalled = thismobilePay; console; // You can choose to provide a result callback like this MobilePay console; MobilePay console; MobilePay console; ifisInstalled thismobilePay }
API
Properties of the plugin
createMobilePayInstance
Creates a mobile pay instance. Please see demo example.
isMobilePayInstalled
Checks whether or not mobile pay is installed on device.
MakePayment
Makes a payment request to mobile pay.
onPaymentSuccess
Callback function if a payment was successful.
onPaymentFailure
Callback if payment failed.
onPaymentCancel()
Callback if payment was cancelled.
License
Apache License Version 2.0, January 2004