6

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

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 = 'senderemail@emailaddress.com'
  receiverEmail = 'receiveremail@emailaddress.com'
  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
| improve this answer | |
  • That link is broken :-( – Casebash Jan 1 '16 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. – David Silva Smith Jan 1 '16 at 19:34
  • Much appreciated! – Casebash Jan 2 '16 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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