tienda
require 'stripe'
require 'sinatra'
# This is your test secret API key.
Stripe.api_key = 'sk_test_51Pl7kVC6YkMXbAw1WQp83qIXglnC7DVOwygM9tLLBeS7RRepVcQ6yyskpxUSPZmPlaDSLnsylRQ8DgJbuOW9av0W00Z2ByALRx'
set :static, true
set :port, 4242
YOUR_DOMAIN = 'https://localhost:4242'
post '/create-checkout-session' do
content_type 'application/json'
session = Stripe::Checkout::Session.create({
line_items: [{
# Provide the exact Price ID (for example, price_1234) of the product you want to sell
price: '{{PRICE_ID}}',
quantity: 1,
}],
mode: 'payment',
success_url: YOUR_DOMAIN + '/success.html',
automatic_tax: {enabled: true},
})
redirect session.url, 303
end