The FlexitiSDK will capture these events and it will send the response through the function handlers defined on the Widget instance creation.
Events will be used to send data from the widget to the Merchant Front-End using the following method and structure.
window.parent.postMessage({ 'eventType': 'flx-success', 'eventData': { 'accountNumber': 2233000 / null 'verified': true / false 'action': Enum ["apply"|"purchase"|"activation"|"retry"] / null 'mfaOptionSelected': Enum [“sms”|“email”|“security_answer”] / null 'widget_session_id': GUID 'customerId': "1234567-12345" 'accountType': "business" / "consumer" } }, '*');
Success
‘eventType': ‘flx-success’: When the widget ends, after performing all the corresponding customer verification steps related to the flow, it will send the eventData JSON object with the following structure:
'eventData': { 'accountNumber': 2233000 / null 'verified': true / false 'action': Enum [“apply”|“purchase”|“activation”] / null 'mfaOptionSelected': Enum ["apply"|"purchase"|"activation"|"retry"] / null 'widget_session_id': GUID 'customerId': "1234567-12345" 'accountType': "business" / "consumer" }
Mandatory: The merchant must call the POST /apply endpoint on a flx-success widget response on the application flow.
Failure
'eventType': ‘flx-failure’: To be used for error handling and catching exceptions, it will return the following error structure:
{ 'error':HTTP Status Code 'message': string //description of the error }
Cancel
'eventType': 'flx-cancel': If the customer cancels the flow within the widget, eventData will not be sent. The merchant should handle the cancellation of the flow.
{ 'eventType': 'flx-cancel' }
Success Event - “Action” Scenarios
Based on the application or purchase flow, there will be certain actions (“action” data) that the customer can choose which will be returned through the “flx-success” event. The Merchant can then determine the next step for the customer depending on these scenarios.
Purchase Scenarios
Description | “accountnumber” | “verified” | “action” | Implementation |
---|---|---|---|---|
Customer attempts to make a purchase and completes verification successfully. | numeric | TRUE | purchase | After the widget ends, the Merchant should send the purchase request to the /authorizations endpoint. |
Customer attempts to make a purchase and completes verification unsuccessfully. | numeric | FALSE | purchase | After the widget ends, the Merchant should inform the customer that they failed to make a purchase and redirect them back to the checkout to select an alternate payment method. |
Customer attempts to make a purchase with an account needing activation and selects activate on the account selection screen. | NULL | FALSE | activation | After the widget ends, the Merchant can open the Flexiti Customer Portal URL (https://my.flexiti.com/index) in a new tab or let the customer perform that action themselves to complete activation. |
Merchant sends | NULL | FALSE | apply | After the widget ends, the Merchant should redirect the Customer to complete a brand new application. |
Customer cannot proceed with a purchase due to derogatory status’s on an existing account. | NULL | FALSE | purchase | After the widget ends, the Merchant must inform the customer they cannot proceed with a purchase. |
Customer attempts an application but there is an IT related error. | NULL | FALSE | retry | After the widget ends, the Merchant should display a message that there was an error and either retry the application or return the customer to the previous screen/step. |