#maxime-checkout-trigger

1 messages · Page 1 of 1 (latest)

sly basin
#

have you tried passing -d customer=cus_123?
It's impossible to use an existing payment intent, Checkout creates this for you

#

(I haven't tried)

sage ivy
#

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

indigo sage
#

👋 stepping in here as koopa needs to step away. Give me a moment to catch up

#

So yeah I believe you want stripe trigger checkout.session.completed --add checkout_session:customer=cus_123

sage ivy
#

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?

indigo sage
#

Attach what?

#

PaymentIntents are created automatically via Checkout Sessions

#

You never create the PI ahead of time

sage ivy
#

Got it.
I am in a meeting so I should get back to this thread in the next hour.

indigo sage
#

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!

sage ivy
#

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.

indigo sage
#

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.

sage ivy
#

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.

indigo sage
#

You can override the product just like you did with the customer if you want to use one of your products.