Why Stripe renewals never reach Meta, and the invoice.paid fix
Disclosure: I'm on the FloorSync team. We build a paid tool for this problem, but the fix below works without it.
You run Meta ads for a subscription. Stripe says 40 people are paying. Meta Ads Manager credits a handful of purchases, and almost none after month one. The cause is simple: a renewal happens on Stripe's servers, and no browser is there to run your pixel.
Why renewals never reach Meta
The Meta pixel is JavaScript in a page. It fires when a page loads. Look at when subscription money arrives:
- Trial to paid. Day 8, Stripe charges the card. The buyer is asleep. No page loads.
- Every renewal. Same thing, every month. No page loads.
- First checkout, if the buyer doesn't come back to your thank-you page. Checkout runs on Stripe's domain, and a closed tab or an ad blocker means no Purchase.
So the pixel only ever sees a part of the first payments. Meta can't credit what it never hears about.
A public example: a small shop spent $133.88 on Meta ads. Its one real buyer paid with Cash App Pay, the pixel never loaded on the success page, and Meta never saw the sale. The fix in that GitHub issue and PR was a Purchase sent from the Stripe webhook. That is the same fix a renewal needs.
The fix, in five steps
1. Keep the buyer's ids at checkout
When your server creates the Checkout session, read the _fbp and _fbc cookies (or the fbclid in the landing URL) and GA's _ga cookie. Store them with the Stripe customer, in the session metadata or your database. Renewals come later with only a customer id, so this is the only moment you can capture them. Without them Meta matches on hashed email alone.
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{ price: PRICE_ID, quantity: 1 }],
success_url: 'https://example.com/thanks',
cancel_url: 'https://example.com/pricing',
subscription_data: {
metadata: {
fbp: req.cookies._fbp || '',
fbc: req.cookies._fbc || '',
ga: req.cookies._ga || ''
},
},
});
2. Send from the webhook
Handle checkout.session.completed (when payment_status is paid) and invoice.paid, after checking Stripe's signature. Post a Purchase to Meta's Conversions API and the matching event to GA4's Measurement Protocol.
app.post('/stripe/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(req.body, req.headers['stripe-signature'], WEBHOOK_SECRET);
} catch {
return res.sendStatus(400);
}
if (event.type === 'invoice.paid') {
const inv = event.data.object;
await sendPurchase({
eventId: inv.id, // in_...
email: inv.customer_email,
value: inv.amount_paid / 100,
currency: inv.currency.toUpperCase(),
ids: await idsForCustomer(inv.customer), // saved in step 1
renewal: inv.billing_reason === 'subscription_cycle',
});
}
res.sendStatus(200);
});
3. Use the Stripe id as event_id
Use the Checkout session id (cs_...) for the first sale and the invoice id (in_...) for renewals. If the browser pixel also fired, Meta merges the two when they carry the same event_id. In GA4 use the same id as transaction_id.
import crypto from 'node:crypto';
const sha = (s) => crypto.createHash('sha256').update(s.trim().toLowerCase()).digest('hex');
async function sendPurchase({ eventId, email, value, currency, ids, renewal }) {
await fetch(`https://graph.facebook.com/${GRAPH_VERSION}/${PIXEL_ID}/events?access_token=${META_TOKEN}`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
data: [{
event_name: 'Purchase',
event_time: Math.floor(Date.now() / 1000),
event_id: eventId,
action_source: renewal ? 'system_generated' : 'website',
user_data: { em: [sha(email)], fbp: ids.fbp, fbc: ids.fbc },
custom_data: { value, currency },
}],
}),
});
await fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${GA_ID}&api_secret=${GA_SECRET}`, {
method: 'POST',
body: JSON.stringify({
client_id: ids.gaClientId,
events: [{ name: 'purchase', params: { transaction_id: eventId, value, currency } }],
}),
});
}
GRAPH_VERSION is the current Graph API version you use, for example v21.0: check Meta's docs for the one that is live today.
4. Check it in Test Events
In Events Manager, open your pixel, then Test events, and send an event with the test_event_code shown there. You see the match keys Meta read. For GA4, /mp/collect answers 204 whether the event is right or wrong. Send the same body to /debug/mp/collect first: it returns validationMessages.
5. Compare a closed month
Take last month. Count paid Stripe invoices and sum them. Then count Meta purchases and value for the same month and time zone, and look at the gap. Expect Meta to differ a little: it counts what it can attribute to ads, and its attribution windows are its own. A gap of one third or one tenth tells you what to fix. Your own two numbers are the test.
Should renewals go to Meta at all?
Honestly: it depends, and the experts disagree. Tracking Consulting warns that sending every renewal as a new Purchase can inflate your numbers. There's no new ad click behind month five, so old campaigns get credit for money that is just the same customer paying again.
The case for sending them is that the campaigns that bring people who stay should get credit for it, and Meta's optimisation learns from buyers who keep paying.
Our choice at FloorSync is to send a renewal as a Purchase marked system_generated, matched on the ids from the first checkout, with the invoice id as event_id, and to keep new money and renewals apart in the ledger. If you want Meta to see first sales only, skip invoice.paid events whose billing_reason is subscription_cycle. That's one if in your handler. Either way, decide on purpose.
If an AI agent runs your ads
Meta's ads MCP server (open beta since April 29, 2026) lets an agent read performance, edit campaigns and run signal diagnostics. As far as the published comparisons go, it does not send Conversions API events: that stays with the Marketing API. So an agent can see that revenue is missing but can't fix it through that server. It needs a webhook path that sends the events.
Build it, or use a tool
Meta's Conversions API is free. If Meta is your only ad platform and you or your agent can write and maintain the five steps, build it: it's a few hundred lines.
FloorSync does the same steps for $29 a month, with 7 free days. Your webhook passes each verified Stripe event on, and it sends it to Meta and GA4 with the right ids, deduplicated, and keeps every send and its answer in a log. Add ?dry_run=1 and nothing is sent: you get the payloads back.
Try it free, no sign-up: run a renewal through the dry run and see exactly what Meta and GA4 would get: floorsync.towers.app/?from=devto. A free key needs only an email: get one here. The long version of this guide, with the dry run built in, is on our site.
Comments
No comments yet. Start the discussion.