InterfacesAPI SpecSections
API Spec Designed
- POST
/api/payment/v1/payment-methods/setup-intentsStart 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-methodsList 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:409if the card is expired. - DELETE
/api/payment/v1/payment-methods/{paymentMethodId}Remove a saved card (needs recent re-authentication). Signed in
→
204. Errors:403withcode: reauthentication_requiredunless the token'sreauth_atis within 5 minutes. - POST
/api/payment/v1/paymentsCharge 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?}. Emitspayment.payment.succeeded|failed. - POST
/api/docflow/v1/batches/{batchId}/payPay 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 PaymentPOST /payments. - GET
/api/payment/v1/paymentsPayment 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/plansThe plans with prices and limits. Public
→
200 {data: [Plan]}. - GET
/api/payment/v1/subscriptionMy plan, status and period end. Signed in
→
200 {subscription}. - POST
/api/payment/v1/subscription/checkoutStart an upgrade. Signed in, session only
Body
{plan}→201 {checkout_url}. A person always completes payment. - POST
/api/payment/v1/subscription/cancelCancel at the end of the period. Signed in, session only
→
200 {subscription}. - POST
/api/payment/v1/schedulesSchedule 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/schedulesMy 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 statuscancelled. Errors:409 schedule_started. - POST
/api/docflow/v1/batches/{batchId}/schedule-paymentPay 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-01No endpoints.PAYMENT-V2-E13-02payment_method.attachedanddetachedarrive onPOST /api/payment/v1/webhooks/stripe(PAYMENT-V1-E6-02).PAYMENT-V2-E13-06Payment announcespayment.subscription.changed; Identity putsplanin the user's access tokens.PAYMENT-V2-E13-07Payment announcespayment.schedule.charged,.failedand.requires_actionto 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.