【发布时间】:2019-11-19 12:35:05
【问题描述】:
我正在使用 django-paypal 在我的网站上管理付款,它与汇款部分配合良好,但我无法将用户信息输入到我的数据库中。我在网上查看了一些东西,人们所做的只是获取 requset.POST 和 request.GET 数据,信息就在那里,但不知何故它对我不起作用。这是我的看法:
def index(request):
paypal_dict = {
"business": "testmail@gmail.com",
"amount": "10.00",
"currency_code": "USD",
"item_name": "Donation",
"invoice": randomString(20),
"notify_url": request.build_absolute_uri(reverse('paypal-ipn')),
"return": request.build_absolute_uri(reverse('pay_app:completed')),
"cancel_return": request.build_absolute_uri(reverse('pay_app:canceled')),
"custom": "premium_plan", # Custom command to correlate to some function later (optional)
}
form = PayPalPaymentsForm(initial=paypal_dict)
return render(request, "pay_app/donation.html", context={'form': form})
@csrf_exempt
def paypal_return(request):
context = {'post': request.POST, 'get': request.GET}
return render(request, 'pay_app/complete-pp.html', context=context)
这可能很简单,但我就是想不通。
【问题讨论】:
标签: python django paypal payment