Payment events

Payment events notify your system about payment-level activity associated with an order. Unlike order events, which represent high-level state changes, payment events represent individual payment actions and outcomes.

Payment events are especially important when handling partial payments, retries, refunds, or reconciliation workflows.


Supported payment events

EventDescriptionWhen it is emitted
payment:appliedEmitted when a payment is successfully applied to an order.After the payment amount is reconciled and affects the order balance.
payment:failedEmitted when a payment attempt fails.When a payment cannot be completed or confirmed.
payment:refundedEmitted when a payment is refunded.After a successful refund operation.

Event semantics

payment:applied

This event is emitted each time a payment is applied to an order.

Typical use cases:

  • Update internal accounting or balances
  • Track partial payments
  • Reconcile on-chain or provider-side transactions

Note
An order may emit multiple payment:applied events before reaching the paid status.


payment:failed

This event indicates that a payment attempt did not succeed.

Examples:

  • On-chain transaction failed or reverted
  • Provider rejection
  • Invalid payment parameters
  • Insufficient funds

Typical use cases:

  • Notify the customer of a failed payment
  • Trigger retry logic
  • Log failures for reconciliation or support

payment:refunded

This event is emitted when a previously applied payment is refunded.

Typical use cases:

  • Reverse fulfillment
  • Update merchant balances
  • Reflect refunds in your accounting system

Important
Refunds do not automatically change the order status unless business rules require it. Always rely on both order and payment events when building refund logic.


Relationship between order and payment events

  • Payment events represent individual transactions
  • Order events represent aggregate state

A typical flow may look like:

  1. One or more payment:applied events
  2. A single order:paid event once the order is fully funded

Did this page help you?