Testing/automating/mocking orders on Stripe hosted checkout

259 views Asked by At

Is there any way to automate/mock placing an order in stripe hosted checkout in the Stripe test environment?

One can use the Stripe CLI to trigger an event like $ stripe trigger checkout.session.completed but this isn't enough for my use case.

With the event triggers, we don't have control over the data in the checkout session. It's random.

I want to trigger an order completed with defined line items, in a specific currency, with a particular test card, and a destination connect account.

But if I want to do that now, I must manually place the order in my dev environment and go through the test Stripe-hosted checkout flow.

1

There are 1 answers

0
bismarck On

You can use the --add and --override CLI flags to customize your CLI triggered checkout.session.created events. Otherwise, your best bet is to just mock the Session Completed response yourself here.