Before you begin
You will need the following to connect to the FrankieOne API,- Customer ID
- Customer Child ID (Optional)
- API key
- Australia
- New Zealand
- Indonesia
- Thailand
- Singapore Manual Input (not Singpass)
- Generic International Passport
- Generic International National ID
- USA
- UK
- All Others
Step 1: Create a session
Obtain a session on your backend and forward it to your frontend web page.Construct the API credential
- Serialize your FrankieOne API credentials to a string using ’:’ as a separator.
- Encode the resulting string using Base64 encoding.
Shell
Shell
Obtain a temporary session token
Send aPOST request to the /auth/v2/machine-session endpoint.
Base URL
Use one of the following base URLs depending on the environment you are targeting. Note, Smart UI uses different URLs to FrankieOne’s server-side APIs.| Environment | Base URL |
|---|---|
| Demo | https://backend.demo.frankiefinancial.io |
| UAT | https://backend.kycaml.uat.frankiefinancial.io |
| Production | https://backend.kycaml.frankiefinancial.io |
Authorization header
Pass the encoded credential in theAuthorization request header using machine as the scheme:
Authorization: machine YOUR_ENCODED_CREDENTIAL
Request body
Include the following parameters in the body of the request:| Parameter name | Required | Description |
|---|---|---|
referrer | Required | A referrer URL pattern used to verify the webpage that Smart UI is hosted on. See CSP and Smart UI Security Recommendations. |
permissions | Required | A hash containing preset and reference. |
permissions.preset | Required | The string "smart-ui". |
permissions.reference | Required* | A string containing your customer reference for the individual being onboarded. Only required if entityId isn’t provided |
permissions.entityId | Required* | A string containing the entity id if the entity exists previously. Only required if reference isn’t provided. |
Note
Applicant Reference with whitespace characters aren’t supported by the Smart UI and will be rejected. Let us know if this will prevent you from integrating.Request example
The following example creates a session object for a user in the Demo environment:Shell
Your
Customer ID and API Key are both secret information and shouldn’t be included in the frontend code. For that reason, make sure to call the /auth/v2/machine-session endpoint from your backend server./auth/v2/machine-session endpoint will respond with a 200 HTTP status code, indicating the session was created successfully.
The response body will include a configuration object that’s used by Smart UI to customize its behavior. The configuration object includes a dictionary of strings that might seem like error messages, but they aren’t. You may ignore anything found in the successful response body.
Read the token from the response
The successful response will contain a response header namedtoken that contains the authentication token required to configure Smart UI. This token is valid for only one hour, and within the Smart UI, it’s refreshed for another hour on each successful call to the backend server.
The following example reads the token from the response:
JavaScript
token rather an numeric index, as the order in which the response headers are returned isn’t guaranteed to be the same for each request.
Step 2: Set up Smart UI
Install the Smart UI widget
Include the Smart UI script tag within the<head /> section of your HTML page.
Add the widget to your page
Smart UI is implemented as a Web Component. This means it’s a custom element whose internal structure and styles are isolated from your page. Add the custom<ff-onboarding-widget> element to your page where you would like it to be rendered:
Create initialization object
Create an object to initialize your Smart UI integration. This section shows the required and recommended parameters.| Parameter name | Required | Description |
|---|---|---|
| ffToken | Required | The token you obtained from the /auth/v2/machine-session endpoint. |
| applicantReference | A string containing your customer reference for the customer being onboarded. This is used to identify the customer whose information should be pre-filled. Once the customer completes onboarding this value can be used to retrieve the customer’s details via the API or the Portal. | |
| width | A string defining the width of Smart UI. See Customizing the appearance of Smart UI. | |
| height | A string defining the height of Smart UI. See Customizing the appearance of Smart UI. | |
| config | A hash containing onboarding configuration for Smart UI. See Smart UI configuration reference. |
JavaScript
Initialize the Smart UI widget
Initialize Smart UI by calling theinitialiseOnboardingWidget method on the global frankieFinancial object.
The initialization needs to be done after the page is mounted/ready, so the HTML elements are available. The example below shows how to initialize Smart UI within the onload event.