I want to transfer money to another wallet using the API. There is a problem that comes in json:

{'message': "Invalid Json: Unrecognized token 'id': was expecting ('true', 'false' or 'null')\n at [Source: akka.util.ByteIterator$ByteArrayIterator$$anon$1@50fd882a; line: 1, column: 4]"} 

Code:

 def transfer_in_qiwi_wallet(self, amount, number_qiwi_wallet, comment): self.url = self.root_url + "sinap/api/v2/terms/99/payments" print(self.url) self.data = { "id":"91111111141111", "sum": { "amount": amount, "currency": "643" }, "paymentMethod": { "type":"Account", "accountId": "643" }, "comment": comment, "fields": { "account": number_qiwi_wallet } } json_text = requests.post(self.url, data=self.data, headers=self.header).json() print(json_text) 

How to call:

 qiwi.transfer_in_qiwi_wallet("100", "+79822304501", "test") 

Documentation

  • In my opinion, you are sending json incorrectly, instead of data=self.data seems like json=self.data (and why is there self in general?) - andreymal
  • @andreymal thanks, earned. This feature is part of the class - danilshik

0