How do I make a PayPal donate button default to $10 but enable users to change the amount?

1 Answer 1


Using this tutorial I made a textbox where the user is able to specify the amount they want to pay on a form I have complete control over, before I send them to a PayPal webpage to complete the transaction.

My gemfile:

gem 'paypal-sdk-adaptivepayments'

My Ruby payment code

  p = PayPalPayer.new
  amt = @buyamount.to_f
  trackingId = SecureRandom.uuid
  senderEmail = '[email protected]'
  receiverEmail = '[email protected]'
  url = 'http://redirectotohereafterpaymentcomplets'
  pay = p.pay(senderEmail, receiverEmail, amt, url, trackingId)
  redirect pay[:url] //this takes the user to a page to complete the payment
  • That link is broken :-(
    – Casebash
    Jan 1, 2016 at 11:49
  • 2
    Today I learned why it is against policy to just post links. I dug up my code and pasted it in. Jan 1, 2016 at 19:34
  • Much appreciated!
    – Casebash
    Jan 2, 2016 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.