activemerchant / active_merchant

Active Merchant is a simple payment abstraction library extracted from Shopify. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
http://activemerchant.org
MIT License
4.53k stars 2.5k forks source link

Item description not shown in Paypal Transaction details #1914

Closed bipashant closed 5 years ago

bipashant commented 8 years ago

Hi I'm Integrating Paypal express checkout using Activemerchant.

I'm able to make successful transaction but I'm not seeing My Item's description in transaction details page.It display all the other option correctly but the Options column is empty.

enter image description here

However I'm seeing Items details in the checkout page.

enter image description here

Here is my code.I probably doing something wrong.

def express_checkout

    listing = Listing.find(session[:listing_id].to_f)

    response = EXPRESS_GATEWAY.setup_purchase(session[:amount].to_f,
                                              ip: request.remote_ip,
                                              return_url: "http://esignature.lvh.me:3000/en/transactions/status",
                                              cancel_return_url: "http://esignature.lvh.me:3000/",
                                              currency: "USD",
                                              allow_guest_checkout: true,
                                              items: [{name: listing.title, description: listing.description, quantity: session[:number_of_days], amount: listing.price_cents},
                                                      {name: "Service Charge" ,description: "Service Charge", amount: session[:service_charge]}
                                              ]
    )

    redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)

  end

  def status
    if (params[:token].present? && params[:PayerID].present?)
      token = params[:token]
      @response = EXPRESS_GATEWAY.details_for(token).params
      listing = Listing.find(session[:listing_id].to_f)

      express_purchase_options = {
          :ip => request.remote_ip,
          :token => params[:token],
          :payer_id => params[:PayerID],
          items: [{ name: listing.title, description: listing.description, quantity: session[:number_of_days], amount: listing.price_cents},
                  { name: "Service Charge", description: "Service Charge", amount: session[:service_charge ]}
          ]
      }

      response = EXPRESS_GATEWAY.purchase(session[:amount].to_f, express_purchase_options)

      if response.message == "Success"
        listing = Listing.find(session[:listing_id].to_f)
        BookingInfo.create!(listing_id: listing.id, start_on: session[:start_date].to_date, end_on: session[:end_date].to_date)
        render 'status'
      else
        render 'status_error'
      end
      reset_session_params
    else
      reset_session_params
      redirect_to homepage_without_locale_path
    end

  end 

here I'm setting Item details in both setup_purchase as well as in purchase.Any suggestion will be appreciated.Thank you

bpollack commented 6 years ago

Are you still encountering this issue, or has it since been solved?

bayprogrammer commented 5 years ago

Haven't heard any follow-up, so I am going to go ahead and close this. If you do happen to run into the problem still please feel free to re-open with additional detail.