【发布时间】:2015-10-07 04:41:35
【问题描述】:
我正在尝试使用active merchant gem 将paypal-express-checkout 与我的rails 4 应用程序集成。我已成功重定向到paypal,但我无法发送项目详细信息(仅将金额传递给paypal)。
我做了什么:
total_amount = cart_items.sum(:amount)
items = []
cart_items.each_with_index do |item, index|
items << {
"L_PAYMENTREQUEST_0_NAME#{index+1}" => item.product_name,
"L_PAYMENTREQUEST_0_AMT#{index+1}" => to_cents(item.amount),
"L_PAYMENTREQUEST_0_QTY#{index+1}" => item.quantity
}
end
response = EXPRESS_GATEWAY.setup_purchase(total_amount,
:items => items,
:return_url => new_order_url,
:cancel_return_url => root_url
)
redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)
实际发生了什么:
我已检查回复是否有任何错误,但找不到任何错误:
(byebug) response
#<ActiveMerchant::Billing::PaypalExpressResponse:0x00000112831748 @params={"timestamp"=>"2015-07-17T12:43:53Z", "ack"=>"Success", "correlation_id"=>"7cd013c59c176", "version"=>"72", "build"=>"17403434", "token"=>"EC-94A59640DJ829313S", "Timestamp"=>"2015-07-17T12:43:53Z", "Ack"=>"Success", "CorrelationID"=>"7cd013c59c176", "Version"=>"72", "Build"=>"17403434", "Token"=>"EC-94A59640DJ829313S"}, @message="Success", @success=true, @test=true, @authorization=nil, @fraud_review=false, @error_code=nil, @emv_authorization=nil, @avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil}, @cvv_result={"code"=>nil, "message"=>nil}>
注意"message"=>nil, 和@message="Success",
谁能指出我做错了什么。
【问题讨论】:
标签: ruby-on-rails paypal express-checkout activemerchant