#Yang MR - redirectToCheckout

1 messages · Page 1 of 1 (latest)

sly tartan
#

Hi there. One moment while I catch up here

mild oak
#

I'm doing E2E testing so I don't have much agency over such a change

#

If stripe.redirectToCheckout() is indeed used, how does the process of getting a URL and redirecting work?

sly tartan
#

It just calls stripe to create a checkout session and redirects to the session url provided

mild oak
#

How does the process work though? Does it send a POST request to a specific URL?

#

And I presume that the function redirects locally based on the URL returned from the Stripe API?

sly tartan
#

What are you trying to do here?

mild oak
#

Intercept the POST return to prevent it from actually redirecting since that breaks the test

sly tartan
#

With automated testing flows, we highly discourage calling the Stripe API as those calls unnecessarily put load on the API and contribute to rate limits. Instead, we recommend stubbing out or mocking calls where necessary

mild oak
#

How do you mean by stubbing calls?

sly tartan
#

It's a standard automated testing practice. I recommend googling

mild oak
#

Yes, but which calls? Those to the API? If so, then the rest of the stuff like the webhook can't exactly be tested

sly tartan
#

I'm talking about automated testing

#

Many calls made to the Stripe API in small amounts of time

#

Not talking about testing webhooks

mild oak
#

For the automated testing there would be very few API calls made

mild oak