@paynicorn/jssdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Paynicorn jssdk

Endow H5 application with paynicorn payment functions

Installation

yarn add @paynicorn/jssdk
// or 
npm i @paynicorn/jssdk

API

startPayment

Bring up the paynicorn app and open the payment page. txnId is required.

import { startPayment } from '@paynicorn/jsddk'

startPayment('32212070000002217')

topUp

Bring up the paynicorn app and open the topup page currency and amount are required.

import { topUp } from '@paynicorn/jsddk'

topUp('AHA', '100')

getAuthCode

import { getAuthCode } from '@paynicorn/jsddk'

getAuthCode('your sdkkey', 'https://your-redirect-url.com')

After the authorization is successful, you can get the authcode from the redirect url , like below

https://your-redirect-url.com?authcode=awsxoik89sfw

Then, you can use authcode to get the accessToken from the server api

If you are using these apis in an android webview, you should add below code to avoid your webview do not known the paynicorn:// schema

webView.setWebViewClient(new WebViewClient(){
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (url.startsWith("paynicorn")) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
        }
        return false;
    }
}); 

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i @paynicorn/jssdk

    Weekly Downloads

    0

    Version

    1.0.8

    License

    ISC

    Unpacked Size

    18.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • paynicorn_app