Stripe payment failed notifications on your phone.

Get a High-priority push notification when a Stripe payment attempt fails, including the decline reason.

payment_intent.payment_failedFinancePayments Signature verified
How it works

Three steps to your first push

STEP 01

Install the recipe

One click in Studio gives you a personal webhook URL.

STEP 02

Paste your URL into Stripe

Add it as a webhook for payment_intent.payment_failed.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Stripe payment_intent.payment_failed webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. In the Stripe Dashboard, open Workbench > Webhooks and click Add destination.
  3. Select the payment_intent.payment_failed event and choose Webhook endpoint.
  4. Paste your webhook URL as the endpoint URL and save.https://••••••••/•••••••• your personal URL, shown after install
  5. Reveal the signing secret (whsec_…) and copy it into JustPush.
The code

What runs when the webhook arrives

Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.

transform.js
1// Stripe → payment_intent.payment_failed
2// Fires when a payment attempt fails.
3// Docs: https://docs.stripe.com/api/events/types
4//
5// Paste this into a JustPush Studio integration and add a Stripe webhook destination
6// for the "payment_intent.payment_failed" event pointing at the integration's endpoint URL.
7
8// Stripe amounts are in the currency's smallest unit (cents), except for
9// zero-decimal currencies such as JPY, where 500 means ¥500.
10const ZERO_DECIMAL = new Set([
11 "bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga",
12 "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf",
13])
14
15function money(amount, currency) {
16 // Don't invent a figure when the event doesn't carry one.
17 if (typeof amount !== "number" || !Number.isFinite(amount) || !currency) return null
18
19 const code = String(currency).toLowerCase()
20 const value = ZERO_DECIMAL.has(code) ? amount : amount / 100
21
22 try {
23 return new Intl.NumberFormat("en-GB", { style: "currency", currency: code }).format(value)
24 } catch {
25 return `${value} ${code.toUpperCase()}`
26 }
27}
28
29// Test-mode objects live under /test in the Dashboard.
30function dashboardUrl(event, path) {
31 return `https://dashboard.stripe.com/${event.livemode ? "" : "test/"}${path}`
32}
33
34function handleRequest(request) {
35 const event = request.body
36
37 // Guard: only handle this event type, so other Stripe events on this integration stay quiet.
38 if (event?.object !== "event" || event.type !== "payment_intent.payment_failed" || !event.data?.object) {
39 console.log(`Ignoring Stripe event "${event?.type ?? "unknown"}"`)
40 return null
41 }
42
43 const payment = event.data.object
44 const amount = money(payment.amount, payment.currency) ?? "A payment"
45 const who = payment.receipt_email ? ` from ${payment.receipt_email}` : ""
46 const reason = payment.last_payment_error?.message
47
48 return {
49 title: "🚫 Payment failed",
50 message: `${amount}${who}` + (reason ? ` — ${reason}` : ""),
51 topic: "Stripe",
52 priority: 1, // High — a customer tried to pay and couldn't
53 buttons: [{ cta: "View payment", url: dashboardUrl(event, `payments/${payment.id}`) }],
54 }
55}
Payload

The Stripe payment_intent.payment_failed webhook

This is what Stripe sends to your URL for payment_intent.payment_failed. It is a sample, trimmed to the fields recipes use.

payment_intent.payment_failed · sample.json
1{
2 "id": "evt_test_payment_failed",
3 "data": {
4 "object": {
5 "id": "pi_test_3Qx9Z8",
6 "amount": 12900,
7 "object": "payment_intent",
8 "status": "requires_payment_method",
9 "currency": "eur",
10 "customer": "cus_test_R2d2",
11 "receipt_email": "[email protected]",
12 "last_payment_error": {
13 "code": "card_declined",
14 "type": "card_error",
15 "message": "Your card has insufficient funds.",
16 "decline_code": "insufficient_funds"
17 }
18 }
19 },
20 "type": "payment_intent.payment_failed",
21 "object": "event",
22 "created": 1790584200,
23 "livemode": false,
24 "api_version": "2025-09-30.clover"
25}
Security

How the Stripe signature is verified

Stripe-Signature

Stripe signs every webhook with a timestamped HMAC-SHA256 signature in the Stripe-Signature header, made with your endpoint's signing secret. Add the secret to the recipe in Studio and JustPush checks every request before your code runs, so requests that don't come from Stripe never reach your phone.

FAQ

Stripe payment failed notifications: questions

Does this work on iPhone and Android?

Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.

Do I need to write code?

No. Install the recipe in Studio, paste your webhook URL into Stripe and you are done. The code is there if you want to change the text, the sound or the buttons.

Can I change what the notification says?

Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.

What does it cost?

JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.

Ready when you are

Stripe on your phone in two minutes.

Install the recipe, paste one URL, done. Free for 30 days, no credit card required.