Skip to content

Feature Request: Bulk void/commit API for inflight transactions #245

@ShivamGupta-SM

Description

@ShivamGupta-SM

Problem

Currently, to void or commit multiple inflight transactions, we need to make N separate API calls:

PUT /transactions/inflight/hold_001  → void
PUT /transactions/inflight/hold_002  → void
PUT /transactions/inflight/hold_003  → void
... N calls

This is inefficient for batch operations like:

  • Cron jobs expiring multiple holds at once
  • Bulk cancellations
  • Mass void/commit processing

Proposed Solution

Add a new bulk endpoint:

PUT /transactions/inflight/bulk

Request Body

{
    "transaction_ids": ["txn_001", "txn_002", "txn_003"],
    "status": "void"
}

Response

{
    "batch_id": "batch_xyz",
    "status": "completed",
    "succeeded": 148,
    "failed": 2,
    "errors": ["txn_099: already voided", "txn_123: not found"]
}

Implementation Suggestion

Following the existing ProcessTransactionInBatches pattern with worker pools:

  1. Add BulkInflightUpdate model in model/transaction.go
  2. Add route transactions.PUT("/inflight/bulk", a.BulkUpdateInflightStatus) in api/api.go
  3. Add handler in api/transactions.go that validates and delegates to service
  4. Add BulkUpdateInflight method in transaction.go using existing VoidWorker/CommitWorker

This reuses the existing concurrent processing infrastructure.

Use Case

Any application with scheduled expiration of inflight holds needs to void them in bulk. Individual API calls create unnecessary overhead when processing 100+ transactions.

Happy to submit a PR if this feature is accepted!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions