π οΈHow to use SDK
POS25 provides a fully supported Typescript, Python, and Mobile SDK.
// Initialize client object
import POS25 from "pos25";
const posClient = new POS25("<Token>")
Get a list chain that POS25 supported
// Get a list chain that POS25 supported
const chains = await posClient.getChainsSuported()
console.log(chains)
// This is the result
/**
[
{
"name": "SCROLL",
"chain_id": 534352,
"logo": "https://s2.coinmarketcap.com/static/img/coins/64x64/26998.png"
},
]
*/
Get a list of assets of the chain that POS25 supported
// Get a list assets of chain that POS25 supported
const assets = await posClient.getAssetsSuported("<chain_id:str>")
console.log(assets)
// This is the result
/**
[
{
"asset": "USDT",
"chain": "SCROLL",
"chain_id": 534352,
"decimal": 6,
"logo": "https://s3.ap-southeast-1.amazonaws.com/static.atomsolution.vn/usdt.png"
}
]
*/
Create Payment link
const paymentData = await posClient.createPaymentLink(
"<orderID: str>",
"<amount: str>",
"<asset: str>",
"<chainID: int>",
"<currency: str>",
"<feeValue: str>",
"<serialNumber: str>"
)
console.log(assets)
// This is the result
/**
{
"qr_url": "https://app.pos25.app/qr-scan?&order_id=010001&contract_address=0x48736b8AC81E0fa279b571B25C698D631a4407A1¤cy_address=0x55d398326f99059ff775485246999027b3197955&transaction_amount=0.001&act=DEPOSIT&chain_id=22222&decimal=6",
"rate_usd": 23000,
"expire_at": "04/11/2023 22:50:31"
}
*/
Payment with NFC
const payNFC = await posClient.payNFC(
"<token: str>",
"<amount: str>",
"<orderID: str>"
"<serialNumber: str>"
)
console.log(assets)
// This is the result
/**
True: if the transaction is executed successfully.
False: if having error happens when executing the transaction
*/
Additional information
Last updated