Pandabase
Learn

Payment lifecycle

How orders, payments, refunds, and disputes flow through Pandabase, and which webhook events fire at each step.

Order states track a purchase from checkout through fulfillment, refunds, and disputes. Use webhook events to respond to state changes.

Overview

Order statuses

StatusDescription
PENDINGOrder created, awaiting payment confirmation.
PROCESSINGPayment received, fulfillment in progress.
COMPLETEDOrder fulfilled successfully.
CANCELLEDOrder was cancelled before payment confirmed.
FAILEDPayment was declined.
REFUNDEDA refund has been issued against the order.
CHARGEBACKA dispute is open or the dispute was lost.

Payment statuses

Every order has exactly one InboundPayment record that tracks the payment side of the lifecycle.

StatusDescription
PENDINGPayment intent created, awaiting customer action.
PROCESSINGPayment is being processed by the network. Common for bank-transfer methods that do not settle instantly.
COMPLETEDPayment successfully collected.
FAILEDPayment was declined or expired.
REFUNDEDThe payment has been refunded.
DISPUTEDA dispute is open on the payment.

Lifecycle flow

1. Payment initiated

When a customer submits the checkout, an Order and InboundPayment are created with status PENDING. A PAYMENT_PENDING webhook event fires.

{
  "event": "PAYMENT_PENDING",
  "id": "evt_abc123",
  "timestamp": "2026-05-21T12:00:00.000Z",
  "data": {
    "order": {
      "id": "ord_abc123",
      "orderNumber": "cs_abc123",
      "status": "PENDING",
      "amount": 2999,
      "currency": "USD",
      "customFields": null,
      "metadata": null,
      "items": [/* ... */]
    },
    "customer": { "id": "cus_abc123", "email": "customer@example.com" },
    "geo": null
  }
}

Geo data (city, region, country) may be null on the initial event. It is enriched asynchronously after checkout and is present on later events.

2. Payment succeeds

Once the payment is confirmed, the InboundPayment moves to COMPLETED and the Order moves to PROCESSING while fulfillment runs. When fulfillment finishes, the order moves to COMPLETED. A PAYMENT_COMPLETED webhook event fires.

PAYMENT_COMPLETED is the primary event to listen for when fulfilling orders. It fires when the payment is confirmed and includes the full order payload including customFields and metadata. Geo data is always present on this event.

3. Payment fails

If the payment is declined, expires, or the customer abandons checkout, the order moves to FAILED (or CANCELLED for explicit abandonment), the payment moves to FAILED, and a PAYMENT_FAILED webhook event fires. If a coupon was applied, its usage count is automatically restored.

4. Refund

When a merchant issues a refund, a Refund record is created. Refunds settle in one of two ways:

Refund pathBehavior
InstantCommon case. The refund completes atomically inside the request: balance is decremented, the order moves to REFUNDED, the payment moves to REFUNDED, and PAYMENT_REFUNDED fires immediately.
AsyncFor some payment methods the network takes time to confirm. The refund stays in PROCESSING until the network confirms it, at which point it transitions to SUCCESSFUL, the order moves to REFUNDED, the payment moves to REFUNDED, and PAYMENT_REFUNDED fires.

In both cases, your handler should treat PAYMENT_REFUNDED as the signal that the refund is final.

5. Dispute

If a customer opens a chargeback with their bank, a Dispute record is created and the order moves to CHARGEBACK. The payment moves to DISPUTED. The disputed amount plus a $20.00 dispute fee is deducted from the store's available balance. A PAYMENT_DISPUTED webhook event fires.

Disputes move through several internal states:

Dispute statusMeaning
AWAITING_REVIEWDispute opened. Merchant has not yet submitted evidence.
UNDER_REVIEWEvidence submitted. Card network is reviewing.
WONCard network ruled in the merchant's favor. Funds restored.
LOSTCard network ruled in the customer's favor. Funds stay deducted.
PREVENTEDThe card network prevented the chargeback before it became a formal dispute (Verifi RDR or Ethoca). Treated as a loss with a $30 prevention fee.

When a dispute resolves, one of these events fires:

OutcomeEventEffect
WonPAYMENT_DISPUTE_WONDisputed amount restored. Order returns to COMPLETED, payment to COMPLETED.
LostPAYMENT_DISPUTE_LOSTFunds stay deducted. Order stays CHARGEBACK.
PreventedPAYMENT_DISPUTE_PREVENTEDFull disputed amount plus a $30 prevention fee is deducted. Order set to CHARGEBACK, payment to DISPUTED. Does not count against your dispute rate.

Webhook events by lifecycle stage

StageEventOrder status afterPayment status after
Payment initiatedPAYMENT_PENDINGPENDINGPENDING
Payment confirmedPAYMENT_COMPLETEDPROCESSING then COMPLETEDCOMPLETED
Payment failedPAYMENT_FAILEDFAILED or CANCELLEDFAILED
Refund finalizedPAYMENT_REFUNDEDREFUNDEDREFUNDED
Dispute openedPAYMENT_DISPUTEDCHARGEBACKDISPUTED
Dispute wonPAYMENT_DISPUTE_WONCOMPLETEDCOMPLETED
Dispute lostPAYMENT_DISPUTE_LOSTCHARGEBACKDISPUTED
Dispute preventedPAYMENT_DISPUTE_PREVENTEDCHARGEBACKDISPUTED

See Webhook events for full payload shapes.

Subscription lifecycle

Subscriptions have their own lifecycle on top of the order lifecycle above. Each renewal creates a new Order and InboundPayment that flows through the states described here, and the subscription itself transitions through TRIALING, ACTIVE, PAST_DUE, PAUSED, and CANCELLED. See Subscriptions for the full subscription state machine and Usage-based billing for the metered-billing variant.

Last updated on

On this page