stripe.checkout.sessions.create is a method on the private client that creates a session. This method takes various options that can be found here https://stripe.com/docs/api/checkout/sessions/create. However the minimum ones required to redirect to the appropriate stripe checkout url are the following
After recieving the sessionId from the backend, you would call redirectToCheckout in order to be directed to the stripe checkout UI. Once the checkout process is completed/canceled you will be navigated to either the success_url or cancel_url depending on what action was taken
08/20 Day 19 Lecture Notes
Stripe Checkout
session
idbackend
session
using the private stripe client ->const stripe = require('stripe')(STRIPE_SECRET_KEY);
stripe.checkout.sessions.create
is a method on the private client that creates a session. This method takes various options that can be found here https://stripe.com/docs/api/checkout/sessions/create. However the minimum ones required to redirect to the appropriate stripe checkout url are the followingpayment_method_types
->alipay | card | ideal | fpx | bacs_debit | bancontact | giropay| p24 | eps
line_items
->{ price: PRODUCT_ID, quantity: QUANTITY }[]
mode
->payment | setup | subscription
success_url
-> Url to redirect to after checkout is completedcancel_url
-> Url to redirect to if checkout if canceledfrontend
const stripe = Stripe(STRIPE_PUBLIC_KEY);
sessionId
from the backend, you would callredirectToCheckout
in order to be directed to the stripe checkout UI. Once the checkout process is completed/canceled you will be navigated to either thesuccess_url
orcancel_url
depending on what action was taken