我在paypal-django
同步时遇到了一些问题。一切都在沙盒环境中的开发服务器上完美运行,但是当我将它放在生产服务器上时,模板似乎呈现的版本与我自定义的版本和开发服务器上显示的版本不同。这个版本没有 HTML/CSS,只有一个空白的付款表格。
在生产环境中,我仅通过扩展 my 来自定义PayPalPro
呈现的功能,但是该格式没有显示出来,并且付款本身似乎不再起作用。抱歉,如果这篇文章看起来令人困惑,我对此有点迷茫。谢谢。pro/payment.html
base.html
#template
{% extends "base.html" %}
{% block content %}
<div class="container">
<form action="" method="post">{% csrf_token %}
<table>
<tbody>
{% if errors %}<tr><td colspan="2" align="center">{{ errors }}</td></tr>{% endif %}
</tr>
{{ form.as_table }}
<tr><td colspan="2" align="right"><input type="submit" /></td></tr>
</tbody>
</table>
</form>
</div>
{% endblock %}
#views
def express_payment(request):
user = request.user
cart_subtotal = cart.cart_subtotal(request)
if request.method == "POST":
form = PaymentForm(request.POST)
if form.is_valid():
order = form.save(commit=False)
order.buyer = request.user
order.transaction_id = order
order.save()
if order.pk:
cart_items = cart.get_cart_items(request)
for item in cart_items:
order_item = OrderItem(item=item.item_id, quantity=item.quantity, price=item.item_id.price, order=order)
order_item.save()
item = {
"amt": cart_subtotal, # amount to charge for item
"custom": '555', # custom tracking variable for you
"cancelurl": settings.URL + "error", # error page
"returnurl": settings.URL + "success"} # success page
kw = {"item": item, # what you're selling
"success_url": "/success/"} # redirect location after success, I am not sure but it shouldn't work
ppp = PayPalPro(**kw)
return ppp(request)