telepay_http 0.0.3 telepay_http: ^0.0.3 copied to clipboard
TelePay client for Dart language, to easily process cryptocurrency payments using classic http client.
Getting Started #
Check the full example here.
Add to dependencies on
dependencies: telepay_http: <version>
Make Your First Request #
The first thing is to create an instance of
TelePayHttp for later use, which receives two parameters, your API private key and an instance of http client.
final telepay = TelePayHttp(secretApiKey: 'your_secret_api_key', http: http);
🚨 WARNING 🚨
secretApiKey is confidential and meant to be used by you. Anyone who has your project key can access your merchant. Please, do not share it or commit it in your code.
Get the current merchant info.
final me = await telepay.getMe();
Get all the assets suported by TelePay.
final assets = await telepay.getAssets();
Get the balance of the all your wallets.
final balance = await telepay.getBalance();
Get all the invoices the your merchant.
final invoices = await telepay.getInvoices();
Creates an invoice, associated to your merchant.
final invoiceCreate = await telepay.createInvoice( const CreateInvoice( asset: 'TON', blockchain: 'TON', network: 'testnet', amount: 3.5, ), );
Get a specific invoice etails, by invoice number.
final invoice = await telepay.getInvoice('YYXZT1U7Q2P8');
Cancel invoice, by its number.
final invoiceCancel = await telepay.cancelInvoice('FNGUA7LR6B');
Delete invoice, by its number.
final isDelete = await telepay.deleteInvoice('FNGUA7LR6BYYY');
Create a tranferent between internal wallets, thsi is a off-chain operation
final transfer = await telepay.transfer( const CreateTransfer( asset: 'TON', blockchain: 'TON', network: 'testnet', amount: 3.5, username: 'yeikel16', ), );
Get minimum fee for a specific asset for withdraw.
final withdrawMin = await telepay.getWithdrawMinimum('TON', 'TON', 'testnet');
Get estimated withdraw fee, composed of blockchain fee and processing fee.
final withdrawFee = await telepay.getWithdrawFee( const CreateWithdraw( asset: 'TON', blockchain: 'TON', network: 'testnet', amount: 5.2, toAddress: 'EQAwEl_ExMqFJIjfitPRPTdV_B9KTgHG-YognX6iKRWHdpX1', ), );
Running Tests 🧪 #
To run all unit tests use the following command:
dart test --coverage="/coveraga" --test-randomize-ordering-seed random
To view the generated coverage report you can use coverde.
# Filter the tested files. coverde filter -f \.g\.dart # Generate Coverage Report and open in browser. coverde report -l