Atomic Tip Bot
Atomic Tip Bot is a bot which allows you to tip other users on telegram. It is a great example of BitcartCC usage.
To get some funds to tip, user needs to deposit, which means generating an address and checking status of payment. We can use BitcartCC SDK for that.
But also, users are able to withdraw their funds. It is also possible with the SDK, while this feature isn't available in many other payment processors, as BitcartCC is not just a payment processor.
You can use add_request SDK method to create a new invoice.
1
invoice = instances[currency].add_request(amount, description, expire=20160)
Copied!
See the full example
To process payments, we should register an event handler on our APIManager to handle the new_payment event, which is fired when a request was completed.
1
async def payment_handler(instance, event, address, status, status_str):
2
# bitcart: get invoice info, not neccesary here
3
# instance.get_request(address)
4
if status_str == "Paid":
5
# process
Copied!
See the full example
We can use manager.start_websocket() to start listening for new events.
If you are interested, read the full explanation at github here or try the atomic tip bot yourself in telegram
Last modified 9mo ago
Copy link