#Giuseppe87-webhook

1 messages · Page 1 of 1 (latest)

cerulean flax
#

Hi there! Are you using Stripe Checkout to create the payment? Or you create a PaymentIntent directly?

floral zodiac
#

No, in the js front end we create the session:

      const session = await stripe.checkout.sessions.create({
        line_items: items,
        mode: 'payment',
        metadata: { order_id: fetchedOrder.id },
        billing_address_collection: 'required',
        success_url: `${NEXT_PUBLIC_NEXT_BASE_URL}/order/success`,
        cancel_url: `${NEXT_PUBLIC_NEXT_BASE_URL}/order/error`,
      });
#

then we redirect to stripe checkout

#
  if (session && session.url)
        res.status(200).json({ data: session.url, errorMessage: undefined });```
#

now I need to listen to the webhook in the (drupal) backend to update and complete the order.

cerulean flax
floral zodiac
#

ok, I see. It works, thank you.

Btw: may I check against the value "amount_total" of the weebook data to control if the payed sum matches with the one saved in the backend?

#

Or should I use something else?