Products · Payment V2

Saved payment methods

Saved cards, a default method and payment history.

Planned, not builtModule 14 of 15

InterfacesAPI SpecSections

API Spec Designed

  • POST/api/payment/v1/payment-methods/setup-intents

    Start saving a card (Stripe SetupIntent). Signed in

    → 201 {client_secret} for Stripe Elements; the card number never reaches our servers.

  • GET/api/payment/v1/payment-methods

    List my saved cards. Signed in

    → 200 {data: [{id, brand, last4, exp_month, exp_year, is_default, expired}]}.

  • PATCH/api/payment/v1/payment-methods/{paymentMethodId}

    Make a card the default. Signed in

    Body {is_default: true} → 200 {payment_method}. Errors: 409 if the card is expired.

  • DELETE/api/payment/v1/payment-methods/{paymentMethodId}

    Remove a saved card (needs recent re-authentication). Signed in

    → 204. Errors: 403 with code: reauthentication_required unless the token's reauth_at is within 5 minutes.

  • POST/api/payment/v1/payments

    Charge a saved card. Service

    Called by an app's server, which sets the amount. Body {user_id, reference, description, amount, currency, payment_method_id?} + Idempotency-Key → 201 {payment, requires_action, client_secret?}. Emits payment.payment.succeeded|failed.

  • POST/api/docflow/v1/batches/{batchId}/pay

    Pay for a batch with my default card in one tap. Signed in

    → 201 {payment_id, requires_action, client_secret?}. DocFlow computes documents × unit price and calls Payment POST /payments.

  • GET/api/payment/v1/payments

    Payment history, newest first. Signed in

    Query cursor, limit → 200 {data: [{id, created_at, reference, description, amount, currency, status, receipt_url}], next_cursor}.

  • GET/api/payment/v1/plans

    The plans with prices and limits. Public

    → 200 {data: [Plan]}.

  • GET/api/payment/v1/subscription

    My plan, status and period end. Signed in

    → 200 {subscription}.

  • POST/api/payment/v1/subscription/checkout

    Start an upgrade. Signed in, session only

    Body {plan} → 201 {checkout_url}. A person always completes payment.

  • POST/api/payment/v1/subscription/cancel

    Cancel at the end of the period. Signed in, session only

    → 200 {subscription}.

  • POST/api/payment/v1/schedules

    Schedule a charge for a user. Service, delegated token

    The app's server sets the amount. Body {reference, description, amount, currency, charge_on, time_zone, payment_method_id?} + Idempotency-Key → 201 {schedule}. Errors: 422 charge_date_out_of_range (past, or more than 90 days ahead), 409 already_paid, 422 no_saved_card.

  • GET/api/payment/v1/schedules

    My scheduled payments, soonest first. Signed in

    Query status, cursor, limit → 200 {data: [Schedule], next_cursor}.

  • PATCH/api/payment/v1/schedules/{scheduleId}

    Change the date or card. Signed in, session only

    Body {charge_on?, payment_method_id?} → 200 {schedule}. Errors: 409 schedule_started.

  • DELETE/api/payment/v1/schedules/{scheduleId}

    Cancel. Signed in, session only

    → 200 {schedule} with status cancelled. Errors: 409 schedule_started.

  • POST/api/docflow/v1/batches/{batchId}/schedule-payment

    Pay for a batch on a date. Signed in

    Body {charge_on, payment_method_id?} → 201 {schedule}. DocFlow computes the amount and calls Payment.

Notes

  • PAYMENT-V2-E13-01 No endpoints.
  • PAYMENT-V2-E13-02 payment_method.attached and detached arrive on POST /api/payment/v1/webhooks/stripe (PAYMENT-V1-E6-02).
  • PAYMENT-V2-E13-06 Payment announces payment.subscription.changed; Identity puts plan in the user's access tokens.
  • PAYMENT-V2-E13-07 Payment announces payment.schedule.charged, .failed and .requires_action to the app that created the schedule (routed by reference, decision on #13).

Coming Soon...

Full inputs, constraints, error codes and sample requests and responses for each endpoint will appear here when this module's design is finalized.