Skip to content

Events ​

Subscribe to Exchange Pay order lifecycle signals.

When to use ​

Refresh checkout, navigate to success, or show expired UI. For current order state you can also read getActiveOrder() / getOrder().

Methods ​

MethodEventWhen
onOrderUpdatedexchangePay:orderUpdatedOffchain / status update ({ sessionId, order, transaction })
onOrderCompletedexchangePay:orderCompletedPayment succeeded ({ sessionId, order, transaction })
onOrderExpiredexchangePay:orderExpiredLocal timer hit expiresAt ({ sessionId, order })
onFormattedOrderUpdatedexchangePay:formattedOrderUpdatedQuote load / order change ({ sessionId, formattedOrder })

Order events include sessionId and are delivered only for the live session. A createOrder still in flight when restartSession() completes is discarded (SESSION_REPLACED) and does not emit on the new session.

Each returns an unsubscribe function. You can also use client.on('exchangePay:…') - see Events (Core).

Example ​

ts
const offs = [
  client.exchangePay.onOrderUpdated(({ order, transaction }) => {
    console.log('updated', order.id, transaction.status)
  }),
  client.exchangePay.onOrderCompleted(({ order }) => {
    // success screen - then getCompletedTransactionSummary()
    console.log('paid', order.id)
  }),
  client.exchangePay.onOrderExpired(({ order }) => {
    // expired UI - create a new order or go back
    console.log('expired', order.id)
  }),
]

// later
offs.forEach(off => off())