---
title: 'Meta CAPI + Stripe Webhooks: Checkouts & Renewals (2026)'
description: 'Track Stripe checkouts and subscription renewals in Meta CAPI without double-counting. Covers _fbp/_fbc metadata, Pixel event_id dedup, and MIT Node.js starter.'
canonical: 'https://plainrouter.com/library/meta-capi-stripe-webhooks'
format: Guide
last_updated: '2026-12-04'
---

Tracking SaaS checkouts and subscription renewals with only a browser [Meta Pixel](</library/meta-pixel>) misses two huge slices of revenue: blocked or abandoned thank-you-page loads, and recurring subscription invoices that never happen inside a browser at all. Forwarding verified Stripe webhooks to the [Meta Conversions API](</library/meta-conversions-api>) fixes both, as long as you pass consented \_fbp and \_fbc cookies through Stripe metadata and guard against double-counting initial subscription payments.

## The clean Stripe -\> Meta CAPI architecture (initial vs renewal)

Treat initial Stripe checkouts and recurring subscription renewals as two distinct paths so you never double-count month-one revenue:

- **Initial payment (checkout.session.completed): **Fire a server-side Purchase event with action\_source: 'website' and a deterministic event\_id (for example, order\_\<uuid\> or stripe\_cs\_\<session\_id\>). Fire the exact same event\_id in your thank-you page Pixel's 4th argument so Meta deduplicates browser and server copies cleanly.
- **Initial subscription invoice (invoice.paid where billing\_reason === 'subscription\_create'): **Skip forwarding this event if checkout.session.completed already reported the initial Purchase. Forwarding both doubles your reported acquisition revenue.
- **Recurring renewal (invoice.paid where billing\_reason === 'subscription\_cycle'): **Forward server-only as Subscribe (or a dedicated renewal event) with action\_source: 'system\_generated' and event\_id: stripe\_inv\_\<invoice\_id\>. Because no browser session exists during a renewal, there is no Pixel counterpart.

## Step 1: Pass consented \_fbp, \_fbc, and event\_id into Stripe Checkout metadata

Stripe webhooks arrive on your backend with no browser cookie jar. If you only send customer email, you leave click-level attribution on the table. When your server creates the Stripe Checkout Session, read the consented \_fbp and \_fbc cookies from the incoming request and store them in both metadata and subscription\_data.metadata:

`` const eventId = `order_${crypto.randomUUID()}`;

const session = await stripe.checkout.sessions.create({
  mode: 'subscription',
  success_url: `https://yourdomain.com/thanks?event_id=${encodeURIComponent(eventId)}`,
  metadata: {
    event_id: eventId,
    fbp: req.cookies._fbp || '',
    fbc: req.cookies._fbc || '',
    event_source_url: 'https://yourdomain.com/pricing',
  },
  subscription_data: {
    metadata: {
      fbp: req.cookies._fbp || '',
      fbc: req.cookies._fbc || '',
    },
  },
  line_items: [{ price: 'price_123', quantity: 1 }],
}); ``

On your /thanks page, pass the exact same event\_id into the 4th argument of fbq('track', 'Purchase', \{ value, currency \}, \{ eventID: eventId \}) so browser and webhook copies deduplicate cleanly.

## Step 2: Verify Stripe-Signature and map CAPI user\_data strictly

Always verify the raw request bytes against Stripe's Stripe-Signature HMAC-SHA256 header using constant-time comparison before parsing JSON. Then apply Meta's exact CAPI formatting rules:

- **Hash PII with lowercase SHA-256: **Trim and lowercase email (em), strip non-digits from phone (ph), lowercase first/last name (fn, ln), postal code (zp), country, and external\_id (Stripe customer ID) before SHA-256 hashing.
- **Keep \_fbp and \_fbc raw and unhashed: **Never SHA-256 hash fbp or fbc, and validate that they start with fb.1. before attaching them to user\_data.
- **Convert Stripe minor units carefully: **Divide two-decimal currencies like USD and EUR by 100 (4900 -\> 49.00), but keep zero-decimal currencies like JPY and KRW intact (5000 -\> 5000).
- **Use integer Unix seconds for event\_time: **Stripe's event.created field is already in Unix seconds, matching Meta CAPI's requirement (never JavaScript milliseconds).

## Clone the working zero-dependency starter repo

You do not need to write this boilerplate from scratch. Clone our open-source MIT-licensed reference implementation at [github.com/plainrouter/meta-capi-stripe-starter](<https://github.com/plainrouter/meta-capi-stripe-starter>). It includes zero-dependency Stripe HMAC-SHA256 verification, checkout.session.completed and invoice.paid mapping, zero-decimal currency handling, accidental-hash protection for \_fbp/\_fbc, and 6 passing Node unit tests.

## Step 3: Validate payloads and EMQ before pointing production webhooks

- [1\. Check Event Match Quality locally: ](</tools/meta-emq-checker>)Paste a logged CAPI payload from your webhook handler into the free Meta EMQ Checker to verify match-key coverage and ensure \_fbc/\_fbp stayed unhashed.
- [2\. Check JSON schema and event\_time: ](</tools/meta-capi-payload-validator>)Run the payload through the Meta CAPI Payload Validator to catch millisecond timestamps, wrong currency codes, or malformed user\_data arrays.
- [3\. Verify Pixel + webhook deduplication: ](</tools/event-id-dedup-checker>)Pair your /thanks fbq() call with your checkout.session.completed CAPI JSON in the Meta Pixel & CAPI Dedup Checker to confirm exact event\_id equality.

## Frequently asked questions

### Why can't Meta Conversions API Gateway track Stripe renewals?

Conversions API Gateway mirrors browser Meta Pixel requests. Recurring Stripe invoice.paid events run asynchronously on Stripe's servers with no shopper browser session, so a browser-mirror Gateway never sees them. See [Meta Conversions API Gateway (CAPIG): how it works, AWS cost, and limits](</library/meta-conversions-api-gateway>) for the full comparison.

### Should I send subscription renewals as Purchase or Subscribe?

Most SaaS teams send the initial checkout as Purchase (or StartTrial for trials) and recurring subscription\_cycle invoices as Subscribe (or a custom RecurringPayment event) so Meta's acquisition bidding stays anchored on new customers rather than conflating month-6 renewals with new signups.

### What if a user pays via Stripe Payment Link without visiting my custom checkout endpoint?

With hosted Payment Links you cannot inject \_fbp/\_fbc into metadata unless you append client\_reference\_id on the link URL. In that case, rely on hashed email, phone, name, billing address, and external\_id (Stripe customer ID) from the webhook payload to maximize server-side match quality.

### When should I use Plainrouter instead of maintaining my own Stripe webhook relay?

Use a custom starter script if you only need a minimal webhook forwarder and want to own retries, consent enforcement, and logging yourself. Use [Plainrouter for SaaS](</solutions/saas>) when you want managed first-party browser + backend conversion delivery, event-level Meta delivery logs, independent arrival counts, and governed Meta Ads MCP (Ask, Custom, and Full modes) starting free up to $300/mo in ad spend.

## Related guides and tools

- [plainrouter/meta-capi-stripe-starter (GitHub)](<https://github.com/plainrouter/meta-capi-stripe-starter>): open-source zero-dependency Node.js Stripe webhook to Meta CAPI starter with unit tests.
- [Meta Conversions API in Next.js App Router](</library/meta-capi-nextjs-setup>): pair your Next.js frontend Pixel and \_fbp/\_fbc middleware with backend CAPI.
- [Meta EMQ Checker (free tool)](</tools/meta-emq-checker>): estimate Event Match Quality and verify SHA-256 vs unhashed fields locally.
- [Meta Conversions API Gateway (CAPIG)](</library/meta-conversions-api-gateway>): why browser-mirror Gateways miss Stripe and CRM backend conversions.
