#Zomofo

1 messages ยท Page 1 of 1 (latest)

fossil mantleBOT
lusty flume
#

Sure, that's just how it works. The trigger command will create a new Checkout Session under the hood, it'll be completely different to the session you created yourself via the API

#

That's the fixture that event trigger uses. You can see it's created API objects itself, so you can't expect the same ID as the session you're creating

neat plover
#

hmmm...

#

so how can I check metadata, total amount ?

#

it is different

lusty flume
#

Well you would use the --override flag with the trigger command to pass in the metadata fields you want in the event payload:
stripe trigger checkout.session.completed --override checkout_session:metadata.foo=bar

neat plover
#

Do I have to add all data by yourself ?

#

in command?

lusty flume
#

Yes

neat plover
#

I pass unique data when I create checkout session, do I have to pass it every time when I invoke stripe trigger?

#

;o

#

copy, paste to test it locally?

lusty flume
#

If you're creating a Checkout Session directly, why not just use stripe listen and forward those events?

#

No need to trigger anything then

neat plover
#

hmmm I dont understand

#

I create checkout session in such way

    const stripeSession = stripe.checkout.sessions.create({
        payment_method_types: ['card', 'blik', 'p24'],
        line_items: lineItems,
lusty flume
#

You can tell the CLI to forward events that occur on your account, such as checkout.session.completed, that are triggered via API requests

#

There's no need to manually trigger events, via stripe trigger, if you're also making the API request

#

Just do stripe listen --forward-to:http://xxx

neat plover
#

hmm...

#

I create checkout session, it is create in stripe dashboard

lusty flume
#

Then create the Checkout Session, visit the payment page (via url), complete the session and the associated checkout.session.completed event will fire and the CLI will forward it to your local endpoint

neat plover
#

hmmm ok I am checking xD

#

probably it works ๐Ÿ˜„

#

so it is enough to run stripe listen

#

and all events will invoke

#

AND THIS IS GOOOD

#

!!!

#

thanks for help, it seems to work

#

thank you so much

#

could you wish me good luck with my application? I want to be millionare

lusty flume
neat plover
#

--events , yes?

neat plover
#

it woorks ๐Ÿ™‚