Markdown

Renders Markdown with readable type.

Retry failed charges

The billing worker now retries a declined charge three times over a day before it marks the invoice unpaid. Nothing changes for charges that succeed the first time.

What changed

  1. Read the decline code from the card network.

  2. Schedule the retry with backoff(attempt).

  3. Email the customer only after the last attempt fails.

Retry schedule

AttemptWaitEmails sentShare recovered
11 hournone38%
26 hoursnone21%
324 hoursone9%
export const backoff = (attempt: number) => [Duration.hours(1), Duration.hours(6), Duration.hours(24)][attempt]

Declines for a closed account aren't retried: the card won't work again.


Tests cover each decline code. See the runbook for how to replay a day of retries.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/prose

Usage

import { Prose } from "./ui/uicontext/components/kit/Prose.ts"
export const Reply = <M>(h: Html.H<M>, markdown: string) => Prose(h, markdown)

Examples

Text from a stranger

Raw HTML shows as text, an unsafe link keeps only its words, and a long address wraps.

Hi, the export page shows this when I click the button: <img src=x onerror=alert(1)> I also tried [this workaround](javascript:alert(document.cookie)) from a forum, with no luck. Our callback is https://northwind-freight.example/integrations/webhooks/exports/completed?account=nw-4471&retry=true&signature=7f3a9c2e8b1d4f6a

An answer in a side panel

Tables and code scroll inside their own boxes, so a narrow panel never scrolls sideways.

Three invoices failed last night, all with the same decline code:

InvoiceCustomerAmountCode
INV-2291Halcyon Health$4,120.00do_not_honor
INV-2294Northwind Freight$860.50do_not_honor
INV-2302Juniper Labs$1,975.00do_not_honor
  1. The retry job ran once instead of three times.

  2. Each card was charged with the first attempt's key.

Run them again by hand:

billing retry INV-2291 INV-2294 INV-2302

API reference

Options

Prose options
NameTypeDescription
viewsPartial<Markdown.Views<Message>>Views for more Markdown nodes, or in place of Prose's own, merged over them: CitedProse turns [n] markers in Text into chips this way. Everything not replaced keeps Prose's elements and styles.
plain(text: string) => View.Content | stringWhat text the parser doesn't accept shows as, in place of the text itself
styleStyleStyles laid over Prose's own, such as a larger reading size in a conversation

Accessibility

  • Markdown becomes real paragraphs, headings, lists, quotes and code blocks, so screen readers can move by them.
  • Links open in a new tab. Raw HTML and syntax it doesn't know show as plain text, never as markup.

Source