Notifications
You’re not receiving notifications from this thread.
How do I add the amount stored in my database to Braintree::Transaction.Sale?
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.
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).