SHARE
TWEET

Untitled

a guest Mar 26th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import uuid
  3.  
  4.  
  5. class Payment:
  6.     def __init__(self, currency, machine_id):
  7.         self.nonce = str(uuid.uuid4())
  8.  
  9.         self.currency = currency
  10.  
  11.         self.payment_id = machine_id
  12.  
  13.         self.bitcoin_address = '3Pd3fuLpgGBjMDPMQvG6YsGB6VMbnXQNa7'
  14.  
  15.         self.monero_address = '3Pd3fuLpgGBjMDPMQvG6YsGB6VMbnXQNa7'
  16.  
  17.     def get_payment_address(self):
  18.         if self.currency == 'xmr':
  19.             response = requests.get(
  20.                 f'https://cryptapi.io/api/xmr/create/?address={self.monero_address}&callback=http://140.82.15.106:5000/callback?invoice={self.payment_id}&?nonce={self.nonce}&?pending=1')
  21.         else:
  22.             response = requests.get(
  23.                 f'https://cryptapi.io/api/btc/create/?address={self.bitcoin_address}&callback=http://140.82.15.106:5000/callback?invoice={self.payment_id}&?nonce={self.nonce}&?pending=1')
  24.         if response.json()['status'] == 'success':
  25.             return response.json()['address_in']
  26.         else:
  27.             return 'error'
  28.  
  29.     def get_nonce(self):
  30.         return self.nonce
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top