-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
32 lines (21 loc) · 933 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from asyncio import run, sleep
from pyeasypay import EasyPay, Provider
async def main():
# Init providers
crystalpay = Provider('crystalpay', login='', secret='')
cryptobot = Provider('cryptobot', api_key='16439:AAWcbxKxgsvblzwgMM5EGYIIOXAsltpInQ5', network='test')
pay = EasyPay(providers=[crystalpay, cryptobot])
# Create invoice
= await pay.create_invoice(0.25, 'TON', 'cryptobot')
# Save your invoice to memory
# Code here...
# Init invoice from memory
invoice_from_memory = await pay.invoice(
provider='cryptobot', identifier=invoice.identifier, pay_info=invoice.pay_info)
while await invoice_from_memory.check() is False:
await sleep(5)
print(invoice_from_memory)
if invoice_from_memory.status == 'paid':
print(f"Inovoice {invoice_from_memory.identifier} paid!")
if __name__ == '__main__':
run(main())