Python Django paypal在IPN模拟器中工作,但不在沙箱中工作
我已经在django paypal IPN教程之后编写了一个IPN,但是我的似乎不起作用。它在PayPal IPN模拟器上运行没有问题,我收到IPN并执行代码,但是当我尝试在沙箱模式下执行时,付款没有响应 观点:Python Django paypal在IPN模拟器中工作,但不在沙箱中工作,python,django,paypal,Python,Django,Paypal,我已经在django paypal IPN教程之后编写了一个IPN,但是我的似乎不起作用。它在PayPal IPN模拟器上运行没有问题,我收到IPN并执行代码,但是当我尝试在沙箱模式下执行时,付款没有响应 观点: from django.core.urlresolvers import reverse from django.shortcuts import render from paypal.standard.forms import PayPalPaymentsForm def view
from django.core.urlresolvers import reverse
from django.shortcuts import render
from paypal.standard.forms import PayPalPaymentsForm
def view_that_asks_for_money(request):
# What you want the button to do.
paypal_dict = {
"business": "receiver_email@example.com",
"amount": "100.00",
"item_name": "Product",
"invoice": "100",
"notify_url": "http://myip/paypal/",
"return_url": "https://www.example.com/your-return-location/",
"cancel_return": "https://www.example.com/your-cancel-location/",
"custom": "Upgrade all users!", # Custom command to correlate to some function later (optional)
}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render(request, "payment.html", context)
from paypal.standard.models import ST_PP_COMPLETED
from paypal.standard.ipn.signals import valid_ipn_received
def show_me_the_money(sender, **kwargs):
ipn_obj = sender
category = Category(name="Got IPN")
category.save()
if ipn_obj.payment_status == ST_PP_COMPLETED:
category = Category(name="Good Buzz, complete")
category.save()
else:
category = Category(name="Bad Buzz, not complete")
category.save()
valid_ipn_received.connect(show_me_the_money)
invalid_ipn_received.connect(show_me_the_money)
网址:
当我将IPN发送到时:它可以工作,但不能通过沙箱。您找到解决方案了吗?我也有同样的错误:/我记不清了,但请确保您在prod环境中完全运行。如果您在live中发送付款,但它尝试在sandbox中验证,它将失败。您找到解决方案了吗?我也有同样的错误:/我记不清了,但请确保您在prod环境中完全运行。如果您在live中发送付款,但它尝试在沙箱中进行验证,则将失败。
etc etc etc...
url(r'^paypal/', include('paypal.standard.ipn.urls')),
url(r'^test/$', views.view_that_asks_for_money, name='ask')
]