0

I'm setting up a PayPal Donation button in my Ruby on Rails project, and I'd like to record every transaction on that button in my database.

I see that you can send a donor to a specific URL on success on PayPal's button setup page. I imagined I'd input a controller action in this field that takes in the amount donated and creates a new Tip entry in the database with the amount, but I can't seem to find a variable that stores how much was donated in a transaction - only a variable that lets you set a donation amount.

Does anyone know of a way to have PayPal send back the donation amount whenever a donation occurs? Thank you!

Aakash Parashar
  • 386
  • 1
  • 2
  • 14
Argus9
  • 1,863
  • 4
  • 26
  • 40
  • https://developer.paypal.com/docs/api/#sales – max Feb 23 '16 at 15:06
  • You might find this post handy: http://stackoverflow.com/questions/14316426/is-there-a-paypal-ipn-code-sample-for-ruby-on-rails. It's a little old, but there's a good sense of direction provided there. You should receive params from Paypal's response that include the value - when I implemented something similar, it was under `mc_gross` (you'll need to convert the response to a hash to get a hold of this). Hope that helps! – SRack Feb 23 '16 at 15:13
  • This looks like it could be a huge help, thank you! Do you want to make this an answer s so I can credit you? – Argus9 Feb 23 '16 at 17:52

0 Answers0