Django paypal:无法达到paypal支付流程

时间:2013-04-20 15:18:24

标签: django python-2.7 django-paypal

我正在使用django-paypal,我无法访问paypal付款流程。

我用paypal表单查看了我的观点,但点击了paypal按钮后,没有任何反应。

这是我的代码:(查看)

def paypal(request):
amount = 0
cart_item = get_cart_items(request)
all_product_in_cart = CartItem.objects.filter(cart_id=_cart_id(request))
for cart in all_product_in_cart:
    amount += cart.product.price * cart.quantity
# What you want the button to do.
paypal_dict = {
    "business": "xxx@xxx.com",
    "amount": amount,
    'currencycode':  'EUR',
    "item_name": cart.product.name,
    "invoice": "unique-invoice-id",
    "notify_url": "/ipn/",
    "return_url": request.build_absolute_uri(reverse("boutiquecar.views.success_payment")),
    "cancel_return": request.build_absolute_uri(reverse("boutiquecar.views.cancel_payment")),
}

# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict, button_type="cart")
return render(request, "shop_paypal/payment.html", {
    "form": form,
    'amount': amount,
    })

和模板:

<h1>You are about to buy for {{ amount }} €</h1>
<form method="post" action="{{ paypal_url }}">
{% csrf_token %}
<table>
    <tbody>
        {% if errors %}<tr><td colspan="2" align="center">{{ errors }}</td></tr>{% endif %}
        {{ form.render }}
        <tr><td colspan="2" align="right"><input type="submit" /></td></tr>
    </tbody>
</table>
</form>

通常正如我在其他帖子中看到的那样,它会起作用,但我无法弄清楚如何修复它!

如果你可以帮助它会很棒! :)提前谢谢

0 个答案:

没有答案