@cryptoseller-tools/payments-sdk-v1
v0.0.21
Published
SDK for payments through cryptoseller.tools services
Downloads
18
Maintainers
Readme
CST Payments SDK v1
SDK for crypto payments through CST.Pay service
Make online shoping with cryptocurrency more secure and reliable with CST.Pay
Benefits of using CST.Pay
- Validated tokens and recipient addresses, the customer will not be able to send tokens to the wrong address, or use fake tokens;
- Do not require knowledge of web3 to start using;
- Decentralized, customers can use self-custody wallets like Metamask or Ledger;
- Smart Contracts do not store any tokens;
- Small fees from 0% - 1%;
[!IMPORTANT] Before using SDK, you need to get recipientId. You can do it on cryptoseller.tools/pay/dashboard
Usage
import cst from '@cryptoseller-tools/payments-sdk-v1';
async function approveAndTransfer(){
const provider = new ethers.BrowserProvider(window.ethereum); // or any other Eip1193Provider
const signer = await provider.getSigner()
const recipientId='0x0123...' // bytes32 in solidity
const token='0x123...' // token address
const id='0x123...' // bytes32
const payload = JSON.stringify({
name:'CST.Pay example',
desc:'Test payload object'
})
const amount='100.2005' // real number, will be converted to 'wei' based on selected token's decimals.
const a = await cst.approve({ token, amount, signer, wait: true });
if(a.status){
const t = await cst.transfer({ recipientId, amount, token, payload, id, signer, wait: true });
return t.status? t.payload : t.error
}else{
return a.error
}
}
[!NOTE] We also have ready to go widget.
Widget -> cryptoseller.tools/pay/widget
Example -> cryptoseller.tools/pay/iframe