Transaction statuses

Always determine the payment outcome from the transaction status; an HTTP 200 from the transaction creation endpoint is not proof of approval.

Status model

Statuses fall into three practical groups:

Group Statuses Integration behavior
In progress CREATED, PENDING, PENDING_APPROVAL, PENDING_SECOND_APPROVAL Keep the transaction ID and wait for the next response, status lookup, webhook, or operator action.
Final outcome APPROVED, DECLINED, CANCELED, INVALID, SESSION_EXPIRED, ERROR Stop waiting. Only APPROVED is a successful payment outcome.
Needs resolution CONFLICTED A later result disagreed with an already recorded final outcome. Do not assume success; wait for the transaction to be resolved.

Integrations should tolerate unknown enum values and must never treat an unfamiliar status as approval.

Common payment flow

Most direct payments follow this lifecycle. A provider can skip PENDING and return a final result immediately.

flowchart LR
    created["CREATED<br/>Transaction stored"]
    pending["PENDING<br/>Waiting for completion"]
    approved["APPROVED<br/>Successful"]
    declined["DECLINED<br/>Rejected"]
    canceled["CANCELED<br/>Stopped"]
    invalid["INVALID<br/>Invalid request or state"]

    created --> pending
    created --> approved
    created --> declined
    created --> canceled
    created --> invalid
    pending --> approved
    pending --> declined
    pending --> canceled

    classDef active fill:#e8f1ff,stroke:#3b82f6,color:#172554
    classDef success fill:#dcfce7,stroke:#16a34a,color:#14532d
    classDef stopped fill:#f3f4f6,stroke:#6b7280,color:#111827
    class created,pending active
    class approved success
    class declined,canceled,invalid stopped

CREATED and PENDING can also be finalized by timeout or operational policy. SESSION_EXPIRED and ERROR are final results exposed by the API, but they are not part of the normal provider-completion path.

Withdrawal approval flow

Withdrawals can pause for one or two operator approvals before they are sent for final provider processing.

flowchart LR
    created["CREATED"]
    first["PENDING_APPROVAL<br/>Waiting for approval"]
    second["PENDING_SECOND_APPROVAL<br/>Waiting for a second approver"]
    pending["PENDING<br/>Provider processing"]
    approved["APPROVED"]
    declined["DECLINED"]
    canceled["CANCELED"]

    created --> first
    first -->|one-step approval| pending
    first -->|first approval in two-step mode| second
    second -->|second approval| pending
    first -->|operator declines| declined
    second -->|operator declines| declined
    first -->|operator cancels| canceled
    second -->|operator cancels| canceled
    pending --> approved
    pending --> declined
    pending --> canceled

    classDef active fill:#fff7ed,stroke:#f97316,color:#7c2d12
    classDef success fill:#dcfce7,stroke:#16a34a,color:#14532d
    classDef stopped fill:#f3f4f6,stroke:#6b7280,color:#111827
    class created,first,second,pending active
    class approved success
    class declined,canceled stopped

An approval action commonly moves a withdrawal to PENDING, not directly to APPROVED. Continue waiting for the final provider result.

Late or contradictory results

If a different result arrives after a transaction is already final, Morefin records CONFLICTED instead of silently replacing the original outcome. The conflict can then be resolved to APPROVED, DECLINED, or CANCELED.

flowchart LR
    final["APPROVED / DECLINED / CANCELED<br/>INVALID / SESSION_EXPIRED"]
    conflict["CONFLICTED<br/>Results disagree"]
    resolved["APPROVED / DECLINED / CANCELED"]

    final -->|different later result| conflict
    conflict -->|resolution| resolved

The one automatic correction is CANCELED → DECLINED, used when a provider confirms a decline after cancellation was recorded.

Allowed status changes

The transaction finalization service currently accepts the following non-manual changes. Sending the current status again is a no-op.

Current status Allowed next status
CREATED APPROVED, DECLINED, CANCELED
PENDING APPROVED, DECLINED, CANCELED
PENDING_APPROVAL PENDING_SECOND_APPROVAL, PENDING, APPROVED, DECLINED, CANCELED
PENDING_SECOND_APPROVAL PENDING, APPROVED, DECLINED, CANCELED
CONFLICTED APPROVED, DECLINED, CANCELED
CANCELED DECLINED; any other different result becomes CONFLICTED
APPROVED, DECLINED, INVALID, SESSION_EXPIRED Any different result becomes CONFLICTED
ERROR No automatic outgoing transition

INVALID, SESSION_EXPIRED, and ERROR can be assigned by validation, timeout, failure, or administrative workflows outside the normal provider finalization path.

Integration checklist

  1. Treat only APPROVED as success.
  2. Keep waiting while the status is in progress.
  3. Use transaction status lookup or transaction webhooks to receive the next state.
  4. Put fulfillment on hold for CONFLICTED until a final resolution arrives.
  5. Make status handling forward-compatible: store and log unknown values, but never map them to APPROVED.