Quickstart
Start contributing data under 10 minutes
Before starting, note that the Gateway Widget Issue can only be used for issuing PDAs by an organization. Make sure you already have an Organization and a Data Models.
Tutorial
Generate a Session
Now you can insert the required information into the API call body found below:
const sessionProps = JSON.stringify({
organizationId: "YOUR-ORGANIZATION-ID",
dataSourceId: "YOUR-DATA-SOURCE-ID",
callbackUrl: "YOUR-SUCCESS-URL",
claim: {
/*OBJECT WITH PDA DATA*/
/*Example*/
title: "Title example",
/*Example - End*/
},
image: "https://i.imgur.com/y9NTZyu.png", // add an image URL
title: "PDA-TITLE", // optional
description: "PDA-DESCRIPTION", // optional
referenceId: "REFERENCE-ID", // optional
});
async function generateSession() {
const response = await fetch(
"https://widget.mygateway.xyz/api/issue/generate-session",
{
method: "POST",
body: sessionProps,
}
);
const {
data: { session },
} = await response.json();
window.location.href = session.url;
}
const generateButton = document.getElementById("generateSession");
generateButton.addEventListener("click", generateSession);
The claim
fields are in JSON format. For example, a string would be
"teststring": "value"
.
Call the API
Generate a session for the user based on the parameters you have passed.
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",
"sessionId": "cc348d85-c723-4183-b174-8424793d481f"
}
}
You can now pass the url
to the user to complete the PDA issuance process.
A session can be used only once. Each call to the generate-session
API
creates a different session, even if the PDA data is the same.