@topapplication/toppay
v1.7.9
Published
Top Payment SDK
Readme
TOP Application Payment Client for Javascript
This TOP Application payment client library supports web browsers
Getting started
Yarn (or NPM)
You can use any NPM-compatible package manager, including NPM itself and Yarn.
npm i @topapplication/toppay --saveOr:
yarn add @topapplication/toppayThen:
import TopPayment from '@topapplication/toppay'Initialization
window.TopPayment = new TopPayment()Initialize TopPayment once as window property
Sample Usage
window.TopPayment.pay(amount, payToken, pin).then(res =>{
// Do Somthing
})amount and payToken are required
if you don't have pin, pass only amount and payToken to the Pay method [2 arguments]
Sample Response
{
"Status": 0,
"Type": 1,
"Message": "موفق",
"Data": {
"Token": "00000000000000000000"
}
}Status === 0 => successful payment
Status === 1 => payment failed or canceled by user
Type => will always be equal to 1 for payment
Data['Token'] => payment token
ExitWebview:
window.TopPayment.home()Go Back:
window.TopPayment.back()Getting Top WebToken:
const webToken = window.TopPayment.webTokenGetting Client OS:
const os = window.TopPayment.osGetting Top Client Platform:
const platform = window.TopPayment.platformGoto:
window.TopPayment.goto(data)| name | data | |-------------------------|-----------------------------------------------------------------------| | Blob Downloader | { "Type": 1, "BlobMimeType": contentType, "BlobData": BlobDataBase64} | | Goto Dashboard | { "Type": 3 } | | LunchUrl | { "Type": 4, "WebViewUrl": "https://example.com",} | | Download From DirectLink | { "Type": 5, "WebViewUrl": "https://example.com"} | | Go Back | { "Type": 6 } |
