【问题标题】:Getting the information after finishing payment with PayPal using Django使用 Django 使用 PayPal 完成付款后获取信息
【发布时间】: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


    【解决方案1】:

    我没有找到使用 request.POST 或 request.GET 获取数据的解决方案,但我确实设法使用了数据库中 PayPalIpn 表中的信息,所以这在我的情况下已经足够好了,但如果有人在在此期间,您可以随意回答。

    【讨论】:

    • 在测试应用程序时我不在本地主机上。我正在使用 ngrok 连接到我的应用程序
    猜你喜欢
    • 2011-08-20
    • 2018-08-30
    • 1970-01-01
    • 2020-10-16
    • 1970-01-01
    • 1970-01-01
    • 2015-04-06
    • 2014-02-12
    相关资源
    最近更新 更多