在Active Merchant/PayPal Express Checkout中设置税额 [英] setting tax amount in Active Merchant / PayPal Express Checkout

查看:81
本文介绍了在Active Merchant/PayPal Express Checkout中设置税额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道如何使用Active Merchant和Rails将税额传递给PayPal Express Checkout.一切都在进行(完成交易),除了我一生都不知道如何设置税款.

I need to know how to pass a tax amount to PayPal Express Checkout using Active Merchant and rails. Everything is working (completing transations) except I can't figure out for the life of me how to set the tax.

感谢您的帮助!

推荐答案

这是完成的过程.

以下代码将为两款具有不同价格(5美元和10美元),加上增值税(50美分)且没有运输或手续费的商品建立贝宝快递购买.

the following code will setup a paypal express purchase for 2 items that have different prices (5 and 10 $), plus added taxes (50 cents) and with no shipping or handling cost.

response = YOUR_PAYPAL_GAETWAY_NAME.setup_purchase(1550,
  :subtotal => 1500,
  :shipping => 0,
  :handling => 0,
  :tax => 50,
  :ip     => CLIENT_IP, # you might want to use "request.remote_ip" method from a controller to obtain this value

  :items => [
             {:name => 'ITEM_NAME_1', :description => 'ITEM_DESC_1', :amount => 500, :quantity => 1}, 
             {:name => 'ITEM_NAME_2', :description => 'ITEM_DESC_2', :amount => 1000, :quantity => 1}
            ],

  :return_url        => 'http://SOME/URL',
  :cancel_return_url => 'http://MAYBE/ANOTHER/URL'
)

redirect_to YOUR_PAYPAL_GAETWAY_NAME.redirect_url_for(response.token)

注意:

  • 所有金额必须为美分

  • All amounts must be in cents

必须指定所有4个选项[:subtotal,:shipping,:handling,:tax],如果一个或多个缺失,则其余部分将被忽略,如果您不需要设置某个选项,例如处理费用,只需像上面的示例一样将其设置为零,设置为零的选项就不会出现在您的贝宝页面上.

All 4 options [:subtotal, :shipping, :handling, :tax] must be specified, if one or more is missing the rest will be ignored, if you dont need to set a certain option e.g. handling cost, just set it to zero like the example above, options set to zero won't appear on your paypal page.

:小计必须等于以%为单位的总商品价格,即(item1 * item1的数量)+(item2 * item2的数量),依此类推...

:subtotal must equal to the total items price in cent, i.e. (item1 * quantity of item1) + (item2 * quantity of item2) and so on...

订单的总金额(在代码中设置为1550)必须等于:小计+:运输+:处理+:税,否则贝宝将返回错误(无效交易)

The total amount of the order (set to 1550 in the code), must equal to :subtotal + :shipping + :handling + :tax otherwise paypal will return an error (invalid transaction)

这篇关于在Active Merchant/PayPal Express Checkout中设置税额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆