如何解决django-paypal如何检查付款是否完成
我使用django-paypal进行有效的付款方式,但是,如何在完成付款后重定向用户后如何检查付款是否实际完成? 这是我基于process_payment函数的视图:
def payment_process(request,trade_id):
trade = get_object_or_404(Trade,id=trade_id)
host = request.get_host()
paypal_dict = {
...
'notify_url': 'https://{}{}'.format(host,reverse('paypal-ipn')),'return_url': 'https://{}{}/{}'.format(host,*reverse('payment_done',kwargs={'trade_id': trade.id})),'cancel_return': 'https://{}{}'.format(host,reverse('home')),}
form = PayPalPaymentsForm(initial=paypal_dict)
return render(request,'payment/payment_process.html',{'trade': trade,'form': form})
我的payment_done视图(付款后用户重定向到该视图:
# if paymenis done ????????:
messages.success(request,'Your product is in your inbox now')
return redirect('trade:inbox')
# else (the payment was not completed
messages.error(request,'You didnt complete the payment,if you are sure you did contact us at someemail@gmail.com and provide us with some evidence')
return redirect('home')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。