Я получаю 403 Запрещено, когда я отправляю подписку на PayPal-API
HTML-код:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body>
<h1> Regular Subscription </h1>
<h2>Buy fro $200 </h2>
<form action="/pay" method="post">
<input type="submit" value="Buy">
</form>
<!--<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>-->
<!--<script>paypal.Buttons().render('body');</script>-->
</body>
</html>
код питона
from flask import Flask ,render_template,redirect,request
import paypalrestsdk
from paypalrestsdk import BillingPlan
app=Flask(__name__)
paypalrestsdk.configure({
"mode": "sandbox", # sandbox or live
"client_id": my client",
"client_secret": "my secert" })
@app.route('/pay',methods=['POST'])
def create_bill():
if (request.method == "POST"):
billing_plan = BillingPlan({
"name": "Fast Speed Plan",
"description": "Create Plan for Regular",
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": "http://localhost:5000/success",
"initial_fail_amount_action": "continue",
"max_fail_attempts": "1",
"return_url": "http://localhost:5000/success",
"setup_fee": {
"currency": "USD",
"value": "25"
}
},
"payment_definitions": [
{
"amount": {
"currency": "USD",
"value": "100"
},
"charge_models": [
{
"amount": {
"currency": "USD",
"value": "10.60"
},
"type": "SHIPPING"
},
{
"amount": {
"currency": "USD",
"value": "20"
},
"type": "TAX"
}
],
"cycles": "0",
"frequency": "MONTH",
"frequency_interval": "1",
"name": "Regular 1",
"type": "REGULAR"
}
],
"type": "INFINITE"
})
response = billing_plan.create()
Я получаю ошибку 403, как только я создаю подписку, есть идеи об этой ошибке?
это сообщение об ошибке
** Сообщение об ошибке: {"name": "REQUIRED_SCOPE_MISSING", "message": "Токен доступа не имеет требуемой области действия", "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING","debug_id":"e2955b4aedb5a"} 127.0.0.1 - - [08 / Jun / 2019 00:58:36] "POST / pay HTTP / 1.1" 500 - ****