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" } ]}