Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 516

"Request is not well-formed, syntactically incorrect, or violates schema."

$
0
0

I am using the PayPal invoice in python, and as the title says, I get this error. The thing is, is that in Postman, creating a draft invoice fine; and in python creating the draft invoice is the only issue I have. I did do this yesterday and I had no errors.

If i'm gonna be honest I think it is something with the data but i copied it (for testing) from here (and changed the details i needed to change): https://developer.paypal.com/docs/invoicing/integrate/#:~:text=%7B%0A%20%20%22detail%22%3A%20%7B,%7D%0A%20%20%7D%0A%7D

Response number is 400 if thats any help

Python code creating draft invoice

import requestsimport jsontoken="my token would be here"link="https://api-m.sandbox.paypal.com/v2/invoicing/invoices"headers={"Content-Type": "application/json","Authorization": f"Bearer {token}"}with open("Json Files\draft.json","r") as file:    data=json.load(file)response=requests.post(link,data=data,headers=headers)print(response) #reponse 400with open("Json Files\Result.json","w") as file:    json.dump(response.json(),file,indent=4)

Json result data data

{"name": "INVALID_REQUEST","message": "Request is not well-formed, syntactically incorrect, or violates schema.","debug_id": "30d2ac87b6223","details": [],"links": [        {"href": "https://developer.paypal.com/docs/api/invoicing/#errors","method": "GET"        }    ]}

I expected this:https://developer.paypal.com/docs/invoicing/integrate/#:~:text=of%20the%20invoice.-,Step%20result,W44B%2DKRGF%2DJM6R%2D26VU%22%2C%0A%20%20%20%20%22method%22%3A%20%22GET%22%0A%7D,-2.%20Send


Viewing all articles
Browse latest Browse all 516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>