我安装了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 }}当我点击链接,它把我带到贝宝页面,这需要的钱一次,而不是定期付款。
我做错什么了?
发布于 2014-10-27 14:12:31
我发现了错误。
我使用的测试帐户不是业务帐户,表单发送的命令是错误的命令。
正确的命令是"_xclick-subscriptions“如果查看生成的html,您将看到下面这一行
<input id="id_cmd" type="hidden" value="_xclick" name="cmd">该值必须替换为"_xclick-subscriptions“命令。
最后,我忘记了另一个名为a3的变量,该变量表示我每个月的账单金额。
如果你正在阅读这篇文章,我的建议是不要使用django-paypal。它令人困惑,并且在运行时出现了很多错误。
https://stackoverflow.com/questions/26459437
复制相似问题