Launch User View

Once you have set your sandbox response config, you will either need to fulfil the user view by launching the Yoti web sdk or bypass the user view by making an API call.. You may continue to render the Yoti web sdk through an iFrame, however the base_url will need to be updated first. The new sandbox iFrame URL is shown below:

https://api.yoti.com/sandbox/idverify/v1/web/index.html?sessionID=<inputsessionID>&sessionToken=<yoursessionToken>

If you would like to skip the user view, we have an API endpoint that you can hit to simulate the user interface being completed. The session Id and session token created in the earlier step must be used in the payload for this API request to work.

const { RequestBuilder, Payload } = require("yoti");

const request = new RequestBuilder()
.withBaseUrl("https://api.yoti.com/sandbox/idverify/v1")
.withPemFilePath("<YOTI_KEY_FILE_PATH>") // file path to PEM file
.withEndpoint("/agent")
.withPayload(new Payload(SKIP_UI))
.withMethod("POST")
.withQueryParam("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();

//get Yoti response
const response = await request.execute();
<?php
use Yoti\Http\RequestBuilder;
use Yoti\Http\Payload;
$request = (new RequestBuilder())
->withBaseUrl('https://api.yoti.com/sandbox/idverify/v1')
->withPemFilePath('<YOTI_KEY_FILE_PATH>')
->withEndpoint('/agent')
->withPayload(Payload::fromString(SESSION_JSON_STRING)) // * Version ^2: new Payload(SKIP_UI)
->withMethod('POST')
->withQueryParam('sdkId', '<YOTI_CLIENT_SDK_ID>')
->build()
//get Yoti Response
->execute();

// * For JSON data in Version >3 please use Payload::fromJsonData(SKIP_UI)
from yoti_python_sdk.http import SignedRequest, RequestHandler
import json
import requests

def execute(request):
response = requests.request(
url=request.url, data=request.data, headers=request.headers, method=request.method)
return response.content

def generate_session():

payload = {} # payload
payload_string = json.dumps(payload).encode()
signed_request = (
SignedRequest
.builder()
.with_pem_file("<YOTI_KEY_FILE_PATH>")
.with_base_url("https://api.yoti.com/sandbox/idverify/v1")
.with_endpoint("/agent")
.with_http_method("POST")
.with_param("sdkId", "<YOTI_CLIENT_SDK_ID>")
.with_payload(payload_string)
byte[] SKIP_UI = ...

try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair(<YOTI_KEY_FILE_PATH>)
.withBaseUrl("https://api.yoti.com/sandbox/idverify/v1")
.withEndpoint("/agent")
.withPayload(SKIP_UI)
.withHttpMethod("POST")
.withQueryParameter("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();

YourPojo yourPojo = signedRequest.execute(YourPojo.class);

} catch (GeneralSecurityException | URISyntaxException | IOException | ResourceException ex) {
ex.printStackTrace();
}
import (
"io/ioutil"
"net/http"
"github.com/getyoti/yoti-go-sdk/v2/requests"
)

key, _ := ioutil.ReadFile("<YOTI_KEY_FILE_PATH>")
// Create session
request, _ := requests.SignedRequest{
HTTPMethod: http.MethodPost,
BaseURL: "https://api.yoti.com/sandbox/idverify/v1",
Endpoint: "/agent",
Params: map[string]string{
"sdkId": "<YOTI_CLIENT_SDK_ID>"
},
Headers: map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"application/json"}
},
Body: func(data []byte, _ error) []byte {
return data
}(json.Marshal(jsonobj{ data },
})),
}.WithPemFile(key).Request()
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Yoti.Auth.Web;

HttpClient httpClient = new HttpClient();
StreamReader privateKeyStream = System.IO.File.OpenText("PEM_FILE_PATH");

string serializedRequest = Newtonsoft.Json.JsonConvert.SerializeObject(new
{
session_id = "YOUR_SESSION_ID",
client_session_token = "YOUR_SESSION_TOKEN"
});

byte[] byteContent = Encoding.UTF8.GetBytes(serializedRequest);

Uri _baseUrl = new UriBuilder("https", "api.yoti.com", 443, "sandbox/idverify/v1").Uri;

Yoti.Auth.Web.Request ageScanRequest = new RequestBuilder()
.WithStreamReader(privateKeyStream)
.WithBaseUri(_baseUrl)
.WithEndpoint("/agent")
.WithHttpMethod(HttpMethod.Post)

Payload Example

{
"session_id": "YOUR_SESSION_ID",
"client_session_token": "YOUR_SESSION_TOKEN"
}