SDK events
Observe DEUNA SDK lifecycle events across Web, iOS, Android, and React Native without treating analytics events as payment state.
On this page
SDK events describe what the customer and widget are doing. Use them for analytics, diagnostics, and interface changes. Use typed success and error callbacks for the immediate UI, and verify the final order state on your backend before fulfillment.
Event lifecycle#
Subscribe by platform#
await DeunaSDK.initPaymentWidget({
orderToken,
callbacks: {
onEventDispatch: (event, payload) => {
analytics.track(`deuna.${event}`, sanitize(payload));
},
},
});await deunaSDK.initPaymentWidget({
orderToken,
callbacks: {
onEventDispatch: (event, payload) => {
analytics.track(`deuna.${event}`, sanitize(payload));
},
},
});let callbacks = PaymentWidgetCallbacks()
callbacks.onEventDispatch = { event, payload in
Analytics.track("deuna.\(event.rawValue)", sanitize(payload))
}
deunaSDK.initPaymentWidget(
orderToken: orderToken,
callbacks: callbacks
)val callbacks = PaymentWidgetCallbacks().apply {
onEventDispatch = { event, payload ->
analytics.track("deuna.${event.value}", sanitize(payload))
}
}
deunaSDK.initPaymentWidget(
context = this,
orderToken = orderToken,
callbacks = callbacks
)The Web and React Native callbacks expose the event name as a string. Native SDKs expose typed CheckoutEvent or ElementsEvent values. Keep a default branch so a newly released event does not break your analytics adapter.
Stable integration signals#
Prefer dedicated callbacks when one exists. They provide a smaller, typed contract than the raw event stream.
| Signal | Web | iOS | Android | React Native | Recommended use |
|---|---|---|---|---|---|
onSuccess | Yes | Yes | Yes | Yes | Close or replace the experience, then verify final state. |
onError | Yes | Yes | Yes | Yes | Render a retry or recovery path from the documented error envelope. |
onClosed | Yes | Yes | Yes | Yes | Restore the merchant UI after customer or SDK closure. |
onCardBinDetected | Payment + Elements | Payment + Elements | Payment + Elements | Payment + Elements | Recalculate card-specific offers or styling. |
onInstallmentSelected | Payment + Elements | Payment + Elements | Payment + Elements | Payment + Elements | Record the selected plan identifier without storing card data. |
onPaymentProcessing | Payment + Voucher | Payment | Payment | Payment + Voucher | Disable duplicate submit actions. |
onResize | Yes | Embedded lifecycle | Embedded lifecycle | Yes | Keep an embedded container aligned with content. |
See SDK responses for payloads and error handling.
High-value lifecycle events#
| Event | Meaning | Experience notes |
|---|---|---|
checkoutStarted | The checkout experience started loading or initialized. | Present in Web and native checkout streams. |
paymentMethodsStarted | The payment-method step became active. | Native and React Native checkout streams. |
paymentMethodsSelected | The customer selected a payment method. | Web and native checkout streams. |
onBinDetected | The card BIN was detected. | Prefer onCardBinDetected when available. |
onInstallmentSelected | The customer chose an installment option. | Prefer the dedicated typed callback. |
paymentProcessing | Submission is being processed. | Disable duplicate actions; do not infer approval. |
purchase | The widget reported a successful purchase interaction. | Use onSuccess, then verify the order on the backend. |
purchaseError | The purchase interaction failed. | Use onError for the normalized error envelope. |
purchaseRejected | The native checkout reported a rejection. | Available in native and React Native streams, not the current Web enum. |
vaultSaveSuccess | Elements reported a saved credential. | Web and native Elements flows. |
vaultSaveError | Elements could not save the credential. | Treat payload as experience-specific. |
linkClose | The hosted experience requested closure. | The SDK also invokes onClosed. |
Current event catalogs#
These names are the public enums in the maintained SDK source. Payload objects are deliberately raw because their fields vary by experience and release; only depend on a payload field when a dedicated callback documents it.
Web SDK
checkoutStarted, paymentMethodsEntered, onBinDetected, purchase, paymentProcessing, loginStarted, paymentMethodsSelected, loginOtpStarted, purchaseError, onInstallmentSelected, linkClose, checkoutReady, vaultSaveSuccess, vaultSaveError, checkoutFailed, openExternalPopup, closeExternalPopup, errorApmMissingReference.
React Native · checkout
custom, purchase, purchaseError, linkClose, linkFailed, purchaseRejected, paymentProcessing, paymentMethodsAddCard, paymentMethodsCardExpirationDateInitiated, paymentMethodsCardNameEntered, apmSuccess, apmSuccessful, changeAddress, changeCart, paymentClick, apmClickRedirect, paymentMethodsCardNumberInitiated, paymentMethodsCardNumberEntered, paymentMethodsEntered, checkoutStarted, linkStarted, paymentMethodsStarted, paymentMethodsSelected, adBlock, paymentMethods3dsInitiated, pointsToWinStarted, paymentMethodsCardSecurityCodeInitiated, paymentMethodsCardSecurityCodeEntered, paymentMethodsCardExpirationDateEntered, paymentMethodsCardNameInitiated, paymentMethodsNotAvailable, paymentMethodsShowMore, paymentMethodsShowMyCards, benefitsStarted, donationsStarted, donationsUsed, onBinDetected, onInstallmentSelected, onDownloadVoucher, errorApmMissingReference.
React Native · Elements
vaultClosed, vaultProcessing, vaultSaveClick, vaultStarted, vaultFailed, cardSuccessfullyCreated, changeAddress, changeCart, vaultSaveError, vaultSaveSuccess, vaultClickRedirect3DS, cardCreationError, paymentMethodsCardIdentityNumberInitiated, paymentMethodsCardIdentityNumberEntered, paymentMethodsCardNameInitiated, paymentMethodsCardNameEntered, paymentMethodsCardSecurityCodeInitiated, paymentMethodsCardSecurityCodeEntered, paymentMethodsCardExpirationDateEntered, paymentMethodsCardExpirationDateInitiated, paymentMethodsCardNumberEntered, paymentMethodsCardNumberInitiated, paymentMethodsEntered, paymentMethodsStarted.
iOS and Android · checkout
The native catalogs include the checkout, login, billing, shipping, user-information, APM, coupon, donation, card-entry, installment, processing, purchase, rejection, and failure events exposed by each platform. Android additionally publishes apmFailed, couponStarted, linkCriticalError, and userInfoPhoneInitiated; iOS publishes custom. Code against the enum shipped with your installed SDK rather than assuming the two native catalogs are byte-for-byte identical.
iOS and Android · Elements
Both native SDKs publish card-entry, BIN, installment, checkout, vault lifecycle, and credential-save events. Their current catalogs include paymentMethodSplitPayments, vaultClickRedirect3DS, vaultProcessing, vaultSaveClick, vaultSaveError, and vaultSaveSuccess.
Analytics and privacy#
- Allow-list event names before forwarding them to a third-party analytics destination.
- Remove order, customer, payment-method, and provider metadata unless your data contract explicitly permits it.
- Never record PAN, security code, wallet tokens, access tokens, or the complete raw payload.
- Include your app version, SDK version, environment, and a merchant-owned correlation ID for diagnostics.
- Treat unknown event names as forward-compatible signals, not fatal errors.
Public source contracts#
The catalogs above are checked against the maintained public enums rather than copied from a historical event list:
- Web
EventType - React Native
CheckoutEventTypeandElementsEventType - iOS
CheckoutEventandElementsEvent - Android
CheckoutEventandElementsEvent