Machine Learning pathway increased my salary by 40%
Payment Processing: Authorization, Capture, Clearing and Settlement
Complete payment processing lifecycle from authorization through settlement with architectural patterns
Payment processing lifecycle consists of four stages: authorization (verify funds and place hold), capture (finalize the transaction), clearing (exchange transaction details between banks), and settlement (actual fund transfer). Authorization is real-time (1-3 seconds). Capture can be same-day or delayed. Clearing is batch or real-time. Settlement takes T+1 for cards, T+0 for UPI. Each stage has specific architectural requirements for state management, error handling, and reconciliation.
The payment processing lifecycle is the sequence of steps from payment initiation to final settlement. Understanding this lifecycle is fundamental to building payment systems. The four main stages are authorization, capture, clearing, and settlement.
Each stage has specific architectural requirements: authorization requires real-time processing, capture requires state management, clearing requires inter-bank communication, and settlement requires fund transfer and reconciliation.
This topic provides a comprehensive guide to the payment processing lifecycle, including state machine design, exception handling, and rail-specific differences.
The payment processing lifecycle is the sequence of stages a payment transaction goes through from initiation to final settlement: authorization (verify funds and place hold), capture (finalize the transaction), clearing (exchange transaction details between banks), and settlement (actual fund transfer). Each stage has specific participants, protocols, and timelines.
Understanding the payment lifecycle is essential for building reliable payment systems. Each stage has different failure modes, timing requirements, and reconciliation needs. Incorrect lifecycle management leads to failed payments, lost funds, and reconciliation issues.
For payment engineers and architects, the lifecycle is the foundation of payment system design. State machines, error handling, and reconciliation all revolve around the lifecycle stages.
In 2026, the payment lifecycle is evolving with real-time clearing and settlement. Traditional batch clearing is being replaced by real-time clearing in some rails. Settlement is moving from T+1 to T+0 or instant.
The lifecycle is also being extended with new stages: pre-authorization, partial capture, split settlement, and programmable settlement conditions.
Payment processing lifecycle:
Reference Architecture
Authorization verifies funds and places a hold. Capture finalizes the transaction. Clearing exchanges details between banks. Settlement transfers funds. Reconciliation verifies consistency.
| Stage | Participants | Timeline |
|---|---|---|
| Authorization | Merchant, Acquirer, Network, Issuer | Real-time (1-3 seconds) |
| Capture | Merchant, Acquirer | Same-day or delayed |
| Clearing | Acquirer, Network, Issuer | Batch (daily) or real-time |
| Settlement | Acquirer, Issuer, Banks | T+1 cards, T+0 UPI |
| Reconciliation | Merchant, Acquirer, Bank | Daily |
Detailed payment lifecycle:
Lifecycle Flow
The customer initiates payment. Authorization request goes to issuer. If approved, a hold is placed on funds. Merchant provides service. Capture request finalizes the transaction. Clearing exchanges details. Settlement transfers funds. Reconciliation verifies.
Payment lifecycle technical architecture:
Payment state machine: created → authorized → captured → cleared → settled. Exception states: failed, refunded, disputed.
Real-time processing with sub-second response. Fraud check, balance verification, hold placement.
Finalize authorized transaction. Can be partial (e.g., restaurant tip adjustment). Same-day or delayed.
Exchange transaction details between acquirer and issuer. Batch (daily) or real-time (newer rails).
Actual fund transfer between banks. T+1 for cards, T+0 for UPI. Net settlement or gross settlement.
Match transactions across merchant, acquirer, and bank. Identify and resolve discrepancies.
Payment lifecycle APIs:
POST /payments to authorize. Response includes authorization code and hold amount.
POST /payments/{id}/capture to finalize. Can specify capture amount (partial capture).
POST /payments/{id}/refund to return funds. Full or partial refund.
POST /payments/{id}/void to cancel an authorized but not captured payment.
/v1/paymentsAuthorize a payment
Request
POST /v1/payments
Idempotency-Key: auth_001
Authorization: Bearer sk_live_xxx
{
"amount": 4999,
"currency": "INR",
"payment_method": "card",
"card": { "token": "tok_xxx" },
"capture": false
}Response
{
"id": "pay_26JAnXxXx",
"status": "authorized",
"authorization_code": "AUTH123",
"authorized_amount": 4999
}/v1/payments/{id}/captureCapture the authorized payment
Request
POST /v1/payments/pay_26JAnXxXx/capture
Idempotency-Key: cap_001
{
"amount": 4999
}Response
{
"id": "pay_26JAnXxXx",
"status": "captured",
"captured_amount": 4999
}Payment lifecycle data:
| Data | Purpose | Storage |
|---|---|---|
| Transaction State | Current state in lifecycle | PostgreSQL (ACID) |
| Authorization | Auth code, hold amount, expiry | Transaction DB |
| Capture | Capture amount, timestamp | Transaction DB |
| Clearing | Clearing batch, network reference | Transaction DB |
| Settlement | Settlement amount, date, bank ref | Settlement DB |
| Reconciliation | Match status, exceptions | Reconciliation DB |
Lifecycle security:
3DS for card-not-present, fraud scoring, velocity checks.
Idempotency to prevent duplicate captures. Amount validation.
Escrow account protection, bank transfer verification.
Audit trail, immutable records, exception investigation.
Lifecycle economics:
| Stage | Cost | Timing |
|---|---|---|
| Authorization | No cost (auth only) | Real-time |
| Capture | Interchange + scheme fees | Same-day or delayed |
| Clearing | Scheme fees | T+1 batch |
| Settlement | Interchange transferred | T+1 cards, T+0 UPI |
Payment lifecycle implementations:
Context: Global payment processing platform.
Problem: Provide clean API for payment lifecycle management.
Architecture: REST API with separate endpoints for authorize, capture, refund, void. State machine management.
Technology: Ruby, Go, PostgreSQL
Outcomes: Millions of merchants using lifecycle APIs.
Lessons: Clean API design for lifecycle stages is essential. State machine must be well-defined.
Storing PAN or CVV in databases creates massive PCI DSS scope and security risk. Always use tokenization.
Missing idempotency keys on payment endpoints causes duplicate charges on retries. Every payment API must support idempotency.
Treating inherently asynchronous payment operations as synchronous causes timeouts and poor UX. Use webhooks and async patterns.
Failing to retry failed webhook deliveries causes merchants to miss critical payment status updates. Implement exponential backoff retry.
Manual reconciliation at scale is error-prone and slow. Automate reconciliation from day one.
Depending on a single payment rail creates a single point of failure. Implement multi-rail architecture with failover.
Launching without fraud monitoring leads to chargebacks and losses. Implement real-time fraud detection from day one.
Using the transaction database as the financial ledger leads to accuracy and audit issues. Maintain a separate double-entry ledger.
| KPI | Description | Target |
|---|---|---|
| Authorization Rate | Percentage of payment attempts that receive authorization | > 95% |
| Payment Success Rate | Percentage of initiated payments that complete successfully | > 97% |
| API Latency (p99) | 99th percentile API response time | < 500ms |
| TPS Capacity | Transactions per second the system can handle | Based on peak demand |
| Fraud Rate | Fraudulent transactions as percentage of total | < 0.1% |
| Chargeback Rate | Chargebacks as percentage of transactions | < 0.75% |
| Uptime | System availability | 99.99% |
| Reconciliation Accuracy | Percentage of transactions successfully reconciled | > 99.5% |
Build a Payment State Machine
Objective: Design and implement a payment state machine with all lifecycle stages.
Scenario: Build a payment processing system with authorization, capture, clearing, and settlement stages.
- Design payment state machine with all states and transitions
- Implement authorization API
- Implement capture API (full and partial)
- Implement clearing and settlement
- Implement reconciliation
- Handle exceptions and edge cases
Deliverables: State machine design, API implementation, reconciliation logic.
Validation: Process payment through all stages. Verify state transitions. Test partial capture. Verify reconciliation.
What is the difference between authorization and capture?
Authorization verifies funds are available and places a hold, but does not transfer funds. Capture finalizes the transaction and triggers fund transfer. This two-step process is useful when the final amount may change (e.g., hotel, gas station).
What is partial capture?
Partial capture captures less than the authorized amount. Useful when the actual charge is less than the authorized amount (e.g., restaurant where tip is added after authorization, or when some items are out of stock).
How does settlement differ between cards and UPI?
Card settlement is T+1 (funds transferred next business day). UPI settlement is T+0 (instant). Card settlement involves clearing (exchanging details) and settlement (fund transfer). UPI does both in real-time.
Payment Service Provider: entity that enables merchants to accept payments through multiple payment methods via a single integration.
Payment Facilitator: entity that enables sub-merchants to accept payments under the PayFac master merchant account.
Bank or financial institution that processes card transactions on behalf of merchants.
Bank or financial institution that issues payment cards to consumers.
Fee paid between the acquiring bank and the issuing bank for card transactions, set by card networks.
Merchant ID: unique identifier assigned to a merchant by the acquirer.
Primary Account Number: the 14-19 digit number on a payment card, considered sensitive cardholder data under PCI DSS.
Process of replacing sensitive card data with a non-sensitive token.
Process of verifying that a payment account has sufficient funds and is valid for a transaction.
Process of finalizing a previously authorized transaction, triggering the transfer of funds.
Process of exchanging transaction details between acquiring and issuing banks.
Actual transfer of funds between banks to complete a payment transaction.
Transaction dispute initiated by a cardholder through their issuing bank.
Merchant Category Code: 4-digit code classifying the type of goods or services a merchant sells.
3-D Secure: authentication protocol for card-not-present transactions.
Payment Card Industry Data Security Standard: security standard for organizations handling cardholder data.
Hardware Security Module: physical computing device that safeguards and manages digital keys.
Property of an API where making the same request multiple times produces the same result as making it once.
HTTP callback triggered by an event, used in payments for asynchronous notifications.
Unified Payments Interface: India real-time payment system developed by NPCI.
National Payments Corporation of India: umbrella organization for retail payment systems in India.
Reserve Bank of India: India central bank and regulatory authority for payment systems.
International standard for electronic data interchange between financial institutions.
Automated Clearing House: US electronic payment network for batch-processed bank-to-bank transfers.
US Federal Reserve instant payment service launched in 2023.
Single Euro Payments Area: EU payment integration initiative.
Real-Time Payments: payment infrastructure enabling instant, irrevocable payments 24/7.
Financial record-keeping system using double-entry accounting.
Process of matching transaction records across different systems to ensure consistency.
Financial arrangement where a third party holds funds until conditions are met.
Buy Now Pay Later: short-term financing allowing consumers to pay in installments.
Banking-as-a-Service: model where licensed banks provide banking infrastructure via APIs.
Practice of providing secure API access to bank account data and payment initiation.
Integration of financial services into non-financial platforms via APIs.
Cryptocurrency designed to maintain stable value by pegging to a reference asset.
Verification that funds are available, placing a hold on the funds.
Finalization of an authorized transaction, triggering fund transfer.
Exchange of transaction details between acquiring and issuing banks.
Actual transfer of funds between banks to complete a transaction.
- Architecture designed and reviewed
- API contracts defined with idempotency
- Authentication and authorization implemented
- PCI DSS scope assessed and minimized via tokenization
- Error handling and retry logic designed
- Webhook delivery and retry implemented
- Security review completed (encryption, HSM, key management)
- Regulatory requirements identified (RBI, PCI DSS, AML)
- Data model defined (transactions, ledger, reconciliation)
- Observability implemented (metrics, logs, traces, alerts)
- Testing completed (unit, integration, load, chaos)
- Disaster recovery designed and tested
- Reconciliation process validated
- Fraud detection deployed and tuned
- Production readiness assessed and approved
Designs end-to-end payment architecture including gateways, orchestration, rails, security, and compliance.
Designs comprehensive fintech platform architecture including payments, banking, ledgers, risk, and compliance.
Designs API-first payment platforms including REST APIs, webhooks, SDKs, developer portals, and API governance.
Implements and operates payment infrastructure including gateway, routing, processing, reconciliation, and settlement.
Builds internal developer platforms for payment integration, providing self-service APIs, SDKs, and golden paths.
Applies software engineering to payment operations, managing SLI/SLO/error budgets and incident response.
Monitors transaction patterns, investigates suspicious activity, tunes fraud rules, and manages chargeback disputes.
Defines payment product strategy, manages roadmap, balances user experience with compliance, and drives payment metrics.
Ensures payment systems meet PCI DSS, RBI, AML, and other regulatory requirements.
Implements and operates treasury management systems including liquidity management, settlement, FX, and bank connectivity.
2027: Payment Processing Lifecycle will see increased AI integration with AI agents handling routine payment decisions, intelligent routing optimization, and predictive fraud prevention becoming standard capabilities.
2028: Autonomous payment systems will mature with self-healing infrastructure, AI-driven reconciliation, and cross-border real-time payments reducing settlement time from days to seconds.
2029: Programmable money and tokenized deposits will enable new payment models with conditional settlement, smart contract-based escrow, and machine-to-machine payments becoming practical.
2030: The convergence of AI, blockchain, and real-time payments will be complete. Payment Processing Lifecycle will be managed through AI agents with humans governing policy, security, and business alignment. Payments will be invisible, instant, and intelligent.
- The payment lifecycle consists of authorization, capture, clearing, and settlement.
- Authorization is real-time; settlement takes T+1 for cards, T+0 for UPI.
- A well-defined payment state machine is essential for reliable processing.
- Partial capture enables flexible amount finalization.
- Reconciliation verifies consistency across all lifecycle stages.
