Skip to content

Commit

Permalink
we have officially charged for a product using stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansoor Bahramand authored and Mansoor Bahramand committed Oct 19, 2018
1 parent 439ab6f commit 4c5eafd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
p @products
# close database connection
db.close
@crazyTest = "This is a crazy test"
erb :home
end

Expand All @@ -32,6 +31,12 @@
db = SQLite3::Database.open('store.db');
@amount = db.execute("SELECT price FROM products WHERE id=#{params[:selectedProduct]}");
p @amount;
Stripe::Charge.create(
:amount => @amount[0][0],
:currency => "usd",
:source => params[:stripeToken], # obtained with Stripe.js
:description => params[:stripeToken]
)
redirect "/success"
end

0 comments on commit 4c5eafd

Please sign in to comment.