QR Flow Usage
The QR Code flow enables a cross-device scanning flow. The scan can be initiated on the web, or on the server and your user can complete the flow on their mobile device. This method makes use of the often superior camera capabilities of mobile devices. The level of customization available is similar to that of the Modal Flow.
Starting a QR Code verification
To begin the flow, perform a POST
request to the https://dyscanweb.dyneti.com/api/v1/scan
endpoint:
const response = await fetch("https://dyscanweb.dyneti.com/api/v1/scan", {
method: "POST",
headers: {
"X-API-KEY": "YOUR_PUBLISHABLE_KEY_HERE",
"Content-Type": "application/json",
},
body: JSON.stringify({
verify: {
// See Verification Request for detailed explanation
name: "John Smith",
firstSix: "123456",
lastFour: "4321",
detectWrongCard: true,
},
options: {
// See scan configuration options
},
localization: {
// See localization options
},
}),
});
const parsedResponse = await response.json();
// show the QR code to the user
document.getElementById('qr-code-image').src = parsedResponse.qrCodeImageUrl;
You can show the QR code to the user by displaying the image referenced by the qrCodeImageUrl
property of the response. This response also includes the scanId
which you may wish to associate with the logged-in user. See below for the full response schema.
Response
{
scanFlowURL: String,
scanId: String,
qrCodeImageUrl: String
}
The verify
object supports the following options.
verify Request object
{
verify: {
name: String?,
firstSix: String?,
lastFour: String?,
doubleSided: Bool?,
detectWrongCard: Bool?
}
}
See Verification Request for the fields in the verify
object. For the localization
and options
objects inside the request body, see Localization and Scan Configuration respectively.
Getting the scan results
The results of the scan are available via the Scan API. The status
will be scanStarted
if the user has not opened the QR code URL yet.