WhatsApp Payment Confirmations from Stripe Using Webhooks
Stripe fires a webhook event for every payment outcome that matters — succeeded, failed, refunded, disputed. Most of that signal only ever reaches an email inbox or a Slack channel your customer never sees. Routing the same events straight to WhatsApp gets a confirmation in front of the person who actually paid, in the channel they already have open, within seconds of the charge clearing. Here's how to wire Stripe to TextMeFlow directly, without a third-party connector app.
Why go straight from Stripe to the API
A generic "WhatsApp for Stripe" integration usually means another subscription, another dashboard, and another vendor holding your payment data. Stripe's own webhooks already carry everything you need — amount, currency, customer, payment method — so a small receiver that forwards the relevant fields to TextMeFlow's messages API costs nothing beyond your existing plan's message quota. You keep full control over the copy, the trigger logic, and which events actually warrant a message.
Step 1: Subscribe to the events you care about
In the Stripe Dashboard under Developers → Webhooks, add an endpoint and select only the events that need a customer-facing message:
payment_intent.succeeded→ payment confirmationpayment_intent.payment_failed→ failed-charge alert (card declined, insufficient funds)charge.refunded→ refund confirmation
Resist the urge to subscribe to every event type Stripe offers. Each one you don't act on is dead weight your receiver has to filter, and a bloated event list makes debugging harder when something goes wrong.
Step 2: Verify and parse the webhook
Stripe signs every payload with a Stripe-Signature header. Verify it before trusting the body — the same discipline you should already apply to TextMeFlow's own webhook signatures on the way back to your app.
app.post('/webhooks/stripe', express.raw({ type: 'application/json' }), (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(
req.body,
req.headers['stripe-signature'],
process.env.STRIPE_WEBHOOK_SECRET
);
} catch (err) {
return res.status(400).send(`signature verification failed: ${err.message}`);
}
if (event.type === 'payment_intent.succeeded') {
const pi = event.data.object;
const phone = pi.metadata?.customer_phone;
if (phone) sendPaymentConfirmation(phone, pi);
}
res.status(200).send('ok');
});
Stripe's payment_intent object doesn't carry a phone number by default — you have to put one there yourself, typically by attaching it as metadata when you create the PaymentIntent at checkout. If your checkout form doesn't collect a phone number, this pattern simply won't have anything to send to; plan for that at checkout, not in the webhook handler.
Step 3: Send the confirmation
curl -X POST https://api.textmeflow.eu/v1/messages \
-H "Authorization: Bearer $TEXTMEFLOW_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+32470123456",
"text": "Hi Sarah, we received your payment of €49.00 for invoice #INV-2091. Thanks for your business!"
}'
For a failed charge, keep the tone practical rather than alarming — "your payment could not be processed, please check your card details and try again" gets a better response than anything that reads like a warning. If you invoice separately, the same endpoint accepts attachments up to 100 MB, so a PDF receipt can go out in the same call as the text.
Step 4: Stay inside the anti-spam rules
A payment confirmation is transactional — one personalized message triggered by one customer's own action — so it doesn't touch the broadcast-style triggers in TextMeFlow's anti-spam risk scoring. Two things still matter for a Stripe integration specifically:
- Don't retry blindly. Stripe retries failed webhook deliveries on its own schedule; if your receiver also retries on top of that, you risk sending the same confirmation twice. Use the event
idto deduplicate before calling the messages API. - Respect STOP. If a customer previously opted out of WhatsApp, a new payment doesn't override that — TextMeFlow rejects sends to opted-out numbers regardless of how the trigger arrived.
What this gets you over email receipts
Stripe already emails a receipt automatically, so the WhatsApp message isn't replacing that — it's what the customer actually reads within the first few minutes. Delivery and read receipts land back on TextMeFlow's own webhook, so you know whether the confirmation was seen, not just sent. This same pattern extends to any billing event Stripe can fire a webhook for: subscription renewals, upcoming trial-end reminders, or a dunning message before a card expires.
Start free on TextMeFlow — 50 messages a month, no time limit, enough to wire up and test a full payment-confirmation flow before you commit to a plan.
Zelf WhatsApp-berichten versturen via API?
Gratis voor altijd tot 50 berichten/maand. QR scannen en binnen 5 minuten verstuur je je eerste bericht.
Gratis voor altijd