#maxime-checkout-trigger
1 messages · Page 1 of 1 (latest)
have you tried passing -d customer=cus_123?
It's impossible to use an existing payment intent, Checkout creates this for you
you could also try to look at the fixture for that trigger: https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/checkout.session.completed.json#L56
that is a CLI-only endpoint but you can https://stripe.com/docs/cli/trigger#trigger-skip to skip the first 2 steps and pass an existing cs_test_123 in the last step?
(I haven't tried)
Trying it out...
Are you sure about the "-d"? Here's what I get:
stripe trigger checkout.session.completed -d customer=cus_LamTgTJizArfoB
unknown shorthand flag: 'd' in -d
👋 stepping in here as koopa needs to step away. Give me a moment to catch up
I think you want to use --add here instead. -d would be the cURL flag. https://stripe.com/docs/cli/trigger#trigger-add
So yeah I believe you want stripe trigger checkout.session.completed --add checkout_session:customer=cus_123
The following works fine:
stripe trigger checkout.session.completed --add checkout_session:customer=cus_LamTgTJizArfoB
This sends the webhook for my existing customer. Now can I attach it to an existing payment intent?
Attach what?
PaymentIntents are created automatically via Checkout Sessions
You never create the PI ahead of time
Got it.
I am in a meeting so I should get back to this thread in the next hour.
Sounds good! If it gets archived before you are back then just post in the main channel and ask for it to be re-opened!
When I use the "Create a Session" API, it creates a payment intent automatically (ex: pi_3L5ZGIGNN1T4yZi61bF3o9HT). Now I want to use the stripe CLI to complete this stripe checkout session. I would therefore want to be able to pass this existing payment intent (along with the existing customer id) to the webhook. In other words, I am looking for a way to test (without manual intervention) the scenario where a user completes a stripe checkout session.
BTW: my prefered option would be to have some sort of "Complete Session" API that would be only available in test mode. But unfortunately it does not exist... The stripe CLI looks like the only way to so something close to what we want to do.
Sorry I don't understand. Triggering the checkout.session.completed does exactly what you are saying... it simulates a customer completing a Stripe Checkout Session.
Yes but it creates it for some "randomly created" checkout session. Ex: the product within the checkout session is "comfortable cotton t-shirt" which is not in my Stripe catalog. I would therefore be able to complete the checkout session programatically for a checkout session object that I created myself and not one that was created automatically by the stripe CLI.
You can override the product just like you did with the customer if you want to use one of your products.