Skip to content

Stripe Integration

For merchants processing payments through Stripe, EagleSense connects directly to your Stripe account. This closes the feedback loop automatically — payment outcomes, refunds, chargebacks, and issuer early fraud warnings flow to EagleSense without any code on your side — and enables historical backfill without an export project.

  • Automatic outcomes. Transaction statuses, decline reasons, refunds, disputes, and Radar Early Fraud Warnings (issuer TC40/SAFE reports, which arrive 30–60 days before the actual chargeback) update your models continuously.
  • Historical backfill. Your full charge history — amounts, card attributes, outcomes, disputes — imported directly from Stripe. No export files, no engineering work.
  • Shadow mode. With just this integration (no scoring API calls yet), EagleSense scores your live traffic retrospectively so you can evaluate accuracy on your own data before acting on decisions.

In the Stripe Dashboard (Developers → Webhooks), add the endpoint URL provided during onboarding and share the endpoint’s signing secret with us. Select these events:

payment_intent.succeeded payment_intent.payment_failed
charge.succeeded charge.failed
charge.refunded
charge.dispute.created charge.dispute.closed
radar.early_fraud_warning.created
invoice.created invoice.paid
invoice.payment_failed customer.subscription.*

Our endpoint acknowledges instantly and never delays your payment flow.

Step 2: Create a restricted read-only API key

Section titled “Step 2: Create a restricted read-only API key”

In the Stripe Dashboard (Developers → API keys → Create restricted key), grant Read access to: Charges, PaymentIntents, Customers, Disputes, Invoices, Subscriptions, Radar early fraud warnings. Share the key with us. It is used for the historical backfill and a daily reconciliation that repairs any missed webhook deliveries.

This is enough for shadow mode — you can stop here and return for steps 3–4 when you integrate real-time scoring.

Section titled “Step 3: Link scored transactions to Stripe payments”

So that outcomes can be matched to scoring requests, pass the same merchant_transaction_id you send to the Transaction Scoring API into Stripe metadata when your backend creates the PaymentIntent:

metadata[es_transaction_id] = <merchant_transaction_id>
  • If you create the PaymentIntent at payment time — set it at creation.
  • If you create the PaymentIntent earlier (for example at cart stage) — update its metadata any time before confirmation. Metadata is copied into the charge when the charge is created; later updates don’t propagate.
  • Stripe-hosted Checkout: pass the value as client_reference_id when creating the Checkout Session.

This is the only mandatory code change, typically ~10 lines.

Section titled “Step 4: (Recommended) Card attributes at scoring time”

If you use Stripe Elements with the deferred flow, your backend can see card attributes before confirming the payment and include them in the scoring request:

  1. On submit, create a ConfirmationToken (or a PaymentMethod with paymentMethodCreation: 'manual') on the client.
  2. Retrieve it on your backend with your secret key — payment_method_preview.card contains brand, country, funding, and fingerprint.
  3. Pass them in the scoring request. Use Stripe’s card fingerprint as card_id — it is a stable identifier of the card number that Stripe provides without exposing the PAN.

Without this step scoring still works; card attributes then arrive only with the outcome webhook, after the payment.

Renewal invoices (billing_reason = subscription_cycle) are ingested automatically via the invoice events above. If you use custom invoice finalization (webhook handlers on invoice events, auto_advance disabled), mention it during onboarding so renewal scoring is configured around your automation.