Пробовал сделать инвойс через PayPal-Python-SDK, но получал ошибку Authorization error occurred, сейчас пробую сделать тоже самое через курл.
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "client_id:client_secret" \
-d "grant_type=client_credentials"
Получаю ответ
{'access_token': 'ТУТ МОЙ ТОКЕН',
'app_id': 'APP-ХХХХХХХХХХХХХХХХ',
'expires_in': 29912,
'nonce': '2018-07-10T09:04:19ZnUeXNMkpgbjbrDSPYJwFnBGh4LdtU4ORtRsMHLXANvE',
'scope': 'https://uri.paypal.com/services/paypalhere '
'https://api.paypal.com/v1/payments/.* '
'https://uri.paypal.com/services/payments/initiatepayment '
'https://uri.paypal.com/services/payments/refund '
'https://uri.paypal.com/services/applications/webhooks '
'https://uri.paypal.com/services/payments/payment/authcapture '
'https://uri.paypal.com/payments/payouts '
'https://api.paypal.com/v1/vault/credit-card/.* '
'https://api.paypal.com/v1/payments/refund '
'https://uri.paypal.com/services/reporting/search/read '
'https://uri.paypal.com/services/disputes/read-seller '
'https://uri.paypal.com/services/subscriptions '
'https://uri.paypal.com/services/disputes/read-buyer '
'https://api.paypal.com/v1/vault/credit-card '
'https://api.paypal.com/v1/payments/sale/.*/refund openid '
'https://uri.paypal.com/services/disputes/update-seller '
'https://uri.paypal.com/services/payments/realtimepayment',
'token_type': 'Bearer'}
Беру свой токен и пробую сделать инвойс
curl -v -X POST https://api.sandbox.paypal.com/v1/invoicing/invoices/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ТУТ МОЙ ТОКЕН" \
-d '{
"merchant_info": {
"email": "seller@wstlnk.com",
"first_name": "David",
"last_name": "Larusso",
"business_name": "Mitchell & Murray",
"phone": {
"country_code": "001",
"national_number": "4085551234"
},
"address": {
"line1": "1234 First Street",
"city": "Anytown",
"state": "CA",
"postal_code": "98765",
"country_code": "US"
}
},
"billing_info": [
{
"email": "buyer@wstlnk.com",
"first_name": "Stephanie",
"last_name": "Meyers"
}
],
"shipping_info": {
"first_name": "Stephanie",
"last_name": "Meyers",
"address": {
"line1": "1234 Main Street",
"city": "Anytown",
"state": "CA",
"postal_code": "98765",
"country_code": "US"
}
},
"items": [
{
"name": "Zoom System wireless headphones",
"quantity": 2,
"unit_price": {
"currency": "USD",
"value": "120"
},
"tax": {
"name": "Tax",
"percent": 8
}
},
{
"name": "Bluetooth speaker",
"quantity": 1,
"unit_price": {
"currency": "USD",
"value": "145"
},
"tax": {
"name": "Tax",
"percent": 8
}
}
],
"discount": {
"percent": 1
},
"shipping_cost": {
"amount": {
"currency": "USD",
"value": "10"
}
},
"note": "Thank you for your business.",
"terms": "No refunds after 30 days."
}'
И в результате все равно полчаю ошибку
{"name":"AUTHORIZATION_ERROR","message":"Authorization error occurred.","information_link":"https://developer.paypal.com/docs/api/invoicing/#errors","debug_id":"c26d163a87c8d"}
Кто сталкивался подскажите, плиз, что не так, а то я уже задолбался бится головой об стену(