Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

How do I add the amount stored in my database to Braintree::Transaction.Sale?

Ruby • Asked by RicePad

Hi all, I'm new to this community and also new to Ruby on Rails. I recently watched the Braintree integration screencast by Chris and I've been playing around with its Sand box integration.

I was able to make a successful check out with a hard coded amount i.e:

        def checkout
            nonce = params[:payment_method_nonce]
            result =
             ** :amount => "15.00",**
            :payment_method_nonce => nonce,
            :options => {
            :submit_for_settlement => true} )

Let's say I want a current_user to be able to purchase access to my portofolio for a specific "price" which has been stored in the database. Is there a way to set the amount by pulling it from an a object's attributes from the database i.e: "<[email protected]_item.price>" ?? I've tried multiple attempts and didn't have any luck. I feel like I'm not understanding how Braintree really works.

Am not known with the BT api, but one thing to check is in what way BT expects the price, eg. Stripe expects it to be in cents ($15 would be 1500).

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.