首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >django-paypal中的多个项目

django-paypal中的多个项目
EN

Stack Overflow用户
提问于 2010-10-25 11:06:05
回答 3查看 1.2K关注 0票数 0

我使用的是dcramer版本的django-paypal(但我认为它是dcramer版本还是johnboxall版本)。

1)如何在我的paypal_dict中指定多个项目(在PayPalPaymentsForm中使用)?2)另外,我需要在显示在贝宝屏幕上的摘要中适当地指定运费和单个数量-我该怎么做?

EN

回答 3

Stack Overflow用户

发布于 2013-11-04 13:32:43

我不喜欢django-paypal只需阅读PayPal接口:https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside

要将购物车中的所有项目推送到PayPal,请执行以下操作:

代码语言:javascript
复制
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="upload" value="1">
        <input type="hidden" name="business" value="you@youremail.com">
        <input type="hidden" name="currency_code" value="EUR">

        <!-- Run a for loop -->
        {% for item in cart %}
        <input type="hidden" name="item_name_1" value="Item Name 1">
        <input type="hidden" name="amount_1" value="10.00">
        <input type="hidden" name="item_name_2" value="Item Name 2">
        <input type="hidden" name="amount_2" value="20.00">
        .
        .
        .
        <input type="hidden" name="item_name_N" value="Item Name N">
        <input type="hidden" name="amount_N" value="30.00">
        {% endfor %}

        <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
票数 1
EN

Stack Overflow用户

发布于 2011-01-17 00:23:43

我最终在视图中构建了像这样的条目字典:

代码语言:javascript
复制
item = {
    'cancelurl':     'http://%s%s' % DYNAMIC_URL, reverse('pay_cancel')), # Express checkout cancel url
    'returnurl':     'http://%s%s' % (DYNAMIC_URL, reverse('pay_now')), # Express checkout return url

    'l_name0':       'Your product name',
    'l_number0':     1234,
    'l_desc0':       'longer description',
    'l_amt0':        100.00,
    'l_qty0':        1,

    'l_name1':       'Your product name',
    'l_number1':     1234,
    'l_desc1':       'longer description',
    'l_amt1':        200.00
    'l_qty1':        2,

    'itemamt':       500.00,
    'taxamt':        0.00,
    'shippingamt':   0.00,
    'handlingamt':   0.00,
    'shipdiscamt':   0.00,
    'insuranceamt':  0.00,
    'amt':           500.00, # Amount to charge for basket
}

然后这个字典就像这样被捆绑在一起:

代码语言:javascript
复制
kw = {
    'item': item,
    'payment_template': 'cms/register.html', # Template name for payment
    'confirm_template': 'cms/paypal-confirmation.html', # Template name for confirmation
    'success_url':      reverse('pay_success'), # Ultimate return URL
}

ppp = PayPalPro(**kw)
return ppp(request)

你是这个意思吗?

票数 0
EN

Stack Overflow用户

发布于 2018-12-01 06:16:06

假设你想让paypal和你的购物车一起工作。对购物车中的商品使用for循环。为了让贝宝能够识别每件商品的编号,我使用了item.id

代码语言:javascript
复制
{% extends 'base.html' %}
{% block content %}

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="account@mail.com">
<input type="hidden" name="currency_code" value="USD">
{% for item in cart %}

<input type="hidden" name="item_name_{{item.id}}" value="  
{{item.name}}">
<input type="hidden" name="amount_{{item.id}}" value="{{item.price}}">
{% endfor %}

<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" 
name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>


{% endblock %}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4011655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档