Django Paypal Integration createOrder curl
Я пытаюсь реализовать paypal в Django без какого-либо SDK или пакета.
https://developer.paypal.com/docs/business/checkout/server-side-api-calls/create-order/
Хочу переписать этот cURL
curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-d '{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
]
}'
в Пихтоне:
мой текущий код:
t = gettoken()
d = {"intent": "CAPTURE","purchase_units": [{"amount": {"currency_code": "USD","value": "100.00"}}]}
h = {"Content-Type: application/json", "Authorization: Bearer "+t}
r = requests.post('https://api-m.sandbox.paypal.com/v2/checkout/orders', headers=h, data=d).json()
Моя ошибка:
Internal Server Error: /createOrder
.....
AttributeError: 'set' object has no attribute 'items'
Жетон Носителя в порядке.
Есть идеи? Чего мне не хватает.
d = {"intent": "CAPTURE","purchase_units": [{"amount": {"currency_code": "USD","value": "100.00"}}]}
h = {"Content-Type": "application/json", "Authorization": "Bearer "+t}
r = requests.post('https://api-m.sandbox.paypal.com/v2/checkout/orders', headers=h, json=d)
Заводы.