New Discussion

Notifications

You’re not receiving notifications from this thread.

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

0
Ruby

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 = Braintree::Transaction.sale(
             ** :amount => "15.00",**
            :payment_method_nonce => nonce,
            :options => {
            :submit_for_settlement => true} )
     end

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: "<=@portofolio_item.price>" ?? I've tried multiple attempts and didn't have any luck. I feel like I'm not understanding how Braintree really works.

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.