#belltyler
1 messages · Page 1 of 1 (latest)
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.
If the above doesn't get you oriented in the right direction, can you describe exactly what you're testing for?
Thanks for the link - I came across that a few weeks ago but unfortunately the solution no longer works. It seems that when that article was made Stripe allowed the checkout to work within an iFrame.
Here's a quick loom video showing what my team is trying to test.
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
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