On This Page
Compatibility Check
Generating an iframe
An iframe functions as a “digital new tab” on the parent page. Cardinal uses iframes
for security between a third-party page and a Cardinal page for front end API calls.
With an iframe an isolation layer is created between the two sites.
Below is a simple way to generate an iframe while meeting Cardinal’s
requirements.
- Cardinal requires a JWT to be generated on the back end
- The back end will then render the JWT in the hidden JWT field
- The page loads in the browser and auto-submits the form to the iframe.
Once the form is submitted the parent page can’t read the content loaded within the
iframe.
FIDO Initialize Session code sample
<iframe name='fidoInitializeIFrame' height="10" width="10" style="visibility: hidden; position: absolute; top: -1000px; left: -1000px;"> </iframe> <form id="fidoInitializeForm" target="fidoInitializeIFrame" name="fidoInitialize" method="POST" action=" https://centinelapistag.cardinalcommerce.com/V2/FIDO/Init"> <input type="hidden" name="JWT" value="Transactional JWT generated per specification" /> </form> <script>window.onload = function () { // Auto submit form on page load document.getElementById('fidoInitializeForm').submit(); } </script>
This is an HTML snippet that contains an iframe, a form, and a JavaScript. This
example shows a simple way to inject an iframe on page load.
- <iframe>: It's a HTML element used to embed another HTML document within the current HTML document. The given iframe is named 'fidoInitializeIFrame' and is hidden from view (with visibility set to 'hidden' and positioned off-screen).
- <form>: The form is configured to POST to the URL 'https://centinelapistag.cardinalcommerce.com/V2/FIDO/Init', and the target of this form submission is the previously mentioned iframe. This form includes a hidden input field named 'JWT' and the value is set as 'Transactional JWT generated per specification'. This suggests that a JSON Web Token should be generated and inserted into this field as part of the form submission data.
- <script>: When the window is loaded, the script automatically submits the form with id 'fidoInitializeForm'. This means that as soon as the HTML page loads, the form will be submitted automatically without any user interaction.
In summary, when this HTML page is loaded, it automatically submits a form containing
a JWT to a specified URL, and the response from that submission will be loaded into
a hidden iframe.
POST to /FIDO/Init with JWT
POST to /FIDO/Init with JWT
The /FIDO/Init request uses the same JWT request format as other Cardinal Cruise
endpoints. See our existing JWT documentation for instructions on
creating and formatting the base JWT.
When the customer lands on the merchant page, the integrator should create a hidden
iframe and call the new /FIDO/Init endpoint with the new field
merchantorigin
located in the payload.MerchantOrigin
is required to match the window.origin and must
include:- A scheme of https.
- A top-level domain
- If an integrator sends a port, it must be 443.
{ "iss": "ApiKeyId", "jti": "6325c60f-d31c-4450-8184-30699ebac69c", "iat": 1448997865, "OrgUnitId": "MyOrgUnit", "ReturnUrl": "https://onlinestore.com/myreturn", "ObjectifyPayload": true, "Payload": { "MerchantOrigin": "https://onlinestore.com" } }
NOTE
For field definitions refer to the API reference.
NOTE
This FIDO call only supports SHA-256 algorithm when
generating a signature for the JWT.
FIDO Init Response with JWT
Receiving a successful response will include a JWT payload with a
ReferenceId
value used for the pa_setup request during the VPP
enrollment check.{ "iss": "5f0780aeadf32541e357357a", "iat": 1715173482, "exp": 1715180682, "jti": "6325c60f-d31c-4450-8184-30699ebac69c", "aud": "739debe0-799e-43fd-8bab-e254340cd745", "Payload": { "ReferenceId": "1234-12345-1234-1234", "ErrorNumber": 0, "ErrorDescription":"Success" } }
NOTE
For field definitions refer to the API
reference