#Branko
1 messages · Page 1 of 1 (latest)
👋 Thanks for reaching out
You can trigger simulated event using Stripe CLI:
https://stripe.com/docs/cli/trigger
For example, in order to trigger an payment_intent.succeeded event:
stripe trigger invoice.payment_intent.succeeded
https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded
I would like to fire google analytics event after successful payment, can I do that on the client side?
Here we answer Question about Stripe, but for Google Analytics I think you can refer to this link:
https://support.google.com/tagmanager/answer/7679219?hl=en ... something like this: dataLayer.push({'event':'event_123'});
ok so let me clarify the issue, I am aware that its probably confusing.
after stripe.confirmPayment method I would like to fire google analytics code, since stripe is doing hard reload on successful payment I dont see any viable options for that on client side.
In the codesnippet, you shared above you set a comment // not reached , that mean your app is stuck in stripe.confirmPayment call or what is the issue ?
its not stuck, after successful payment nothing below .confirmPayment method is reached
hard realod is done instead to the redirect_url param
So you don't want to be redirected? if that could help, I suggest you to set redirect: "if_required" so that the user will only redirect if he chooses a redirect-based payment method.
https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-redirect
Or simply trigger the Google Analytic event just before the function call stripe.confirmPayment
that event should be only fired when confirmPayment resolves successfully. I guess it can not be done on the client side, or at least it can be done on the receipt page
that event should be only fired when confirmPayment resolves successfully
So yeah you can do it on the receipt/success page then