rbi-learning / Today-I-Learned

1 stars 0 forks source link

8/20 Official Notes #165

Open Stommy123 opened 4 years ago

Stommy123 commented 4 years ago

08/20 Day 19 Lecture Notes

Stripe Checkout

backend

  const session = await stripe.checkout.sessions.create({
    payment_method_types: ['card'],
    line_items: lineItems,
    mode: 'payment',
    success_url: ROOT_URL,
    cancel_url: ROOT_URL,
  });

  response.json({ session_id: session.id })

frontend

stripe.redirectToCheckout({ sessionId: SESSION_ID })