P
P
POS25
v1.0.1 (mainnet)
Search
K
🛠️

How to use SDK

POS25 provides a fully supported Typescript, Python, and Mobile SDK.
To integrate with the function of SDK you have just defined the POS25 object
Typescript
Python
Java
// Initialize client object
import POS25 from "pos25";
const posClient = new POS25("<Token>")
# Initialize client object
from pos25 import POS25
pos_client = POS25("<Token>")
import org.payment.POS25;
public class Payment {
public static void main(String[] args) {
POS25 posClient = new POS25("<Token>");
}
}
The token is used for authentication. You can get token from API to test this SDK

Get a list chain that POS25 supported

Typescript
Python
Java
// 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 chain that POS25 supported
chains = pos_client.get_chains_supported()
print(chains)
# This is the result
'''
[
{
"name": "SCROLL",
"chain_id": 534352,
"logo": "https://s2.coinmarketcap.com/static/img/coins/64x64/26998.png"
},
]
'''
...
import org.payment.POS25;
public class Payment {
public static void main(String[] args) {
POS25 posClient = new POS25("<Token>");
JsonObject result = posClient.getChainsSuported();
System.out.println(result.toString());
}
}
# 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

Typescript
Python
Java
// 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"
}
]
*/
# Get a list of assets of the chain that POS25 supported
assets = pos_client.get_assets_suported(chain_id = "<chain_id:str>")
print (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"
}
]
'''
...
import org.payment.POS25;
public class Payment {
public static void main(String[] args) {
POS25 posClient = new POS25("<Token>");
JsonObject result = posClient.getAssetsSuported("<chain_id:str>");
System.out.println(result.toString());
}
}
// 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"
}
]
*/
Typescript
Python
Java
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&currency_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_data = pos_client.create_payment_link(
"<order_id: str>",
"<amount: str>",
"<asset: str>",
"<chain_id: int>",
"<currency: str>",
"<fee_value: str>",
"<serial_number: str>"
)
print(assets)
# This is the result
'''
{
"qr_url": "https://app.pos25.app/qr-scan?&order_id=010001&contract_address=0x48736b8AC81E0fa279b571B25C698D631a4407A1&currency_address=0x55d398326f99059ff775485246999027b3197955&transaction_amount=0.001&act=DEPOSIT&chain_id=22222&decimal=6",
"rate_usd": 23000,
"expire_at": "04/11/2023 22:50:31"
}
'''
...
import org.payment.POS25;
public class Payment {
public static void main(String[] args) {
POS25 posClient = new POS25("<Token>");
JsonObject result = posClient.createPaymentLink(
"<orderID: str>",
"<amount: str>",
"<asset: str>",
"<chainID: int>",
"<currency: str>",
"<feeValue: str>",
"<serialNumber: str>"
);
System.out.println(result.toString());
}
}
// This is the result
/**
{
"qr_url": "https://app.pos25.app/qr-scan?&order_id=010001&contract_address=0x48736b8AC81E0fa279b571B25C698D631a4407A1&currency_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

Note: The input of the function has an argument token. This token is the payment token that is created at the TRAM wallet and sent to POS device via NFC.
Typescript
Python
Java
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
*/
const pay_nfc = await pos_lient.pay_nfc(
"<token: str>",
"<amount: str>",
"<order_id: str>"
"<serial_umber: str>"
)
print(assets)
# This is the result
'''
True: if the transaction is executed successfully.
False: if having error happens when executing the transaction
'''
...
import org.payment.POS25;
public class Payment {
public static void main(String[] args) {
POS25 posClient = new POS25("<Token>");
Boolean result = posClient.payNFC(
"<token: str>",
"<amount: str>",
"<orderID: str>"
"<serialNumber: str>"
);
System.out.println(result);
}
}
// This is the result
/**
True: if the transaction is executed successfully.
False: if having error happens when executing the transaction
*/

Additional information