Customer Address Widget

Important Note:

Widget Types Supported in inabit: Inabit currently supports two widget types, each with its own implementation instructions.

The information displayed below is an example of how a widget implementation setup/guide looks like. You can access your widget implementation guide at all times by clicking the "Code" Icon on the widget drawer that's pinned to the top right hand side of the

Customer Address Widget

Step 1: Implement Server-Side Terminal Call

Create or Retrieve a Customer Profile (Backend)To initialize the widget for a user, you must first ensure a customer profile exists in the backend system. This is identified by a unique customerIdentifier (e.g., the user’s email or internal ID). Depending on whether the user is new or already exists, follow the appropriate substep:

a. Create a New Customer (if not yet created)

If the user does not already exist in your backend, send a POST request to create a new customer profile:

curl --location https://api-stage.inabit.biz/v1/customer
--header Content-Type: application/json
--Authorization: Bearer 8119595e07cb3a87ccfa46cf32d989ad2c10349bee26d1885e89d7ef4ed8c2cb
data-row-{
  customerIdentifier: [email protected]
}
Response: The API will return a JSON object containing the customer's UUID (id)
which will be required in subsequent steps
{
  "data": {
      "id": "customer-uuid",
    }
}

b. Retrieve Existing Customer (if already created)

Store this id securely as customerUuid for future requests.

If you’ve already created a customer but did not save their UUID, you can retrieve it using their customerIdentifier:

curl --location https://api-stage.inabit.biz/v1/customer?customerIdentifier=encoded_email
--header Content-Type: application/json
--Authorization: Bearer 8119595e07cb3a87ccfa46cf32d989ad2c10349bee26d1885e89d7ef4ed8c2cb
Response:The API will return the customer object containing the UUID:
{
    "data": {
        "id": "customer-uuid",
     }
}

c. Once you have the customerUuid, you can proceed to generate the address token in the next step and then add the snippet for the token request:

curl --location 'https://api-stage.inabit.biz/v1/customer/address-token'
--header Content-Type: application/json
--Authorization:Bearer 8119595e07cb3a87ccfa46cf32d989ad2c10349bee26d1885e89d7ef4ed8c2cb
"data":{
    "customerUuid": "27b4f808-be6c-4701-bff3-6eeaad8389e9"
}'
Response: The API will return a JSON object containing the token id which will be required in subsequent steps.
{
  "data": {
            customerUuid": "customer-uuid",
            addressGenerationToken: "address-token-id",
    }
}

Widget API Key: (i.e.) 8119595e07cb3a87ccfa46..............1885e89d7ef4ed8c2cb

Note, your actual API Key will be displayed on the widget implementation guide per widget created, you will be able to copy it from there directly.

Step 2: Add Script Tag to page Header

a. Add the following script tag to your page header:

<script src="https://stage.inabit.biz/widget.js" ></script>

Step 3: Call open.widget Function

Call openwidget function with token id, should open in popup After the customer clicks on the button (buy with crypto for example )

Note, in this step, you'll be able to choose if the widget will be open as a re-direct or as an iFrame (inline with your user interface).

Each of the types has different open.widget functions formats, as shown below.

Redirect:

//token id is the id from response of previous step.
  window.openWidget(tokenId)

//if you want to open the widget in a popup, you can use the following code:
  window.openWidget(tokenId, {mode:'popup'})

Inline (iFrame):

//token id is the id from response of previous step.
  window.openWidget(tokenId, {mode:'iframe'})

//You can set full width to true to open the widget in 100%
  window.openWidget(tokenId, {mode:'iframe'}, {fullWidth: true})

Need any further help? Feel free to reach out to us if you encounter any issues during the widget implementation process.

Last updated

Was this helpful?