#PARAS DOCS-payment-confirmation

1 messages · Page 1 of 1 (latest)

somber plinth
dull harness
#

i read docs but did't get valid answer

#

i am using session to create a payment

somber plinth
#

Hi 👋 listening to webhook events is usually the best way to do this, but the question is a bit vague so I'm not sure if it'd be a good fit for your scenario.
https://stripe.com/docs/webhooks

#

Oh, Checkout Sessions?

dull harness
#
    
  const domainURL = process.env.DOMAIN;
    const { priceId } = req.body;
      const session = await stripe.checkout.sessions.create({
        payment_method_types: ["card"],
        mode: "payment",
      
        line_items: [
          {
            price_data: {
              currency: 'usd',
              product_data: {
                name: 'T-shirt',
              },
              unit_amount: 2000,
            },
            quantity: 1,
          },
        ], // ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
        success_url: `https://localhost:3000/success?session_id={CHECKOUT_SESSION_ID}`,
        cancel_url: `https://localhost:3000/`,
        // automatic_tax: { enabled: true }
      })
      return res.redirect(303, session.url)
     
  });
#

yes i created checkout session

#

after sucessfull payment user redirect to sucess url but how i know he paid sucessfully

#

i want save data on database after payment

somber plinth
#

The code that you showed is passing the checkout session's ID to your success page, so you can consume that to retrieve the checkout session 0, find the payment intent for that session 1, and check its status.

Or you can listen to webhook events to track the state of the session and store that on your end for reference.

dull harness
#
  'cs_test_a1f2Nrb89tSXeGRDSyFalaOt9q2WBlFoN0lV2sJZocBVMYopIyzoEIrznP'
);``` which key is this?
somber plinth
#

The ID will be provided to your client-side success page, but you'll need to do the retrieval server side.

dull harness
#

ohk

somber plinth
dull harness
#

thank you so much for help

#

❤️