Здравствуйте, как пользоваться этим кодом из документации?
https://developer.qiwi.com/ru/qiwi-wallet-personal... - документация
import requests
import time
# Перевод на карту
def send_card(api_access_token, payment_data):
# payment_data - dictionary with all payment data
s = requests.Session()
s.headers['Accept'] = 'application/json'
s.headers['Content-Type'] = 'application/json'
s.headers['authorization'] = 'Bearer ' + api_access_token
postjson = {"id":"","sum": {"amount":"","currency":"643"},"paymentMethod": {"type":"Account","accountId":"643"},"fields": {"account":""}}
postjson['id'] = str(int(time.time() * 1000))
postjson['sum']['amount'] = payment_data.get('sum')
postjson['fields']['account'] = payment_data.get('to_card')
prv_id = payment_data.get('prv_id')
if payment_data.get('prv_id') in ['1960', '21012']:
postjson['fields']['rem_name'] = payment_data.get('rem_name')
postjson['fields']['rem_name_f'] = payment_data.get('rem_name_f')
postjson['fields']['reg_name'] = payment_data.get('reg_name')
postjson['fields']['reg_name_f'] = payment_data.get('reg_name_f')
postjson['fields']['rec_city'] = payment_data.get('rec_address')
postjson['fields']['rec_address'] = payment_data.get('rec_address')
res = s.post('https://edge.qiwi.com/sinap/api/v2/terms/' + prv_id + '/payments', json = postjson)
return res.json()