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 [email protected] and provide us with some evidence')
       return redirect('home')

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)