[英]PayPal Express Checkout with multiple items with active merchant in rails
[英]Multiple Items in Paypal Express Checkout Ruby API
我最近在使用ruby的paypal api遇到麻烦( https://github.com/paypal/merchant-sdk-ruby )。
我正在尝试使用PaymentDetailsItem设置一个以上项目的结帐,但是当我发送请求时,出现错误消息:“购物车项目总额与订单金额不符。”
正如您在下面的代码中看到的那样,我已经检查过了。 我的OrderTotal等于ItemTotal,ShippingTotal,HandlingTotal和TaxTotal的总和。
我已经尝试了很多事情,paypal api的文档非常糟糕,在网上找不到任何示例。 非常感谢您的帮助。
@api = PayPal::SDK::Merchant::API.new
@set_express_checkout = @api.build_set_express_checkout({
:SetExpressCheckoutRequestDetails => {
:ReturnURL => "#{ENV['HOST']}/return",
:CancelURL => "#{ENV['HOST']}/cancel",
:PaymentDetails => [{
:OrderTotal => {
:currencyID => currency,
:value => "10.00"
},
:ItemTotal => {
:currencyID => currency,
:value => "10.00"
},
:ShippingTotal => {
:currencyID => currency,
# :value => ship
:value => "0.00"
},
:TaxTotal => {
:currencyID => currency,
:value => "0.00"
},
:NotifyURL => "#{ENV['HOST']}/ipn_notify",
:PaymentDetailsItem =>
[
{
:Name => "Some Product",
:Quantity => 1,
:Amount => {
:currencyID => "EUR",
:value => "5.00"
},
:ItemCategory => "Physical"
}
],
:PaymentDetailsItem =>
[
{
:Name => "Other Product",
:Quantity => 1,
:Amount => {
:currencyID => "EUR",
:value => "5.00"
},
:ItemCategory => "Physical"
}
],
:PaymentAction => "Authorization" }] } })
@set_express_checkout_response = @api.set_express_checkout(@set_express_checkout)
删除:PaymentDetailsItem
键之一,然后添加项目,如下所示。
:PaymentDetailsItem =>
[
{
:Name => "Some Product",
:Quantity => 1,
:Amount => {
:currencyID => "EUR",
:value => "5.00"
},
:ItemCategory => "Physical"
},
{
:Name => "Other Product",
:Quantity => 1,
:Amount => {
:currencyID => "EUR",
:value => "5.00"
},
:ItemCategory => "Physical"
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.