Listen for events
Subscribe with bdk.on(event, listener) to receive the results native features report back.
Subscribe to an event
Examples reuse the single browser client from Set up the client. Adjust the ~/lib/bdk import to your app’s path; do not create a client in each component or handler.
Register a listener for a native event. The payload is typed from the event name (see BdkNativeEvents). Dot-named events such as iap.purchaseCompleted and deeplink.received use the same bdk.on call. Subscribe when the shared client loads so you don't miss a result. bdk.on returns an unsubscribe function — call it on unmount.
Get the result of a call
Subscribe before you call the method. Awaiting the call confirms it was dispatched, not that it succeeded — the result arrives on the event. Some events fire quickly (photos, barcode, location, pickers, popups, contacts, screenshots); others may resolve much later or never (purchases, receipts, biometrics, Smart Login).
iap.purchaseIos / purchaseAndroid take { id, type }, where type is "product" or "subscription". Match these key names exactly — they are the native contract.
All events and payloads
Every event and the payload its listener receives. The field-level shape of each object is in Objects.
Handle errors
Configure onError in the shared client module.
A throwing listener doesn't break the others. Catch errors centrally via the error event or the onError config callback — both receive a BdkError.
See every native feature with its demo on thebdk.com.