我安装了django paypal,我正在尝试启用订阅按钮。
我有以下看法。
def donate_root(request):
paypal_dict = {
"business": PAYPAL_RECEIVER_EMAIL,
"amount": "10.00",
"item_name": "foobar money",
'currency_code': 'USD',
"invoice": "unique-invoice-id",
"notify_url": "https://www.example.com" + reverse('paypal-ipn'),
"return_url": "https://www.example.com/your-return-location/",
"cancel_return": "https://www.example.com/your-cancel-location/",
't3': 'D',
'p3': '1',
}
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render_to_response("main.html", context)
在main.html中,我在div 中有以下内容
{{ form.render }}
当我点击链接时,它会将我带到贝宝页面,该页面只收取一次钱,而不是定期付款。
我做错了什么?
我发现了错误。
我使用的测试帐户不是业务帐户,表单发送的命令是错误的。
正确的命令是"_xclick-subscriptions"。如果你查看生成的html,你会看到这行
<input id="id_cmd" type="hidden" value="_xclick" name="cmd">
该值必须替换为"_xclick-subscriptions"命令。
最后,我忘记了另一个变量a3,它表示我每月要支付的金额。
如果你正在阅读这篇文章,我的建议是不要使用django贝宝。它很混乱,运行时有很多错误。