PayPal express / Active Merchant - don't display line items or cart?

I am trying to set up PayPal express check with an active merchant, but I have problems. I followed the tutorial and I can get the "choose a payment method" form on paypal, but there are no items or prices.

Here is a screenshot. http://i39.tinypic.com/35mircz.png

Why is the price or any items not displayed, even if I transfer them? Here is the code I use for setup_purchase.

@product = Product.find(params[:product_id]) setup_response = gateway.setup_purchase(200, :ip => request.remote_ip, :items => [{:name => "Tickets", :quantity => 22, :description => "Tickets for 232323", :amount => 10}], :return_url => url_for(:action => 'confirm', :only_path => false), :cancel_return_url => url_for(:action => 'index', :only_path => false) ) redirect_to gateway.redirect_url_for(setup_response.token) 

Any help would be greatly appreciated. Alex

+6
source share
2 answers

Your problem is with your values ​​and price - if you choose setup_response after it calls something like

 logger.debug setup_response 

And check the journal, you will see that it probably complains that the price in the elements does not correspond to the amount you transfer (first value).

At the moment, you have 22, each of which is 10. 10 * 22 = 220, and since you only put 200 in the first value, you are not matching them correctly. Correct it and you should be good to go.

+8
source

I ran into the same problem and finally found the reason, and this is incredibly stupid. You are ready?

There is a discrepancy between the amount you specify (200) and the sum of your positions (22 * 10 = 220). If you change your quantity to 20, it will work. Paypal requires that your expenses be equal to the total price you set. I have no idea how I understood this.

+1
source

Source: https://habr.com/ru/post/908332/


All Articles