H5 version applet access
Docking preparation
- The url address of the application (test and production)
Generic interface
Interface general structure
The H5 application communicates with the paynicorn app in a jsbridge way through WebView
web sends information to native
const data = {
action: 'moduleName.methodName', // method name
payload: {
arg1: 1,
arg2: 2
} // parameters
}
window.ReactNativeWebView.postMessage(JSON.stringify(data))
The web receives the native information, and subscribes to the data sent by the native by listening to the message event
window.document.addEventListener('message', function (e) {
const message = JSON.parse(e.data)
// message.action
// message.payload
})
AndroidDataDeviceManager module
method name | parameter list | purpose | versionCode |
---|---|---|---|
closeActivity | no parameters | close the current applet | 61 |
packageInstalled | name: String | Query name APK is installed | 76 |
getVersionCode | no parameters | get paynicorn pay versioncode | 76 |
AndroidDataBundleManager module
method name | parameter list | purpose | versionCode |
---|---|---|---|
setTitle | title: String | set native title bar | 61 |
getBundleInfo | no parameters | get bundle configuration information | 62 |
AndroidDataPayManager module
method name | parameter list | purpose | versionCode |
---|---|---|---|
startPayment | txnId: String | Start native cashier | 61 |
topUp | currency: String , amount: String | Start native deposit function | 61 |
AndroidDataAccountManager module
method name | parameter list | purpose | versionCode |
---|---|---|---|
getAuthCode | sdkkey: String | Start native oauth authentication, get authcode | 61 |
getLoginCode | No parameters | Get the loginCode after a single login to determine whether the user has logged in again | 61 |
demo
const data = {
action: 'AndroidDataPayManager.startPayment', // method name
payload: {
txnId: '1234567898765',
} // parameters
}
window.ReactNativeWebView.postMessage(JSON.stringify(data))
window.document.addEventListener('message', function (e) {
const receivedData = JSON.parse(e.data)
// receivedData.action
// receivedData.payload
})
Structure of receivedData data
receivedData = {
action: 'AndroidDataAccountManager.getAuthCode',
payload: {
data: 'ijyuisafa122919asdfaf'
}
}