Skip to content

PaymentSuccess

The sanctioned delight moment.
Implemented
Status
Implemented
Family
3 of 13
Registry
@lopifi/payment-success
npx shadcn@latest add @lopifi/theme @lopifi/payment-success

The component, rendering

Real data, the shipped component. Switch the theme to check the claims the spec makes below.

Preview

The four-layer spec

The sanctioned delight moment. Circle scale → checkmark stroke draw → details fade up, staggered. Total ≤ 700ms. No confetti, no bounce, no sound. Spec.

Shows the amount, the destination, and the arrival estimate — the three things the user needs before they close the screen.

Lifted verbatim from Payments. The doc and this page are the same paragraphs, so they cannot disagree.

What lands in your repository

One component is never one file. Everything below is copied into your project, where you own it.

Files

components/ledger/payment-success.tsx

Lopifi dependencies · 9
cnfigurefiscal-periodformat-moneyiconsmoney.typesreferencetooltipuse-media-query
npm packages
@base-ui-components/reactclsxtailwind-merge
Registry entry
/r/payment-success.json

The whole component

No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.

components/ledger/payment-success.tsx
"use client";

import * as React from "react";
import { useReducedMotion } from "@/hooks/ledger/use-media-query";
import { cn } from "@/lib/ledger/cn";
import { formatDate } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { Figure } from "@/components/ledger/figure";
import { MaskedAccount } from "@/components/ledger/reference";

export interface PaymentSuccessProps extends React.ComponentPropsWithoutRef<"div"> {
  amount: MoneyValue;
  arrivalDate: Date;
  payeeLast4: string;
  payeeName: string;
}

/**
 * The sanctioned delight moment: circle scale → checkmark stroke draw →
 * details fade up, staggered. Total ≤ 700ms. No confetti, no bounce, no sound.
 *
 * Shows the three things a user needs before they close the screen: the
 * amount, the destination, and the arrival estimate.
 */
export const PaymentSuccess = React.forwardRef<HTMLDivElement, PaymentSuccessProps>(
  ({ className, amount, payeeName, payeeLast4, arrivalDate, ...props }, ref) => {
    const reduced = useReducedMotion();
    return (
      <div
        className={cn("flex flex-col items-center gap-4 py-8 text-center", className)}
        ref={ref}
        role="status"
        {...props}
      >
        <svg aria-hidden="true" className="shrink-0" height="64" viewBox="0 0 64 64" width="64">
          <circle
            cx="32"
            cy="32"
            fill="var(--positive-subtle)"
            r="30"
            stroke="var(--positive)"
            strokeWidth="1.5"
            style={reduced ? undefined : { animation: "ledger-enter 240ms var(--ease-out) both" }}
          />
          <path
            d="M20 33 L28.5 41.5 L44 25"
            fill="none"
            stroke="var(--positive)"
            strokeLinecap="round"
            strokeLinejoin="round"
            strokeWidth="3"
            style={
              reduced
                ? undefined
                : {
                    animation: "ledger-draw 280ms var(--ease-out) 200ms forwards",
                    strokeDasharray: 40,
                    strokeDashoffset: 40,
                  }
            }
          />
        </svg>

        <div style={reduced ? undefined : { animation: "ledger-enter 240ms var(--ease-out) 400ms both" }}>
          <p className="text-title-sm font-medium">Payment sent</p>
          <Figure className="mt-2 justify-center" size="lg" value={amount} />
        </div>

        <p
          className="flex flex-wrap items-center justify-center gap-1 text-body text-text-secondary"
          style={reduced ? undefined : { animation: "ledger-enter 240ms var(--ease-out) 480ms both" }}
        >
          To {payeeName} <MaskedAccount last4={payeeLast4} />
          <span aria-hidden="true">·</span> Arrives {formatDate(arrivalDate)}
        </p>
      </div>
    );
  },
);
PaymentSuccess.displayName = "PaymentSuccess";

Also in Payments

See also

A component is specified in one place, defined in another, and running in a third. All three, from here.

Elsewhere in the system

Where PaymentSuccess sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.

Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.

Told when Payments changes

Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.

One address, no list rental, unsubscribe in one click.

Works in your QuickBooks Online or Xero file

Get your books closed every month

Lopifi is building AI bookkeeping that keeps your books closed on US GAAP as transactions happen, with a CPA review every quarter, for $200 a month. We’re not open yet.

$200/month when we open. No card now.