ZapierChecked blueprint6 nodes
Text a customer when a Stripe payment fails
When a card payment fails, send the customer a short SMS with a link to update their card, and post the failure to the billing channel.
Portfolio reference build with demo data and placeholder credentials, not a client deployment.
Pain
Month-end stops being a full matching exercise between Stripe, invoices, and the sheet. The blueprint lists the mismatches.
Solution
When a card payment fails, send the customer a short SMS with a link to update their card, and post the failure to the billing channel.
Impact · From the blueprint
Recovering even two or three lapsed subscriptions a month covers the Zap many times over; no manual chasing.
- Intermediate
- Validated
- Auto path
- Stripe
- Code by Zapier
- Filter by Zapier
- Twilio
- Slack
Library status: passing. Schema, field mapping, task count, and Code-step unit tests pass. Not built in a live Zapier account.

Step inspector
The first step shows the checked-in sample payload.Later steps name the node. They are not a live execution.
Guardrails
- Filter by Zapier · Only continue if...
Credential ids in the JSON are placeholders. These files are portfolio demos.
Deploy this for your business
Tell us this slug and what still happens by hand. We will map it onto your accounts. This page is not a claim that the blueprint already runs for a customer.
README
Portfolio demo by Mustafa (mustafaautomation). Not client work. The people, companies, and numbers in it are made up. Rebuild it in your own Zapier account. Nothing here is connected to anyone's account.
Category: Finance
Difficulty: intermediate
Apps: Stripe, Code by Zapier, Filter by Zapier, Twilio, Slack
Zapier plan: Professional (multi-step Zap: 5 steps after the trigger; Filter by Zapier)
Tasks per run: 4
Test status: passing (schema, mapping scope, task count, Code step unit tests)
Problem
Failed renewals are usually expired cards, not customers leaving. Stripe's dunning emails land in spam, the subscription lapses, and a customer who meant to stay has to start over.
Who it's for
Subscription businesses on Stripe (gyms, clinics, software, memberships) that have customers' mobile numbers and consent to text them.
How the Zap runs
flowchart TD
s1["1. Stripe: New Failed Payment<br/>Payment failed"]
s2["2. Code by Zapier<br/>Format the phone number"]
s1 --> s2
s3{{"3. Filter by Zapier<br/>Only valid mobile numbers"}}
s2 --> s3
s4["4. Code by Zapier<br/>Fit the message into one SMS"]
s3 -->|"passes"| s4
s5["5. Twilio<br/>Send the text"]
s4 --> s5
s6["6. Slack<br/>Post it to #billing"]
s5 --> s6
Build it in the Zapier editor
Zapier has no import file for a Zap like this one, so it is built by hand from the steps below. zap.json is the same Zap in a machine-readable form (schema), and zap.yaml is the same document in YAML.
A value like [2. vendor] means: click the field, open step 2 in the data picker, and choose vendor. Plain text is typed as shown. YOUR_... is a value from your own account.
Before you start
- Turn on the Stripe customer portal and use its login link for
YOUR_BILLING_PORTAL_LINK. - Have these ready from your own accounts:
YOUR_BILLING_PORTAL_LINK,YOUR_BUSINESS_NAME,YOUR_STRIPE_ACCOUNT,YOUR_TWILIO_NUMBER.
Steps
1. Trigger: Payment failed
App: Stripe · Event: New Failed Payment · instant (the app pushes each event to Zapier) · Tasks: 0
Fires when a charge fails.
| Field | Value |
|---|---|
| Account | YOUR_STRIPE_ACCOUNT |
Fields this library maps from the trigger: charge_id, customer_id, customer_name, customer_email, customer_phone, amount, currency, failure_message, created. Zapier shows them with its own labels; pick the one with the same meaning.
2. Action: Format the phone number
App: Code by Zapier · Event: Run JavaScript · Tasks: 1
Turns whatever the customer typed at checkout into E.164 so Twilio accepts it, and rejects numbers too short to be real.
Paste the whole of code/normalize-phone.js into the code box. Source: content/code/normalize-phone.cjs. Unit tests: content/code/normalize-phone.test.cjs.
| Input Data key | Value |
|---|---|
phone | [1. customer_phone] |
default_country | 1 |
Returns: e164, valid, extension.
3. Filter: Only valid mobile numbers
App: Filter by Zapier · Event: Only continue if... · Tasks: 0
Customers without a usable number still appear in Slack via Stripe's own emails; the text step needs a number.
Only continue if: [2. valid] (Boolean) Is true.
Most runs pass this filter.
4. Action: Fit the message into one SMS
App: Code by Zapier · Event: Run JavaScript · Tasks: 1
Fills the first name and link and trims to one GSM-7 segment, so it costs one message and arrives in one piece.
Paste the whole of code/fit-sms.js into the code box. Source: content/code/fit-sms.cjs. Unit tests: content/code/fit-sms.test.cjs.
| Input Data key | Value |
|---|---|
template | Hi {first_name}, your payment to {business} did not go through, usually an expired card. You can update it here: {link} |
first_name | [1. customer_name] |
business | YOUR_BUSINESS_NAME |
link | YOUR_BILLING_PORTAL_LINK |
Returns: message, encoding, length, segments, trimmed.
5. Action: Send the text
App: Twilio · Event: Send SMS · Tasks: 1
One message, sent from your Twilio number.
| Field | Value |
|---|---|
| From Number | YOUR_TWILIO_NUMBER |
| To Number | [2. e164] |
| Message | [4. message] |
| Send Large Messages? | No |
Later steps can map: sid, status.
6. Action: Post it to #billing
App: Slack · Event: Send Channel Message · Tasks: 1
The team sees which customers were contacted and why the card failed.
| Field | Value |
|---|---|
| Channel | #billing |
| Message Text | Payment failed for [1. customer_name] ([1. amount] [1. currency]): [1. failure_message]. Texted [2. e164]. |
| Send as a bot? | Yes |
| Bot Name | Zap alerts |
| Include a link to this Zap? | No |
Later steps can map: ts, permalink.
Test it
Use sample-trigger.json as the test record. For an instant or webhook trigger, send it to the trigger once; for a polling trigger, create a matching record in the app and click Test trigger. Then test each step in order and read its output before you turn the Zap on.
{
"charge_id": "ch_3QEXAMPLE12ef",
"customer_id": "cus_REXAMPLE4471",
"customer_name": "Sam Reyes",
"customer_email": "sam.reyes@mailbox.example",
"customer_phone": "(415) 555-0163",
"amount": "49.00",
"currency": "usd",
"failure_message": "Your card has expired.",
"created": "2026-11-24T06:00:12Z"
}
Plan and task usage
| Step | App | Tasks |
|---|---|---|
| 1. Payment failed | Stripe | 0 |
| 2. Format the phone number | Code by Zapier | 1 |
| 3. Only valid mobile numbers | Filter by Zapier | 0 |
| 4. Fit the message into one SMS | Code by Zapier | 1 |
| 5. Send the text | Twilio | 1 |
| 6. Post it to #billing | Slack | 1 |
A typical run uses 4 tasks. Zapier does not charge tasks for triggers, Filter, Paths, Formatter, Delay, Looping, Digest, Storage, or Zapier Tables steps. AI by Zapier is counted here as 1 task; Zapier prices it by model tier, so a larger model can cost more.
Minimum plan: Professional, because of: multi-step Zap: 5 steps after the trigger; Filter by Zapier. The Free plan only runs two-step Zaps (a trigger and one action) and leaves out Filters, Paths, Formatter, webhooks, AI by Zapier, and premium apps.
Customize
- Change
default_countryto your calling code (44, 61, 92) if most customers are outside North America. - Add a Delay For 1 hour first, so a customer who retries straight away is not texted.
Limits
- Only text customers who agreed to receive texts; carriers and local law (for example TCPA in the US) require consent.
- Twilio charges per message on your own account.
Time saved
Recovering even two or three lapsed subscriptions a month covers the Zap many times over; no manual chasing.
Files
| File | What it is |
|---|---|
zap.json | The Zap, step by step, in schema 1.0.0. |
zap.yaml | The same document in YAML. |
sample-trigger.json | Fictional trigger record for the first test. |
diagram.png | The step list, drawn like the Zapier editor. |
code/normalize-phone.js | Paste-ready Code by Zapier step. |
code/fit-sms.js | Paste-ready Code by Zapier step. |