Option 2 - PostMessage Response

The postMessage option uses the browser postMessage API to listen for a specific event type called profile.completed. This event includes a simple status field to notify the merchant if the profiling was successful or not.  An event called profile.completed will notify the listener when the Device Data Collection process completed. 

window.addEventListener("message", (event) => { if (event.origin === "https://centinelapistag.cardinalcommerce.com") { console.warn('event checked again') let data = JSON.parse(event.data); console.warn('Merchant received a message:', data) if (data !== undefined ){ if (data.ActionCode = "SUCCESS"){ console.warn('Songbird ran DF successfully') //Use in cmpi_lookup if DFReferenceId not provided in JWT $('#DFReferenceId').val(data.Payload.SessionId) } else{ // perform appropriate action if ActionCode is not successfully. } } } }, false);

Please note that the JavaScript properties per convention are case sensitive and necessary to obtain the return values i.e. SessionID.

 

Based on the endpoint a merchant is integrated with, we will provide different responses.

  1. postMessage Response (v1 Endpoint)

  2. postMessage Response (v2 Endpoint)

The V1 and V2 profile completed objects are similar but V2 offers additional information about the data collection to allow merchants to make decisions based on the success or failure of certain data points. For example, if we were unable to collect `CardinalData` the merchant could opt to send the 11 required fields on the `cmpi_lookup` request to ensure a 3DS 2.0 transaction can still complete.