Reputation: 145
I'm trying to implement Paypal express checkout using activemerchant 1.53 in ruby on rails 4.2.3. After following the railscasts video given here http://railscasts.com/episodes/146-paypal-express-checkout, I've managed to get the basic order flow working without any visible errors. However I've two remaining issues-
I understand m question is bit vague, but please let me know what information do I need to provide to help debug the problem as I cannot see any error in the log. A user gets routed from my site in development environment to Paypal, enters the details of their Paypal sandbox account, completes the transaction, gets redirected to my site, completes the order. Everything works without an error until he gets greeted with a failure message as response.success? returns a false.
Any pointers that would help me debug the problem will be appreciated. Is there any Paypal log I can look at to see what is happening at their end ? Or is there any log I can generate from my end in rails and provide you to help debug? Have the Paypal API or the activemerchant methods changed now as the railscasts is quite old.?
Thank you in Advance.
Upvotes: 1
Views: 451
Reputation: 145
The rails debugging options helped me to debug my problem. I added the following lines in my controller and model to analyse the responses provided by Paypal API. It turns out that i was passing the ip address and total amount as nil in the purchase function resulting in a failure response.
logger.debug "first response: #{response.inspect}"
logger.debug "total price: #{total_price.inspect}"
logger.debug "Express_purchase_opt: #{express_purchase_options.inspect}"
Hope this helps other people who come across similar problem!.
Upvotes: 1