Turn failed Stripe payments into owned Pylon tickets

By General Input

When a Stripe charge or invoice payment fails, open a Pylon issue assigned to the account's CSM, tag it for finance review, and post a Slack alert.

Integrations

  • Stripe
  • Pylon
  • Slack

Type

Agentic Task

Categories

  • Finance
  • Customer Support

Build an agent workflow that turns failed Stripe payments into owned, tagged Pylon issues plus a Slack alert, so silent revenue leakage becomes a tracked ticket within minutes.

Trigger: Stripe failed payment events. The workflow should fire on Stripe's Failed Payment event (a charge fails) and on Invoice Payment Failed (a subscription or invoice payment attempt fails). One workflow handling both is fine.

On each failed event, the agent should:

1. Gather Stripe context. Use Stripe's Retrieve Charge to pull the failure reason, amount, currency, and customer id. Use Retrieve Customer to get the customer's email, name, and any metadata. If the event is an invoice payment failure, also use Retrieve Invoice to get the invoice number, hosted invoice URL, and next payment retry date.

2. Look the customer up in Pylon. Use Search Accounts in Pylon, matching first by the customer's email domain or external_id, then by the customer's email address as a fallback. If a match is found, also use List Users in Pylon to resolve the assigned CSM or account owner on that account.

3. Create a Pylon issue. Use Pylon's Create Issue with a clear title like "Failed payment: <customer name> — <amount> <currency>". Add the tag billing-failed-payment (and any account-level tags worth carrying forward). Assign the issue to the matched CSM when there is one, otherwise leave it unassigned and note that explicitly. The description should be a structured block including: customer name and email, Stripe customer id, amount and currency, failure reason and decline code, invoice number and hosted invoice URL if applicable, the next Stripe retry date, and a short draft outreach message the CSM can copy and send (polite, references the failure reason in plain English, suggests updating the card or contacting support). If no Pylon account matched, still create the issue with all of the above inline so the team has full context.

4. Post a Slack alert. Use Slack's Send a Message in the finance or customer success channel (let the user choose at setup time). Keep it short: customer name, amount, failure reason, assigned CSM (or "unassigned, needs triage"), and a link to the new Pylon issue. Bold the amount and the CSM name so it's scannable.

Edge cases to handle: if the customer is self-serve and has no Pylon account, still create the Pylon issue and still post in Slack, flagged as "new contact, no Pylon account." If a Pylon issue already exists for this customer with the billing-failed-payment tag and is still open, add an internal note to that issue with the new failure details instead of opening a duplicate, and mention in Slack that an existing ticket was updated.

Tone for the draft outreach message: warm, direct, no jargon. One paragraph, two or three sentences. No em dashes.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredLet support send one-off Loops emails without an engineerCustomer lifecycle inspector for Loops, Stripe and PostHogChat quality review board for LiveChat support leadsWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downMonth-end Stripe finance pack, stored and shared in SlackNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollments