DEV Community

Daniel Parkson Tano
Daniel Parkson Tano

Posted on

Combining Automated Payment Rails with Human Fallback

Designing one transaction lifecycle that can move safely between API-based payouts and operational fulfillment.

Payment coverage is rarely uniform. One destination may support an immediate API payout. Another may require a human agent. An automated rail may also reject a transaction after the customer has already committed funds.

Treating automated and manual fulfillment as unrelated products creates duplicated logic and fragmented transaction history. A better design represents them as different fulfillment strategies inside one customer-facing lifecycle.

Start with one authoritative transaction

The customer should create one transfer with one reference, quote, recipient, funding record, and status history.

The routing layer then selects a fulfillment strategy:

def route_transfer(order):
    if automated_rail_supports(order.destination, order.method):
        return submit_automated_payout(order)

    return queue_for_agent(order)
Enter fullscreen mode Exit fullscreen mode

The route used should be persisted on the transaction. A later configuration change must not obscure how an existing transfer was fulfilled.

Define when fallback is safe

Fallback should not occur after every provider error.

The system must distinguish:

  • not submitted: no external payment was created, so fallback may be safe;
  • definitively rejected: the provider confirms no payout will occur;
  • unknown outcome: a timeout occurred and the provider may still process the request;
  • processing: an external payment exists and must be reconciled;
  • completed: terminal success; fallback is forbidden.

Falling back during an unknown outcome can pay the recipient twice. Reconciliation must resolve ambiguity before a second rail is allowed.

Preserve the financial contract

Changing fulfillment strategy must not silently change what the customer authorized.

The transaction should retain:

  • sender debit;
  • recipient amount;
  • quoted exchange rate;
  • customer fee;
  • payout method;
  • recipient destination; and
  • funding status.

An agent may use a different internal settlement rate, but that operational rate should not rewrite the customer’s original quote.

Assign manual work transactionally

When a transfer enters an agent queue, competing workers or agents must not claim it simultaneously.

The assignment path should lock the order, verify that it is still eligible, select an available agent, write the assignment, and create the queue record atomically.

Agent selection can consider capability, destination, payout method, availability, and current workload. Exact scoring rules should remain internal because they are operational and potentially security-sensitive.

Coordinate linked transactions

Sometimes a manual fulfillment record is linked to another product record, such as a virtual-account withdrawal. One record represents the customer request; the other represents the payout workflow.

The architecture must define:

  • which record owns the funds reservation;
  • which action confirms that payment was sent;
  • which action completes the customer request;
  • how cancellation propagates; and
  • how duplicate completion is prevented.

A linked transaction should be completed through an idempotent service, not through independent status assignments on both records.

Keep staff intervention auditable

Staff may need to confirm a payment when an agent application is unavailable or a provider integration fails. This action should require explicit permission and record:

  • the staff actor;
  • completion timestamp;
  • reason or note;
  • optional evidence;
  • affected transaction references; and
  • whether linked records were updated.

The operation should lock the transaction and return safely if it was already completed.

Notify from the authoritative transition

Customer and agent notifications should be triggered by the service that owns the state transition. If each interface sends its own message, retries can create duplicate or contradictory notifications.

Notifications are secondary effects. A notification failure should not roll back an already valid financial completion, but it should be observable and retryable.

The design principle

Automation and human operations can share one reliable transaction model.

The routing decision selects how the obligation will be fulfilled. It does not create a second customer promise. Safe fallback requires certainty about the first rail, preserved financial terms, transactional assignment, linked-state coordination, and an auditable operational path.

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.