Appearance
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
| Method | Event | When |
|---|---|---|
onOrderUpdated | exchangePay:orderUpdated | Offchain / status update ({ order, transaction }) |
onOrderCompleted | exchangePay:orderCompleted | Payment succeeded ({ order, transaction }) |
onOrderExpired | exchangePay:orderExpired | Local timer hit expiresAt ({ order }) |
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());Related
- Orders & checkout for create / close / status
- Expiry for countdown helpers
- Errors for failure mapping