#belltyler

1 messages · Page 1 of 1 (latest)

timid walrusBOT
fickle badge
#

Hi there 👋 Sorry for the wait. Looking at your question now

#

End-to-end testing via Checkout is a bit of a challenge, since Checkout is Stripe-hosted (and for the reason you specified above). I don't have a lot of context on the right path, but since you mentioned you use Cypress, I did manage to find this article: https://javascript.plainenglish.io/how-to-test-your-stripe-checkout-with-cypress-972a663b33f7

Disclaimer: I haven't vetted it and it is 1 year old, so handle with care.

Medium

In this article, we will look into how we can test a website that uses Stripe Checkout bringing more testing to your eCommerce!

#

If the above doesn't get you oriented in the right direction, can you describe exactly what you're testing for?

hard cosmos
fickle badge
#

Ah, okay. This might be a bit out of my purview, but let me check with a colleague to see if anyone has any ideas.

#

Will circle back in a few minutes

fickle badge
#

Alright, so the short answer is: there isn't a good way to do automated testing using Checkout. That much you probably already know though. The alternative methods would be to essentially "mock" what Checkout is doing and perform a regular redirect to whatever your success_url would contain. So, for example, if you're testing a Checkout Session that creates a new Customer A and Charges them for Price A on Product A, and redirects the customer to <some_success_url>?sessionId=cs_abc123&customer=cus_abc123, then you could just create Customer A, Price A, and Product A separately. Once you did that, you would create a Payment Intent with Product A and Price A and auto-advance it to completion the way Checkout does, then build the URL you need (using data from all the above Stripe objects) programmatically before redirecting to trigger whatever is supposed to happen after that.

If you're relying on more than the redirect (e.g. your integration is listening for Checkout webhook events), then I might be able to assist more with questions related to that side of things.

#

Sorry, I know that's a lot, so feel free to pop up with more questions