Payment failure follow-up
Your billing system reports failed payments as business events. For each one, send the customer a link to pay, wait a day, remind them once, and hand the case to your collections team if the payment still has not arrived.
Canvas
Section titled “Canvas”Messages go out through an MCP tool on your messaging service, here called send_whatsapp_template.
- Business event: event
payment.failed, correlation keyscustomerRef,invoiceId. Only wheninput.amount > 0. Ignore repeats for6h. - Data mapper:
amountText = str(round(input.amount, 2)). - MCP tool:
send_whatsapp_templatewithto = input.phone,template = "payment_failed_link",amount = amountText,link = input.payLink. Retries 3. - Wait for event: event
payment.received, correlation keyinvoiceId, time out after 24h.received: go to step 7.timeout: go to step 5.
- MCP tool:
send_whatsapp_templatewithtemplate = "payment_reminder". - Wait for event: event
payment.received, correlation keyinvoiceId, time out after 48h.received: go to step 7.timeout: go to step 8.
- End: outcome
paid. - Escalation: queue
Collections, reasonInvoice {{ input.invoiceId }}: {{ amountText }} unpaid after reminders, SLA 24h. - End: outcome
escalated.
Error paths:
- Connect the On error port of the Escalation (SLA passed) to an Error handler that escalates to
Collections leads, then ends with outcomeescalation_overdue. - Connect the On error port of each MCP tool step to an Error handler that escalates to
Collectionsand ends with outcomemessage_failed, so a person contacts the customer instead.
Trigger payload
Section titled “Trigger payload”Your billing system sends this to POST https://api.nuacem.dev/workflow-api/public/v1/events:
{ "eventName": "payment.failed", "eventId": "pay-evt-20931", "correlation": {"customerRef": "C-1001", "invoiceId": "INV-5521"}, "data": { "customerRef": "C-1001", "invoiceId": "INV-5521", "amount": 4999, "phone": "+919800000000", "payLink": "https://pay.example.com/INV-5521" }}When the payment arrives, it sends:
{ "eventName": "payment.received", "eventId": "pay-evt-20977", "correlation": {"invoiceId": "INV-5521"}, "data": {"invoiceId": "INV-5521"}}See Business event.
What each step does
Section titled “What each step does”- The Business event trigger starts one run per failed payment. The event’s
databecomes the run’sinput. Ignore repeats for stops a burst of duplicate failures from messaging the customer twice. - The Data mapper prepares the amount as text for the message.
- Each Wait for event ends early when the matching
payment.receivedarrives, so the customer is not reminded after paying. - The Escalation opens a case for the collections team in Workflows → Tasks and waits until someone marks it done.
Test it
Section titled “Test it”- Open Test workflow and start from the Business event trigger with the event data above. Choose Hours as seconds, and point the MCP tool at a sandbox.
- Let the first wait time out. The reminder step runs.
- In Waiting on you, send
payment.received. The run ends aspaid. - Run again without sending the payment. The escalation appears as a task; complete it to finish the run.
Variations
Section titled “Variations”- Built-in messaging (beta): use Send message with an SMS fallback instead of the MCP tool. Test it end to end in the test window first.
- Call before escalating (beta): add an Outbound call with a collections voice agent, and branch on
completed,no_answer,busyorvoicemail. - Different paths by amount: add a Decision after the trigger, for example to send high amounts straight to a person.
- Remember the issue: Write context
lastPaymentIssuefor the customer, so later runs can check it with Read context.