Skip to main content

Tutorial

1

Initialize your Gateway ID

Make sure you have created an account using the dashboard.
2

Create an Organization

If you are on testnet, you can create an organization automatically via the dashboard.If you are on mainnet, you can request for an organization here.
3

Copy Your Widget Key

Find the Widget Key underneath the “Developer Access” section of the Dashboard. Reference images below.
4

Find/Create a Schema

Find a schema that is applicable for the data you want to contribute. You can discover existing schemas using the Gateway Explorer . If you are playing around, you can use 1c2c98e4-5cbd-40db-b441-5f6c00dedeb5 to understand how it works!
This ID is for the sandbox/testnet environment.
To create your own schema, follow the instructions here.
5

Define API Call Body

Now you can insert the above information into the API call body found below:
const session = JSON.stringify({
  key: "YOUR-WIDGET-KEY",
  issuer: "YOUR-GATEWAY-ID",
  owner: "CUSTOMER-EMAIL-OR-WALLET",
  dataModel: "YOUR-DATA-MODEL-ID",
  callbackUrl: "YOUR-SUCCESS-URL",
  claim: {
    /*OBJECT WITH DATA*/
  },
});
Claim fields are in JSON format. For example, a string would be “teststring”: “value”.
6

Call the API

Generate a session for the user based on the parameters you have passed.
async function generateSession() {
const response = await axios.post(
  "https://widget.mygateway.xyz/api/issue/generate-session",
  session,
);
window.location.href = response.data.session.url
}

const generateButton = document.getElementById("generateSession");

generateButton.addEventListener("click", generateSession);

Utilizing a button on the front end is optional, the URL for a user can be passed in other methods. However, having a button is recommended in most cases.
7

Get the link from the response and send to user

The response that you should receive is something like this:
{
    "session": {
        "url": "https://widget.mygateway.xyz/issue/cc348d85-c723-4183-b174-8424793d481f"
    }
}
You can now pass this to the user to complete.

Video Tutorial

I