Blog
Configure Stripe to POST to your tagging server, set up a Webhook client, and route the events to GA4 and Meta in minutes.
Stripe sends webhook events for every payment, refund, and subscription change. Routing those events through your sGTM container means your conversion tracking does not depend on the user staying on the success page long enough for the client-side tag to fire.
In sGTM, gallery, search "Webhook." Add the client. Configure it to listen on a path like /webhook/stripe. Set the request method to POST.
In Stripe Dashboard, Developers > Webhooks, Add Endpoint. Endpoint URL: https://data.example.com/webhook/stripe. Select the events you want forwarded: typically checkout.session.completed, charge.refunded, customer.subscription.created.
Stripe shows a signing secret. Copy it.
In your Webhook client, add signature verification using the secret. The Stripe signature is in the Stripe-Signature header. The official Webhook client templates handle verification natively; if you wrote a Custom Template, implement HMAC-SHA256 verification using the secret.
Reject any request with a missing or invalid signature with a 401. Without this check, anyone who knows your endpoint can inject fake purchases.
Add a GA4 tag with a trigger on the webhook event. Map the Stripe payload fields:
| Stripe field | GA4 parameter |
|---|---|
| data.object.id | transaction_id |
| data.object.amount_total / 100 | value |
| data.object.currency | currency (uppercased) |
| data.object.customer_email | user_data.email_address |
If your client-side checkout page also fires a purchase event, you now have two sources for the same purchase. Either deduplicate using a shared event_id (use the Stripe payment intent ID), or pick one source and disable the other. For most teams the webhook is more reliable; turn off the client-side purchase event.
Refunds in Stripe arrive as charge.refunded events. Send them to GA4 as a refund event with the negative value. GA4's standard refund event handles this correctly in reports.