Defaults
Implement
onStatus in every integration. The others are optional.
Web has no showView: the SDK renders the form inside your elementSelector. To submit it from your own button, set showPayButton: false and call transaction.submit().
How to wire controllers
- Web. Each event is a plain function set on the transaction config.
onStatus,showLoading,createPaymentandonChangeare top-level fields.onInstallmentSelectedgoes insidecard(card: { onInstallmentSelected }) andonShippingAddressChangedinsideexternalButtons(externalButtons: { onShippingAddressChanged }). - iOS, Android. Implement
TransactionControlleron the object that should react to events (your view model, activity, or a dedicated class) and pass it through thecontrollerfield ofTransactionConfig. Each event maps to a method on that object.showViewis available on mobile only. - React Native. Pass a plain object as the
controllerfield ofTransactionConfig. Each event maps to a method of that object, and the methods you leave out keep the SDK default. To hand one call back to the SDK from a method you implement, callSdkPayments.defaultShowView,SdkPayments.defaultShowLoadingorSdkPayments.defaultCreatePaymentwith the arguments it received.
Threading
On iOS and Android, every controller method is invoked on the main thread. You can update UI directly from inside it. Move any blocking work (e.g. backend calls insidecreatePayment) off the main thread yourself. On React Native, controller methods run on the JavaScript thread.
Per-controller pages
onStatus. Required. The final outcome of the transaction.- Take over the SDK:
showView(iOS, Android, React Native),showLoading,createPayment. Override one and the SDK stops doing that step itself. - Listen to events:
onInstallmentSelected,onShippingAddressChanged,onChange(Web). Informational; the SDK behaves the same with or without them.