#tallmanpapi

1 messages · Page 1 of 1 (latest)

gaunt onyxBOT
carmine current
#

What other details you are looking for ?

cinder niche
#

It's not necessarily the listener that's wrong, but I would definitely look into this, thank you.

The problem is that my form values are being cleared after I am redirected to the Stripe checkout page.

A solution would be the card component but I want to use the Stripe checkout page.

#

@carmine current

gaunt onyxBOT
carmine current
#

The problem is that my form values are being cleared after I am redirected to the Stripe checkout page.
When you creat the Checkout Session, are you passing the values that you could collect previously on your website:
https://stripe.com/docs/api/checkout/sessions/create ?

cinder niche
#

Yes, I do. Everything works and is being sent to the database, but after the Stripe checkout page redirect is made, the values get cleared.

carmine current
#

How are you passing these values to Stripe Checkout, I'm not understanding you

#

What values are you expecting to be displayed/not cleared from the Checkout Session ?

cinder niche
#

I am not passing anything to the Stripe checkout, I want my form values to be sent to the db after the payment is successful, but my problem is that the form values are cleared when I get redirected to the Stripe checkout page.

#

@carmine current

carmine current
#

If you are not passing value to Stripe Checkout, so that' should be expected

#

but my problem is that the form values are cleared when I get redirected to the Stripe checkout page.
Can you record a video of this in order to understand your flow/integration?

cinder niche
sharp hatch
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

Just to clarify, the customers fills out a form on your page before being redirected to Checkout? And you want to save these inputs in your own DB? Am I understanding correctly?

cinder niche
#

Thank you Vanya!
I appreciate you.

Uhm yes. So currently without Stripe, when a customer fills in form values the values are sent to the db. Now I added a Stripe checkout with a listener, 'switch' and 'case' as shown in the Stripe docs.

But now when I click on the payment button and I am being redirected to the checkout page all the form values are being cleared because I leave the page.

So my question is, do I have to send these values somewhere so I can use the switch 'payment intent succeeded' and send the form values to the db.

Because the switch is working, and the post to the db is also being made, but the values are just not in there anymore.

#

Let me know if its clear😅

sharp hatch
#

Sure. There's multiple ways to make this work.
When you send a request to create a Checkout Session, you can post the values from your form from your frontend to your backend. Now you have 2 options:

  1. You can already create a pending record in your database with these values, and then redirect the customer to the Checkout. When you receive checkout.session.completed event, you can map it to the database record you created earlier and update it with the new information, e.g. payment completed.
  2. You can use the metadata field of the Checkout Session object to persist the values on the Stripe side. When you receive the checkout.session.completed event, you will be able to access those fields and create a database record. https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata