// This is a public sample test API key. // To avoid exposing it, don't submit any personally identifiable information through requests with this API key. // Sign in to see your own test API key embedded in code samples. let stripe = require('stripe') return async env => { let config = await env.site.get_json('/_config/config.json') let stripe_inst = stripe(config.secret_key) let session = await stripe_inst.checkout.sessions.create( { line_items: [ { // Provide the exact Price ID (for example, pr_1234) of the product you want to sell price: config.price_id, quantity: 1, }, ], mode: 'payment', success_url: `${config.your_domain}/success.html`, cancel_url: `${config.your_domain}/cancel.html`, } ) env.response.setHeader('Location', session.url) env.site.serve(env, 303, Buffer.alloc(0), 'create-checkout-session.html.jst') }