Stream Stripe charges to Datadog as business metrics

Every Stripe charge becomes a Datadog metric and a dashboard annotation, so revenue dips show up next to deploys and infra alerts on the same graph.

Deterministic Code
StripeDatadogEngineeringOperationsData SyncNotifications & AlertsResearch & Monitoring
PromptCreate

Build me a deterministic, code-based workflow that pumps Stripe charges into Datadog as live business metrics and dashboard events. No reasoning is needed once the field map is set.

Trigger: a Stripe webhook on the charge.succeeded and charge.failed events.

For each incoming event, parse the Stripe charge payload and extract: charge id, customer id, amount (in the smallest currency unit), currency, payment_method, payment_method_details.type, status (succeeded or failed), and failure_code plus failure_message when present.

Then do these two things in parallel:

1) Call Datadog Submit Metrics (V2) to send two time-series for this charge. First, a counter metric named stripe.charges.count with value 1, tagged with currency, payment_method, and outcome (succeeded or failed). Second, a gauge metric named stripe.charges.amount with value equal to the Stripe amount in the smallest currency unit, tagged with the same currency, payment_method, and outcome. Use the current event timestamp as the metric timestamp.

2) Call Datadog Post an Event with a one-line title describing the charge (for example, "Stripe charge succeeded: 4200 usd" or "Stripe charge failed: card_declined"), a body containing the charge id and customer id (and the failure_code and failure_message if the charge failed), alert_type set to info for succeeded charges and warning for failed charges, and the same currency, payment_method, and outcome tags. This makes each charge appear as an annotation on Datadog dashboards.

The point of the workflow is to let engineering correlate revenue regressions with infra issues on a single Datadog dashboard. Strict field map, no judgment calls in the workflow itself.

Integrations: Stripe (webhook trigger) and Datadog (Submit Metrics V2 and Post an Event).

What does this prompt do?

  • Listens for every successful and failed Stripe charge in real time.
  • Records the charge count and charge amount as live Datadog metrics, broken down by currency, payment method, and outcome.
  • Posts each charge to your Datadog event stream, so it appears as an annotation across infra dashboards.
  • Lets on-call engineers see at a glance whether a revenue drop lines up with a deploy, outage, or latency spike.

What do I need to use this?

  • A Stripe account with permission to send webhooks.
  • A Datadog account, plus an API key and an application key.
  • A Datadog dashboard where you want the revenue graph and event annotations to appear (optional, but where the value shows up).

How can I customize it?

  • Add extra tags by mapping more Stripe fields, like plan name, country, or product id.
  • Expand the trigger to cover refunds, disputes, or invoice payments alongside charges.
  • Set succeeded charges to post as info events and failed charges as warnings, or raise failures to a higher alert level.

FAQs

Will this slow down checkout or affect my customers?
No. The workflow runs after Stripe has already finalized the charge, so payments are never blocked or delayed.
Do I have to install the Datadog agent for this to work?
No. Metrics and events go straight to Datadog through its public API, so there is nothing to install on your servers.
Can I see successful and failed charges on the same chart?
Yes. Both share the same metric name and are tagged with the outcome, so you can stack them, split them, or graph only one.
Does this work with non-US Datadog regions?
Yes. Datadog operates in multiple regions, and you can point the workflow at the EU, US3, US5, AP1, AP2, or GovCloud site when you connect your account.
What happens if a charge event arrives while Datadog is down?
The workflow logs the failure so you can replay the missed events once Datadog recovers, and you can wire retries into the run history.

Related templates

Rank your Intercom queue by what each customer pays you

See every open conversation next to that customer's plan, monthly value and unpaid invoices, so the expensive account never sits waiting all morning.

Intercom
Stripe
App
Catch the trials quietly dying before the card gets charged

Open one desk each morning to see every account still in a trial, ranked by how much money is at stake against how little they have actually used.

Intercom
Stripe
General Input Database
App
Work every open Stripe dispute from one chargeback war room

See every dispute ranked by how little time is left, get a rebuttal drafted from real fraud signals, and submit only what you approve.

Stripe
IPQualityScore
General Input Database
App
Look up any customer's support, billing and CRM in one page

Type a customer email before a renewal call and get their whole support history next to their plan, their invoices and their open deals.

Help Scout
Stripe
HubSpot
App
Investor update studio that builds your board deck monthly

Open one screen each month to see your real numbers, write the commentary yourself, and generate a board deck you can send to investors.

Gamma
Stripe
HubSpot
+1
App
Sell and invoice Ghost newsletter sponsor slots in one board

Replace the sponsorship spreadsheet with a live board of upcoming issues, sold and open slots, real subscriber counts, and paid or unpaid status from Stripe.

Ghost
Stripe
App

Put revenue on the same dashboard as your infra.

Connect Stripe and Datadog once, and every charge flows in as a live metric and a dashboard annotation.