Event Listeners
3 min
Introduction
After completing transactions in Pay3 SDK UI, the Pay3 SDK publishes events to App.
pay3-sdk-transaction-status
This event is fired by Pay3 SDK on completion of checkout transaction triggered by checkout webview pay3.geCheckoutWebView()
Payload
- data (Type Object): Following keys are present in this object
- status (Type string): The status can have values SUCCESS or ERROR.
- message (Type string): User-friendly message returned after completion of the transaction.
- orderId (Type string): Pay3 Order ID.
- requestId (Type string): Unique id passed by App.
- error (Type Object, Optional): Following keys will be present if there is an error. Please refer to SDK Errors for reference.
- code (Type number): Error code.
- message (Type string): Error message.
pay3.on('pay3-sdk-transaction-status', (payload: any) => {
// Add your custom logic to handle the transaction status
setPay3CheckoutVisibleState(false); // Can be used to hide the Checkout WebView
},
);Sample Event
{
"data": {
"message": "Transaction completed successfully",
"orderId": "7a38ee7f-d5a9-45c8-af6b-e75d4190722a",
"receipt": "txnReceipt",
"requestId": "252425",
"status": "SUCCESS"
},
"ts": 1706087047736
}