mw-payment-plugin
v0.0.12
Published
Plugin helps to make payment via upi apps like GPay, Paytm, AmazonPay, PhonePe and BHIM
Downloads
28
Readme
mw-payment-plugin
Plugin helps to make payment via upi apps like GPay, Paytm, AmazonPay, PhonePe and BHIM
Install
npm install mw-payment-plugin
npx cap sync
API
initialise(...)
startPayment()
printByUsb(...)
printByBluetooth(...)
addListener('onTransactionCompleted', ...)
addListener('onTransactionCancelled', ...)
addListener(string, ...)
- Interfaces
initialise(...)
initialise(transaction: Transaction) => Promise<void>
| Param | Type |
| ----------------- | --------------------------------------------------- |
| transaction
| Transaction |
startPayment()
startPayment() => Promise<void>
printByUsb(...)
printByUsb(printObject: PrintObject) => Promise<void>
| Param | Type |
| ----------------- | --------------------------------------------------- |
| printObject
| PrintObject |
printByBluetooth(...)
printByBluetooth(printObject: PrintObject) => Promise<void>
| Param | Type |
| ----------------- | --------------------------------------------------- |
| printObject
| PrintObject |
addListener('onTransactionCompleted', ...)
addListener(eventName: "onTransactionCompleted", listenerFunc: (transactionDetails: TransactionDetails) => void) => PluginListenerHandle
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------------- |
| eventName
| 'onTransactionCompleted' |
| listenerFunc
| (transactionDetails: TransactionDetails) => void |
Returns: PluginListenerHandle
addListener('onTransactionCancelled', ...)
addListener(eventName: "onTransactionCancelled", listenerFunc: () => void) => PluginListenerHandle
| Param | Type |
| ------------------ | ------------------------------------- |
| eventName
| 'onTransactionCancelled' |
| listenerFunc
| () => void |
Returns: PluginListenerHandle
addListener(string, ...)
addListener(eventName: string, listenerFunc: (...args: any[]) => any) => PluginListenerHandle
| Param | Type |
| ------------------ | --------------------------------------- |
| eventName
| string |
| listenerFunc
| (...args: any[]) => any |
Returns: PluginListenerHandle
Interfaces
Transaction
| Prop | Type |
| ----------------- | ------------------- |
| vpa
| string |
| name
| string |
| transID
| string |
| transRefID
| string |
| description
| string |
| amount
| string |
PrintObject
| Prop | Type |
| ----------------- | ------------------- |
| textToPrint
| string |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove
| () => Promise<void> |
TransactionDetails
| Prop | Type |
| ----------------------- | -------------------------------------------------- |
| transID
| string |
| responseCode
| string |
| approvalRefNo
| string |
| transactionStatus
| 'SUBMITTED' | 'SUCCESS' | 'FAILURE' |
| transactionRefId
| string |
| amount
| string |
How to publish npm package to latest version on npm
https://cloudfour.com/thinks/how-to-publish-an-updated-version-of-an-npm-package/
Add this in main/root build.gradle in android folder
Reference lib repo: https://github.com/DantSu/ESCPOS-ThermalPrinter-Android#installation
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
Add USB/Bluetooth plugin permission in main AndroidMenifest file
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-feature android:name="android.hardware.usb.host" />