Я попытался интегрировать систему оплаты подписки PayPal с моим приложением django. Но есть некоторые проблемы с вызовом API из бэкэнда.
Вариант 1:
url = "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-VL5K5767RB6S"
headers = {'Authorization': 'Bearer Ae2UGxdThO9xMgFCSJihnhqDrv7zqTSngh6ILNc3imd6RrOM-GovHN_R0jFVL80Qm5oKhDi6rg715G9_', 'Content-Type': 'application/json'}
response = requests.get(url, headers=headers)
Ответ на # 1:
headers {'Cache-Control': 'max-age=0, no-cache, no-store, must-revalidate', 'Content-Length': '83', 'Content-Type': 'application/json', 'Date': 'Fri, 29 May 2020 08:57:14 GMT', 'Paypal-Debug-Id': '50867574d2a79'}
status_code 401
response text {"error":"invalid_token","error_description":"Token signature verification failed"}
Вариант 2:
url = "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-VL5K5767RB6S"
headers = {'Authorization': 'Ae2UGxdThO9xMgFCSJihnhqDrv7zqTSngh6ILNc3imd6RrOM-GovHN_R0jFVL80Qm5oKhDi6rg715G9_', 'Content-Type': 'application/json'}
response = requests.get(url, headers=headers)
Ответ на # 2:
{'Cache-Control': 'max-age=0, no-cache, no-store, must-revalidate', 'Content-Length': '244', 'Content-Type': 'application/json', 'Date': 'Fri, 29 May 2020 08:58:50 GMT', 'Paypal-Debug-Id': '3e1641470db08'}
status_code 401
response text {"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}
Как я могу получить успешный ответ?