ActiveMerchant PaypalExpress缺少项目描述

时间:2014-02-07 01:01:19

标签: ruby-on-rails paypal ruby-on-rails-3.2 activemerchant

我正在使用ActiveMerchant并且结帐流程将完成,导致最终用户收取正确的金额,但是在PayPal发送给最终用户的收据和paypal后端的项目标题和说明丢失。但它们会显示在用户登录其paypal帐户的订单预览屏幕上

以下是我用来设置paypal交易的代码:

setup_response = PAYPAL_GATEWAY.setup_purchase(@product.price.cents,
   :ip => request.remote_ip,
   :return_url => url_for(:action => 'paypal_confirm', :only_path => false),
   :cancel_return_url => root_url,
   :items => [{
      :name => @product.title,
      :quantity => 1,
      :amount => @product.price.cents
}]

在用户登录并完成付款流程并且paypal返回到我的域中的网址后,我得到以下回复:

details_response = PAYPAL_GATEWAY.details_for(params[:token])

response: #<ActiveMerchant::Billing::PaypalExpressResponse:0x007fe06e73a6d0 @params={"timestamp"=>"2014-02-07T00:53:40Z", "ack"=>"Success", "correlation_id"=>"1e941b048cb0c", "version"=>"72", "build"=>"9605603", "token"=>"<TOKEN>", "payer"=>"info2@info.com", "payer_id"=>"<PAYER ID>", "payer_status"=>"verified", "salutation"=>nil, "first_name"=>"Info", "middle_name"=>nil, "last_name"=>"", "suffix"=>nil, "payer_country"=>"US", "payer_business"=>nil, "name"=>"ITEMDESCRIPTION", "street1"=>"1 Main St", "street2"=>nil, "city_name"=>"San Jose", "state_or_province"=>"CA", "country"=>"US", "country_name"=>"United States", "postal_code"=>"95131", "address_owner"=>"PayPal", "address_status"=>"Confirmed", "order_total"=>"14.99", "order_total_currency_id"=>"USD", "item_total"=>"14.99", "item_total_currency_id"=>"USD", "shipping_total"=>"0.00", "shipping_total_currency_id"=>"USD", "handling_total"=>"0.00", "handling_total_currency_id"=>"USD", "tax_total"=>"0.00", "tax_total_currency_id"=>"USD", "phone"=>nil, "address_id"=>nil, "external_address_id"=>nil, "quantity"=>"1", "tax"=>"0.00", "tax_currency_id"=>"USD", "amount"=>"14.99", "amount_currency_id"=>"USD", "ebay_item_payment_details_item"=>nil, "insurance_total"=>"0.00", "insurance_total_currency_id"=>"USD", "shipping_discount"=>"0.00", "shipping_discount_currency_id"=>"USD", "insurance_option_offered"=>"false", "seller_details"=>nil, "payment_request_id"=>nil, "order_url"=>nil, "soft_descriptor"=>nil, "checkout_status"=>"PaymentActionNotInitiated", "payment_request_info"=>nil, "Token"=>"EC-2TA24464XG397043V", "PayerInfo"=>{"Payer"=>"info2@info.com", "PayerID"=>"<PAYER ID>", "PayerStatus"=>"verified", "PayerName"=>{"Salutation"=>nil, "FirstName"=>"Info", "MiddleName"=>nil, "LastName"=>"Info", "Suffix"=>nil}, "PayerCountry"=>"US", "PayerBusiness"=>nil, "Address"=>{"Name"=>"Info", "Street1"=>"1 Main St", "Street2"=>nil, "CityName"=>"San Jose", "StateOrProvince"=>"CA", "Country"=>"US", "CountryName"=>"United States", "PostalCode"=>"95131", "AddressOwner"=>"PayPal", "AddressStatus"=>"Confirmed"}}, "PaymentDetails"=>{"OrderTotal"=>"14.99", "ItemTotal"=>"14.99", "ShippingTotal"=>"0.00", "HandlingTotal"=>"0.00", "TaxTotal"=>"0.00", "ShipToAddress"=>{"Name"=>"Info", "Street1"=>"1 Main St", "Street2"=>nil, "CityName"=>"San Jose", "StateOrProvince"=>"CA", "Country"=>"US", "CountryName"=>"United States", "Phone"=>nil, "PostalCode"=>"95131", "AddressID"=>nil, "AddressOwner"=>"PayPal", "ExternalAddressID"=>nil, "AddressStatus"=>"Confirmed"}, "PaymentDetailsItem"=>{"Name"=>"ITEMDESCRIPTION", "Quantity"=>"1", "Tax"=>"0.00", "Amount"=>"14.99", "EbayItemPaymentDetailsItem"=>nil}, "InsuranceTotal"=>"0.00", "ShippingDiscount"=>"0.00", "InsuranceOptionOffered"=>"false", "SellerDetails"=>nil, "PaymentRequestID"=>nil, "OrderURL"=>nil, "SoftDescriptor"=>nil}, "CheckoutStatus"=>"PaymentActionNotInitiated", "PaymentRequestInfo"=>nil}, @message="Success", @success=true, @test=true, @authorization=nil, @fraud_review=false, @avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil}, @cvv_result={"code"=>nil, "message"=>nil}>

然后,当我通过API或通过Paypal管理面板查看交易详情时,我会看到付款,然后在查看详细信息时,它不包含该项目。是什么原因引起了这个?

我正在使用刚刚更新的ActiveMerchant的最新版本,以确保不是问题。

2 个答案:

答案 0 :(得分:0)

您没有收到说明,因为您没有在控制器中传递说明。如下编辑它可以解决问题。我设法遇到了一个不同的错误,虽然在我尝试创建数量超过1的交易时,我在自己的应用程序中出现了交易错误。但是下面的内容适用于您的应用。

setup_response = PAYPAL_GATEWAY.setup_purchase(@product.price.cents,
   :ip => request.remote_ip,
   :return_url => url_for(:action => 'paypal_confirm', :only_path => false),
   :cancel_return_url => root_url,
   :items => [{
      :name => @product.title,
      :quantity => 1,
      :amount => @product.price.cents,
      :description => @product.description
}]

答案 1 :(得分:0)

原来我的问题是Paypal的最后一个帖子我没有在这一步中发送物品。

PAYPAL_GATEWAY.purchase需要项目的哈希值,以便在可从PayPal网站查看的最终交易中显示。