Requirement EPIC
- Epic
- MVP2 · E13 · Payments v2
- Goal
- saved cards, default method and history, without card data touching our servers.
- Stories in this module
- 7
PAYMENT-V2-E13-01 Stripe Customer per user
Size SPayment
- AC1A Stripe Customer is created the first time a user pays or adds a card, and its ID is stored in the Payment service against the user's ID.
PAYMENT-V2-E13-02 Save a card
Size MPayment
- AC1"Add card" on
/account/payment-methods uses a SetupIntent with Stripe Elements. The card number never reaches our servers (PCI SAQ A scope). - AC2At checkout, a "Save this card" checkbox is shown (
setup_future_usage). - AC3Webhooks
payment_method.attached and detached keep the local list in sync.
PAYMENT-V2-E13-03 Manage payment methods
Size MPayment
- AC1I can list cards (brand, last 4, expiry), set the default and remove a card. Removal requires re-authentication (IDENTITY-V2-E8-07).
- AC2An expired card is shown as expired and can't be the default.
PAYMENT-V2-E13-04 One-tap pay with default card
Size MPayment; composed by the DocFlow app
- AC1For a batch, "Pay $X with Visa •• 4242" creates a PaymentIntent with the default card.
- AC2If 3-D Secure is required, the challenge appears in the page and payment completes afterwards (tested with Stripe's 3-D Secure test cards).
- AC3The amount is the number of documents × the unit price, calculated on the server, never taken from the browser.
PAYMENT-V2-E13-05 Payment history
Size SPayment
- AC1
/account/payments lists date, batch or document, amount, status and a Stripe receipt link, newest first, paginated. - AC2Refunded or failed payments show their status clearly.
PAYMENT-V2-E13-06 Free plan and upgrade to paid
Size MPayment (subscriptions), Identity (plan in the token), Gateway (limits per plan)
Decided by Nikhil on 17 Nov 2026 (PR #64): MVP1 limits every user to 10 requests a minute that change something and 60 reads a minute (10 a minute in total with an API key), so the demo cannot be used in batch; MVP2 adds a freemium model with paid upgrades. As a user who has outgrown the free plan, I want to upgrade to a paid plan so I get higher limits without a new account.
- AC1Every user starts on the Free plan, with the MVP1 limits (10 changes and 60 reads a minute; 10 a minute with an API key). Paid plans raise them and allow batch use. The plans and their limits are configuration, not code.
- AC2
/account/plan shows my plan, my usage against its limits, and the paid plans with their prices. Upgrading goes through Stripe Checkout in subscription mode; downgrading or cancelling takes effect at the end of the paid period. - AC3When I reach a limit, the answer says which limit and offers the upgrade, instead of only
429. - AC4The gateway applies the limits of my plan, read from my access token, so no service needs to know about plans.
- AC5A failed renewal returns me to the Free plan after Stripe's retries, and I am emailed through Delivery.
PAYMENT-V2-E13-07 Scheduled payments
Size MPayment (schedules and the daily run); DocFlow offers "Pay on a date"; Delivery sends the reminder and failure notices
As a user, I want to choose the date a payment is taken, for example at the end of the month for all the invoices I processed, so I don't have to pay at the moment I finish.
- AC1Instead of paying now, I can choose a date up to 90 days ahead, in my own time zone, and which saved card to use (my default card unless I pick another,
PAYMENT-V2-E13-03). I see the amount, the date and the card before I confirm. - AC2The day before, I am reminded by my notification settings (
DELIVERY-V2-E14), with a link to change the date, the card, or cancel. - AC3On the date, Payment charges the saved card without me present (an off-session Stripe PaymentIntent). The charge happens once, whatever repeats: the schedule's ID is Stripe's idempotency key.
- AC4If the bank asks for authentication (3-D Secure) or the card is declined, the payment waits as
requires_action or failed, I am notified with a link to complete it or choose another card, and Payment retries a declined card once the next day. Nothing is charged twice. - AC5I can change the date or card, or cancel, until the charge starts. Downloads unlock only when the scheduled payment succeeds, as for any payment.
- AC6The amount is set by the app's server when the schedule is created and cannot change afterwards; a different amount needs a new schedule. A person always sets up, changes and confirms a schedule: an agent can only propose one, through an approval (
IDENTITY-V2-E16-05). - AC7Every schedule, change, cancellation, charge and failure is audited.
All Payment V2 epics and stories on GitHub →