Payment Flows
Hyperswitch provides flexible payment processing with multiple flow patterns to accommodate different business needs. The system supports one-time payments, saved payment methods, and recurring billing through a comprehensive API design.
One-Time Payment Patterns
Fully Decoupled Flow
Use Case: Complex checkout journeys with multiple modification steps. Useful in headless checkout or B2B portals where data is filled progressively.
Endpoints:
Create:
POST /paymentsUpdate:
POST /payments/{payment_id}Confirm:
POST /payments/{payment_id}/confirmCapture:
POST /payments/{payment_id}/capture(if manual)
Typical progression:
Create intent → returns
payment_id+client_secretUpdate intent (customer, amount, etc.)
Confirm intent → status:
succeeded/requires_captureCapture (if manual) → status:
succeeded
3D Secure Authentication Flow
Use Case: Enhanced security with customer authentication
Additional Fields:
authentication_type: "three_ds"
Status Progression: processing → requires_customer_action → succeeded
Flow summary:
POST /paymentswithauthentication_type: "three_ds"Status:
requires_customer_action+redirect_urlRedirect customer to 3DS page, complete challenge
Resume payment processing →
succeeded
Payment Method Management
Saving Payment Methods
During Payment Creation:
Add
setup_future_usage: "off_session"or"on_session"Include
customer_idResult:
payment_method_idreturned on success
Understanding setup_future_usage:
on_session: Use when the customer is actively present during the transaction (e.g., saving card for faster subsequent checkouts when customer is present).off_session: Use when you intend to charge the customer later without their active involvement (e.g., subscriptions, recurring billing, MITs).
Using Saved Payment Methods
Typical flow:
Initiate: Create payment with
customer_id(POST /payments)List: Get saved cards via
GET /customers/payment_methods(useclient_secret,publishable_key)Confirm: Use selected
payment_tokenin confirm callPOST /payments/{id}/confirm
Result: Payment result after confirmation.
PCI Compliance and payment_method_id
payment_method_idStoring payment_method_id (a token representing the actual payment instrument, which could be a payment token, network token, or payment processor token) significantly reduces your PCI DSS scope. Hyperswitch securely stores the sensitive card details and provides you with this token. While you still need to ensure your systems handle payment_method_id and related customer data securely, you avoid the complexities of storing raw card numbers. Always consult with a PCI QSA to understand your specific compliance obligations.
Recurring Payment Flows
Customer-Initiated Transaction (CIT) Setup
Options:
Option 1 — Setup with Charge:
setup_future_usage: "off_session"amount > 0
Option 2 — Zero Dollar Authorization:
setup_future_usage: "off_session"amount: 0payment_type: "setup_mandate"
These approaches allow creating a setup that can be used for future off-session charges.
Merchant-Initiated Transaction (MIT) Execution
Use Case: Subscription charges, scheduled billing without customer interaction
Required Fields:
off_session: truerecurring_details: { "type": "payment_method_id", "data": "<from_setup>" }
Typical flow:
Trigger billing (subscription/scheduled)
POST /paymentswithoff_session: trueandrecurring_detailsProcess with saved
payment_method_idStatus:
succeeded
Status Flow Summary
(See individual flows above for status progressions; terminal states and capture behaviors summarized below.)
Notes
Terminal states:
succeeded,failed,cancelled,partially_capturedare terminal states requiring no further action.Capture methods supported:
automatic(funds captured immediately),manual(funds captured in a separate step),manual_multiple(funds captured in multiple partial amounts via separate steps), andscheduled(funds captured automatically at a future predefined time).Authentication: 3DS authentication automatically resumes payment processing after customer completion.
MIT Compliance: Off-session recurring payments follow industry standards for merchant-initiated transactions.
Links:
Source page: https://api-reference.hyperswitch.io/v1/payments/payment--flows
Edit on GitHub: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/payments/payment--flows.mdx
Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/payments/payment--flows
Related:
Setup Instructions: https://api-reference.hyperswitch.io/v1/payments/setup--instructions
Payments - Create: https://api-reference.hyperswitch.io/v1/payments/payments--create