使用 Django 使用 PayPal 完成付款后获取信息

Getting the information after finishing payment with PayPal using Django

我正在使用 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)

这可能很简单,但我就是想不通。

我没有找到使用 request.POST 或 request.GET 获取数据的解决方案,但我确实设法使用了数据库中 PayPalIpn table 的信息,因此在我的情况下已经足够好了,但如果同时有人解决了这个问题,请随时回答。