Documentation Index
Fetch the complete documentation index at: https://docs.coinvoyage.io/llms.txt
Use this file to discover all available pages before exploring further.
useOrderStatusWS subscribes to PayOrder status events over the CoinVoyage backend WebSocket from inside a React component. Use it when you need live payment state outside the default PayButton lifecycle callbacks, such as a custom checkout page, payment status panel, or embedded dashboard view.
useOrderStatusWS must run inside PayKitProvider because it uses the configured backend API client from context.Import
Basic usage
Options
PayOrder ID to subscribe to. The hook does not connect until
orderId is available.Controls whether the WebSocket should be active. Set this to
false to pause the subscription without unmounting the component.Called for each PayOrder event delivered by the backend WebSocket.
Called when the WebSocket errors, authentication times out, or the backend returns an error message.
Called when the connection becomes authenticated or disconnects.
Behavior
- Connects only when
enabledis true andorderIdis present. - Subscribes to the specified PayOrder after the WebSocket opens.
- Waits for backend authentication before reporting
connected: true. - Reconnects with exponential backoff after close, error, or authentication timeout.
- Cleans up timers and closes the socket when the component unmounts or dependencies change.