Question

I am working with ActiveMerchant and the checkout process will complete resulting in the end-user being charged the correct amount, but on the receipt sent to the end-user by paypal and in the paypal backend the item title and description are missing. But they do show up on the order preview screen where the user signs into their paypal account

Here is the code I am using to setup the paypal transaction:

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
}]

After the user signs in and completes the payment process and paypal returns to the URL on my domain I get the following response:

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}>

Then when I view the transaction details either through the API or through the Paypal Admin panel I see the payment then when viewing the detail it does not contain the item. Any ideas what is causing this?

I am using the latest version of ActiveMerchant just updated today to make sure that was not the problem.

Was it helpful?

Solution 2

Turns out my issue was with the final post to Paypal I was not sending the items during this step.

PAYPAL_GATEWAY.purchase needs the hash for the items as well for these to display in the final transaction that is viewable from the PayPal website.

OTHER TIPS

You're not getting the description because your are not passing it in your controller. Editing it as below should resolve the problem. I've managed to stumble into a different error though where I get a transaction error in my own app when trying to create a transaction with quantity more than 1. But the below should work for your app.

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
}]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top