### Example GET Request for Signing
Source: https://developers.yoti.com/age-estimation/api-authentication
This example shows the format for a GET request before signing. Ensure to include a nonce and timestamp.
```http
GET GET&{endpoint}?nonce=b88ad843-13cc-44ba-a3e0-053f71d89b1f×tamp=1480509893
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (C#)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
This C# example demonstrates setting up a sandbox sharing profile and retrieving activity details. It configures the Yoti client to use the sandbox API URI.
```csharp
var sandboxOneTimeUseToken = sandboxClient.SetupSharingProfile(tokenRequest);
var yotiClient = new YotiClient(new HttpClient(), sandboxClientSdkid, keyPair);
Uri sandboxUri = new UriBuilder(
"https",
"api.yoti.com",
443,
"sandbox/v1").Uri;
yotiClient.OverrideApiUri(sandboxUri);
ActivityDetails activityDetails = yotiClient.GetActivityDetails(sandboxOneTimeUseToken);
// Perform tests
Assert.AreEqual("some@email", activityDetails.Profile.EmailAddress.GetValue());
```
--------------------------------
### Install Yoti SDK with Go
Source: https://developers.yoti.com/in-branch-verification/sandbox
Install the Yoti SDK for Go using the go get command. This is for Go projects.
```go
go get "github.com/getyoti/yoti-go-sdk/v2"
```
--------------------------------
### Example GET Request Signature
Source: https://developers.yoti.com/identity-verification-api
This example shows the structure of a signed GET request, including the HTTP method, path, SDK ID, nonce, and timestamp.
```text
GET&/sessions?sdkId=b88ad843-13cc-44ba-a3e0-053f71d89b1f&nonce=b88ad843-13cc-44ba-a3e0-053f71d89b1f×tamp=1480509893
```
--------------------------------
### Manual Iframe Launch with Session Initialization
Source: https://developers.yoti.com/identity-verification/render-the-user-view
This example demonstrates manually launching the Yoti Client SDK via an iframe and initializing the session using postMessage. It requires listening for a 'STARTED' event before posting the 'INIT_SESSION' message.
```html
```
--------------------------------
### Example GET Request for Signed Request
Source: https://developers.yoti.com/in-branch-verification/create-a-session
This example demonstrates the format of a GET request used for generating a signed request. It includes the HTTP method, path, SDK ID, nonce, and timestamp.
```http
GET GET&/sessions?sdkId=b88ad843-13cc-44ba-a3e0-053f71d89b1f&nonce=b88ad843-13cc-44ba-a3e0-053f71d89b1f×tamp=1480509893
```
--------------------------------
### Fetch Session Configuration using Yoti Java SDK
Source: https://developers.yoti.com/in-branch-verification/instructions
Illustrates fetching session configuration with the Yoti Java SDK. This example requires proper setup of the PEM key and SDK ID. Error handling for security, URI, and IO exceptions is included.
```java
byte[] payload = ...
try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair()
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withEndpoint("/sessions//configuration")
.withHttpMethod("GET")
.withQueryParameter("sdkId", "")
.build();
YourPojo yourPojo = signedRequest.execute(YourPojo.class);
} catch (GeneralSecurityException | URISyntaxException | IOException | ResourceException ex) {
ex.printStackTrace();
}
```
--------------------------------
### Get Yoti Go SDK
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Download and install the Yoti Go SDK using the go get command. For versions 2.4.0 and above, modules are used, and the Go toolchain fetches dependencies automatically.
```go
// As of version 2.4.0, modules are used. This means it's not necessary to get a copy or fetch all dependencies
// as instructed below, as the Go toolchain will fetch them as necessary.
// You can simply add a `require github.com/getyoti/yoti-go-sdk/v2` to go.mod.
// To download and install the Yoti SDK and its dependencies, run the following command from your terminal:
go get "github.com/getyoti/yoti-go-sdk/v3”
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (Go)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
This Go snippet shows how to initiate a sandbox sharing profile request and retrieve activity details. It configures the Yoti client to use the sandbox API URL.
```go
sandboxToken, err := sandboxClient.SetupSharingProfile(tokenRequest)
assert.NilError(t, err)
yotiClient := yoti.Client{
Key: pemFileBytes,
SdkID: sandboxClientSdkId,
}
yotiClient.OverrideAPIURL("https://api.yoti.com/sandbox/v1")
activityDetails, errStrings := yotiClient.GetActivityDetails(sandboxToken)
if len(errStrings) > 0 {
log.Fatalf("%v", errStrings)
}
assert.Equal(t, "some@email", activityDetails.UserProfile.EmailAddress().Value())
```
--------------------------------
### Install Yoti Sandbox SDK for Python
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Install the Yoti Client and Sandbox SDKs using pip. Ensure Python and pip are installed.
```python
# Yoti Client (skip if already installed)
pip install yoti
# Sandbox
pip install yoti-sandbox
```
--------------------------------
### Install Yoti .NET NuGet Package
Source: https://developers.yoti.com/digital-id/install-the-sdk
Install the Yoti NuGet package using the Package Manager Console. Refer to the NuGet website for alternative installation methods.
```csharp
// To install the Yoti NuGet package, you need to install NuGet Package Manager. After that, enter the following command in the console:
Install-Package Yoti
// For other installation methods, see https://www.nuget.org/packages/Yoti
```
--------------------------------
### Install Yoti .NET NuGet Package
Source: https://developers.yoti.com/digital-id/dbs-rtw-integration-guide
Use this command in the NuGet Package Manager Console to install the Yoti .NET SDK.
```powershell
// To install the Yoti NuGet package you will need to install NuGet.
// To import the latest Yoti SDK into your project, enter the following
// command from NuGet Package Manager Console in Visual Studio:
Install-Package Yoti
// For other installation methods, see https://www.nuget.org/packages/Yoti
```
--------------------------------
### Create Document Scan Session in Go
Source: https://developers.yoti.com/identity-verification/dbs-rtw-example-code
This Go example demonstrates creating a document scan session. It includes reading the private key, initializing the client, defining session parameters, and generating the iframe URL.
```go
sdkID := "YOTI_CLIENT_SDK_ID";
key, _ := ioutil.ReadFile("YOTI_KEY_FILE_PATH")
client, err := docscan.NewClient(sdkId, key)
if err != nil {
return nil, err
}
advancedIdentityProfile := []byte(`{
profiles: [
{
trust_framework: 'UK_TFIDA',
schemes: [
{
type: 'DBS',
objective: 'STANDARD',
label: 'DBS_EXAMPLE'
}
]
}
]
}`)
subject := []byte(`{
"subject_id": "subject-id-string"
}`)
var sdkConfig *create.SDKConfig
sdkConfig, err = create.NewSdkConfigBuilder().
withAllowHandoff(true).
WithSuccessUrl("https://localhost:8443/success").
WithErrorUrl("https://localhost:8443/error").
WithPrivacyPolicyUrl("https://localhost:8443/privacy-policy").
Build()
if err != nil {
return nil, err
}
sessionSpec, err = create.NewSessionSpecificationBuilder().
WithSDKConfig(sdkConfig).
WithAdvancedIdentityProfileRequirements(advancedIdentityProfile).
WithSubject(subject).
Build()
createSessionResult, err = client.CreateSession(sessionSpec)
if err != nil {
return nil, err
}
sessionId = createSessionResult.SessionID
clientSessionToken = createSessionResult.ClientSessionToken
func getIframeURL(sessionID, sessionToken string) string {
baseURL := "YOTI_DOC_SCAN_API_URL"
return fmt.Sprintf("%s/web/index.html?sessionID=%s&sessionToken=%s", baseURL, sessionID, sessionToken)
}
iFrameURL := getIframeURL(createSessionResult.SessionID, createSessionResult.ClientSessionToken)
```
--------------------------------
### Initialize Yoti Sandbox Client (Go)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Initialize the sandbox client using environment variables for the SDK ID and PEM file path. Ensure the key is parsed correctly.
```go
import (
"github.com/getyoti/yoti-go-sdk/v2"
"github.com/getyoti/yoti-go-sdk/v2/cryptoutil"
"github.com/getyoti/yoti-go-sdk/v2/file"
"github.com/getyoti/yoti-go-sdk/v2/profile/sandbox"
)
sandboxClientSdkId := os.Getenv("SANDBOX_CLIENT_SDK_ID")
pemFileBytes, err := file.ReadFile(os.Getenv("YOTI_KEY_FILE_PATH"))
assert.NilError(t, err) privateKey, err := cryptoutil.ParseRSAKey(pemFileBytes)
assert.NilError(t, err) sandboxClient := sandbox.Client{
ClientSdkID: sandboxClientSdkId,
Key: privateKey,
}
```
--------------------------------
### Create Share Session in Go
Source: https://developers.yoti.com/digital-id/quick-start
Set up a share session using the Yoti client in Go. This example shows how to build the policy and session configuration, and handle potential errors.
```go
policy := (&digitalidentity.PolicyBuilder{})
// using a predefined method to add an attribute
.WithFullName()
.WithEmail()
// if you wish the user to prove it's them by taking a selfie on share
.WithSelfieAuth()
.Build()
shareSessionConfig := (&digitalidentity.ShareSessionBuilder{})
.WithRedirectUri("/your-callback-url")
.WithPolicy(policy)
.Build()
shareSession, err := client.CreateShareSession(shareSessionConfig)
if err != nil {
return nil, err
}
shareSessionId := shareSession.Id
```
--------------------------------
### Generate Customer Letter SDK Example (Go)
Source: https://developers.yoti.com/in-branch-verification/instructions
This Go example shows how to construct and send a PUT request for generating customer instructions using the Yoti Go SDK. Ensure the PEM file content and SDK ID are correctly provided.
```go
import (
"io/ioutil"
"net/http"
"github.com/getyoti/yoti-go-sdk/v2/requests"
)
key, _ := ioutil.ReadFile("")
// Create session
request, _ := requests.SignedRequest{
HTTPMethod: http.MethodPut,
BaseURL: "https://api.yoti.com/idverify/v1",
Endpoint: "/sessions//instructions",
Params: map[string]string{
"sdkId": ""
},
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()
//get Yoti response
response, _ := http.DefaultClient.Do(request)
```
--------------------------------
### Get Envelope Status with Java
Source: https://developers.yoti.com/eSignatures/get-envelope
Utilize Apache HttpClient to perform a GET request for envelope information. This example demonstrates setting headers and parsing the JSON response.
```java
package com.yoti.sign;
import java.io.IOException;
import java.net.URI;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
public class MainGetEnvelope {
private static final String YOTI_SIGN_AUTH_TOKEN = "";
private static final String YOTI_SIGN_BASE_URL = "https://api.yotisign.com/v2";
public static void main(String[] args) {
CloseableHttpClient client = HttpClients.createDefault();
final String envelopeId = "";
HttpGet httpGet = new HttpGet();
httpGet.setHeader("Authorization", "Bearer " + YOTI_SIGN_AUTH_TOKEN);
URI uri = URI.create(YOTI_SIGN_BASE_URL + "/envelopes/" + envelopeId);
httpGet.setURI(uri);
try {
HttpResponse response = client.execute(httpGet);
JsonReader reader = Json.createReader(response.getEntity().getContent());
JsonObject envelopeInfo = reader.readObject(); // Access envelopeInfoHere
} catch (IOException e) {
e.printStackTrace();
}
}
}
```
--------------------------------
### Get Envelope Status with C#
Source: https://developers.yoti.com/eSignatures/get-envelope
Use HttpClient in C# to make a GET request to retrieve envelope status. This example includes setting the Authorization header and handling the response.
```csharp
using (HttpRequestMessage request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.yotisign.com/v2/envelopes/")
})
{
request.Headers.Add("Authorization", "Bearer " + "");
using (HttpClient httpClient = new HttpClient())
{
HttpResponseMessage response = httpClient.SendAsync(request).Result;
string responseContent = response.Content.ReadAsStringAsync().Result;
return new JsonResult(
responseContent,
new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
});
}
}
```
--------------------------------
### Initialize Yoti C# Client
Source: https://developers.yoti.com/digital-id/install-the-sdk
Set up the Yoti client in C# by providing the SDK ID and a stream to your private key file.
```csharp
const string SDK_ID = "YOTI_CLIENT_SDK_ID";
const string PEM_PATH = "YOTI_KEY_FILE_PATH";
var privateKeyStream = System.IO.File.OpenText(PEM_PATH);
var yotiClient = new YotiDigitalIdentityClient(SDK_ID, privateKeyStream);
```
--------------------------------
### Example POST Request Signature
Source: https://developers.yoti.com/identity-verification-api
This example illustrates the format of a signed POST request, which includes the base64 encoded request body in addition to the elements present in a GET request signature.
```text
POST&/sessions?sdkId=b88ad843-13cc-44ba-a3e0-053f71d89b1f&nonce=b88ad843-13cc-44ba-a3e0-053f71d89b1f×tamp=1480509893&ew0KImlkIiA6IDEsDQoibmFtZSIgOiBpdGVtDQoNCn0=
```
--------------------------------
### Initialize Yoti Sandbox Client (C#)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Initialize the SandboxClient by loading your RSA key and providing the client SDK ID. Ensure the PEM file path is correct.
```csharp
Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair keyPair;
using (StreamReader stream = File.OpenText("/path/to/your-pem-file.pem"))
{
keyPair = Yoti.Auth.CryptoEngine.LoadRsaKey(stream);
}
const string sandboxClientSdkid = "CLIENT_SDK_ID";
SandboxClient sandboxClient = new SandboxClientBuilder()
.WithClientSdkId(sandboxClientSdkid)
.WithKeyPair(keyPair)
.Build();
```
--------------------------------
### Initialize Yoti Doc Scan Client - Go
Source: https://developers.yoti.com/identity-verification/understanding-the-result
Set up the Doc Scan client in Go using your SDK ID and PEM key. Handle potential errors during client initialization.
```go
sdkId := "YOUR_SDK_ID"
key, _ := ioutil.ReadFile("/path/to/pem")
client, err := docscan.NewClient(sdkId, key)
if err != nil {
fmt.Println(err)
}
```
--------------------------------
### Get Session in Python
Source: https://developers.yoti.com/identity-verification/results
Initiate a session retrieval in Python. This is the starting point for accessing session data, including liveness checks.
```python
session_result = doc_scan_client.get_session(session_id)
```
--------------------------------
### Get Liveness Capture Resources in JavaScript
Source: https://developers.yoti.com/identity-verification/retrieve-userdata
Returns a collection of liveness capture resources. No specific setup or imports are required beyond having the resources object available.
```javascript
// Returns a collection of liveness capture resources
const livenessCapture = resources.getLivenessCapture();
```
--------------------------------
### Configure Session Response - Python
Source: https://developers.yoti.com/in-branch-verification/sandbox
Configure Yoti session response settings using Python. This example demonstrates building a signed request and executing it. Ensure the 'yoti_python_sdk' is installed.
```python
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_string = json.dumps(data).encode()
signed_request = (
SignedRequest
.builder()
.with_pem_file("https://api.yoti.com/sandbox/idverify/v1")
.with_base_url("")
.with_endpoint("/sessions//response-config")
.with_http_method("PUT")
.with_query_param("sdkId", "")
.with_payload(payload_string)
.build()
)
# get Yoti response
response = signed_request.execute()
response_payload = json.loads(response.text)
```
--------------------------------
### Generate Customer Letter SDK Example (Python)
Source: https://developers.yoti.com/in-branch-verification/instructions
This Python example shows how to create and execute a signed request for generating customer instructions. Ensure the PEM file path and SDK ID are correctly set.
```python
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 get_session():
payload = {} # payload
payload_string = json.dumps(payload).encode()
signed_request = (
SignedRequest
.builder()
.with_pem_file("")
.with_base_url("https://api.yoti.com/idverify/v1")
.with_endpoint("/sessions//instructions")
.with_http_method("PUT")
.with_payload(payload_string)
.with_param("sdkId", "")
.build()
)
response = signed_request.execute()
response_payload = json.loads(response.text)
//get Yoti response
print(get_session())
```
--------------------------------
### Retrieve User Profile in PHP
Source: https://developers.yoti.com/digital-id/quick-start
Use `fetchShareReceipt` to get the receipt and then access profile details. This example shows how to retrieve application profile information as well as user profile data.
```php
fetchShareReceipt($receiptId);
$sessionId = $shareReceipt->getSessionId();
$rememberMeId = $shareReceipt->getRememberMeId();
$parentRememberMeId = $shareReceipt->getParentRememberMeId();
$applicationProfile = $shareReceipt->getApplicationContent()->getProfile();
$applicationName = $applicationProfile->getApplicationName();
$profile = $shareReceipt->getProfile();
$fullName = $profile->getFullName()->getValue();
$dateOfBirth = $profile->getDateOfBirth()->getValue();
$nationality = $profile->getNationality()->getValue();
$postalAddress = $profile->getPostalAddress()->getValue();
$structuredPostalAddress = $profile->getStructuredPostalAddress()->getValue();
$selfieImageObj = $profile->getSelfie()->getValue();
$selfieImageBase64Content = $selfieImageObj->getBase64Content();
$documentDetails = $profile->getDocumentDetails()->getValue();
```
--------------------------------
### Fetch Session Configuration using Yoti Go SDK
Source: https://developers.yoti.com/in-branch-verification/instructions
Provides an example of fetching session configuration using the Yoti Go SDK. This code snippet demonstrates setting up the HTTP request with authentication details and parameters.
```go
import (
"io/ioutil"
"net/http"
"github.com/getyoti/yoti-go-sdk/v2/requests"
)
sdkID := "";
key, _ := ioutil.ReadFile("")
// Create session
sessionRequest, _ := requests.SignedRequest{
HTTPMethod: http.MethodGet,
BaseURL: "https://api.yoti.com/idverify/v1",
Endpoint: "/sessions//configuration",
Params: map[string]string{
"sdkId": sdkID,
},
Headers: map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"application/json"},
},
}.WithPemFile(key).Request()
//get Yoti response
sessionResponse, _ := http.DefaultClient.Do(sessionRequest)
```
--------------------------------
### Initialize Yoti Go Client
Source: https://developers.yoti.com/digital-id/install-the-sdk
Create a new Yoti client in Go using your SDK ID and the content of your PEM key file.
```go
sdkID := "YOTI_CLIENT_SDK_ID";
pemKey, _ := ioutil.ReadFile("YOTI_KEY_FILE_PATH")
client, err := yoti.NewDigitalIdentityClient(sdkId, pemKey)
```
--------------------------------
### Get Yoti Go SDK
Source: https://developers.yoti.com/age-estimation/liveness-integration-guide
Download and install the Yoti SDK for Go projects using the Go toolchain. As of v2.4.0, modules are used, so you can simply add `require github.com/getyoti/yoti-go-sdk/v2` to your go.mod file.
```go
go get "github.com/getyoti/yoti-go-sdk/v3"
```
--------------------------------
### Extend Recipient Tokens using Node.js
Source: https://developers.yoti.com/eSignatures/extend-recipient-tokens
This Node.js example uses the 'request-promise' library to send a POST request to extend recipient tokens. Ensure you have the library installed and replace placeholders with your actual values.
```javascript
const rp = require("request-promise");
const extendToken = () => {
const request = {
method: "POST",
uri: "/v2/envelopes/:envelopeId/extend-tokens",
body: JSON.stringify({
"recipient_tokens": [
,
]
}),
headers: {
authorization: "Bearer ",
},
};
return rp(request)
.then((body) => body)
.catch((err) => err);
};
//send request
let result = await extendToken();
```
--------------------------------
### Initialize Yoti Sandbox Client (PHP)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Initialize the Sandbox client with your client SDK ID and the path to your PEM file. Handle potential exceptions.
```php
[
'Authorization' => 'Bearer ' . YOUR_API_KEY,
'Content-Type' => 'application/json',
],
'body' => [
"recipient_tokens" => [
,
],
],
]
);
$client = new Client();
$response = $client->send($request);
$json = json_decode($response->getBody());
```
--------------------------------
### Write PDF to File in C#
Source: https://developers.yoti.com/in-branch-verification/instructions
Fetches PDF instructions using a signed HTTP request and saves the content to 'instructions.pdf'. This example uses HttpClient and Yoti's Auth Web library. Ensure PEM content is correctly provided.
```csharp
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Yoti.Auth.Web;
HttpClient _httpClient = new HttpClient();
Request signedRequest = new RequestBuilder()
.WithBaseUri(new Uri("https://api.yoti.com/idverify/v1"))
.WithKeyPair("PEM_CONTENT")
.WithEndpoint("/sessions//instructions/pdf")
.WithHttpMethod(HttpMethod.Get)
.WithQueryParam("sdkId", "")
.Build();
// get Yoti Response
HttpResponseMessage response = await signedRequest.Execute(_httpClient).ConfigureAwait(false);
// get parsed response
var instructions = await response.Content.ReadAsByteArrayAsync();
// Decode instructions octet stream to base64
var base64 = Convert.ToBase64String(instructions);
// Convert base64 to pdf
var pdf = Convert.FromBase64String(base64);
// Write pdf to file
var fileName = "instructions.pdf";
await File.WriteAllBytesAsync(fileName, pdf);
Console.WriteLine($"PDF saved to {fileName}");
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (Ruby)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
This Ruby code configures the Yoti client for the sandbox environment and retrieves activity details using a generated token. It sets the API endpoint via configuration.
```ruby
# Initilise Yoti Client with Sandbox URL
Yoti.configure do |config|
config.client_sdk_id = ENV['YOTI_SANDBOX_CLIENT_SDK_ID']
config.key_file_path = ENV['YOTI_KEY_FILE_PATH']
config.api_endpoint = 'https://api.yoti.com/sandbox/v1'
end
token = sandbox_client.setup_sharing_profile(token_request)
activity_details = Yoti::Client.get_activity_details(token)
```
--------------------------------
### Configure SDK Preferences in Go
Source: https://developers.yoti.com/identity-verification/dbs-rtw-create-a-session
Set up SDK configuration for Yoti, including camera access, color preferences, locale, and URLs for success and error states. Defaults are applied if not provided.
```go
var sdkConfig *create.SDKConfig
sdkConfig, err = create.NewSdkConfigBuilder().
WithAllowsCamera().
WithPrimaryColour("#2d9fff").
WithSecondaryColour("#FFFFFF").
WithFontColour("#FFFFFF").
WithLocale("en-GB").
WithPresetIssuingCountry("GBR").
WithSuccessUrl("https://localhost:8080/success").
WithErrorUrl("https://localhost:8080/error").
withAllowHandoff(true).
Build()
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (PHP)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
This PHP snippet shows how to obtain a token from the sandbox environment and then use it to fetch activity details. It configures the Yoti client to use the sandbox API endpoint.
```php
setupSharingProfile($tokenRequest)->getToken();
$yotiClient = new YotiClient('SANDBOX_CLIENT_SDK_ID', '/path/to/your-pem-file.pem', [
'api.url' => 'https://api.yoti.com/sandbox/v1'
]);
$activityDetails = $yotiClient->getActivityDetails($token);
```
--------------------------------
### Yoti PHP SDK Setup for Session Creation
Source: https://developers.yoti.com/identity-verification/quick-start
This PHP snippet shows the initial setup for using the Yoti SDK to create a session. It includes the necessary require_once statement and namespace imports for session-related classes.
```php
)
.withKeyPair(FileKeyPairSource.fromFile(new File("")))
.build();
HumanProfile result = yotiClient.getActivityDetails(sharingToken).getUserProfile();
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (JavaScript)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Use this snippet to set up a sandbox sharing profile and retrieve activity details using a generated token. Ensure the Yoti client is configured for the sandbox API endpoint.
```javascript
sandboxProfileClient.setupSharingProfile(tokenRequest)
.then((response) => {
const token = response.getToken();
// Use token to get activity details.
const yotiClient = new yoti.Client(SANDBOX_CLIENT_SDK_ID, PEM, {
apiUrl: 'https://api.yoti.com/sandbox/v1'
});
yotiClient.getActivityDetails(token)
.then((activityDetails) => {
// Handle response here.
});
})
.catch((err) => {
// Handle unhappy path.
});
```
--------------------------------
### Initialize Yoti Sandbox Client (Python)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Initialize the SandboxClient using your SDK ID and PEM file location. Ensure the SDK ID and file path are correctly set.
```python
from yoti_python_sandbox import SandboxClientBuilder
from yoti_python_sandbox import SandboxAgeVerificationBuilder
from yoti_python_sandbox import YotiTokenRequestBuilder
sdk_id = "CLIENT_SDK_ID"
pem_file_location = "/path/to/your-pem-file.pem"
client = (SandboxClientBuilder()
.for_application(sdk_id)
.with_pem_file(pem_file_location)
.build())
```
--------------------------------
### Generate Customer Letter SDK Example (PHP)
Source: https://developers.yoti.com/in-branch-verification/instructions
This PHP example demonstrates how to build a PUT request for generating customer instructions using the Yoti SDK. Provide the correct PEM file path and SDK ID.
```php
withBaseUrl('https://api.yoti.com/idverify/v1')
->withPemFilePath('')
->withEndpoint('/sessions//instructions')
->withMethod('PUT')
->withPayload(Payload::fromJsonData($payload))
->withQueryParam('sdkId', '')
->build()
//get Yoti Response
->execute();
```
--------------------------------
### Get Share Receipt in C#
Source: https://developers.yoti.com/digital-id/dbs-rtw-integration-guide
This C# example demonstrates retrieving a share receipt and accessing user profile attributes like session ID, remember me IDs, selfie image, and document details. It includes a check for the existence of an identity profile report.
```csharp
ShareReceipt shareReceipt = yotiClient.GetShareReceipt(receiptId);
string sessionId = shareReceipt.SessionId;
string rememberMeId = shareReceipt.RememberMeId;
string parentRememberMeId = shareReceipt.ParentRememberMeId;
YotiProfile profile = shareReceipt.Profile;
Image selfie = profile.Selfie?.GetValue();
string selfieURI = profile.Selfie?.GetValue().GetBase64URI();
var documentDetails = profile.DocumentDetails.GetValue();
bool hasIdentityProfile = profile.IdentityProfileReport != null ? true : false;
if (hasIdentityProfile) {
var identityProfileReport = profile.IdentityProfileReport.GetValue();
}
```
--------------------------------
### Create Yoti Session in Go
Source: https://developers.yoti.com/identity-verification/dbs-rtw-create-a-session
Initializes the Go client with the SDK ID and private key, then calls CreateSession. Error handling for key reading and session creation is included.
```go
sdkID := "YOTI_CLIENT_SDK_ID";
key, _ := ioutil.ReadFile("YOTI_KEY_FILE_PATH")
client, err := docscan.NewClient(sdkId, key)
createSessionResult, err = client.CreateSession(sessionSpec)
sessionId = createSessionResult.SessionID
clientSessionToken = createSessionResult.ClientSessionToken
```
--------------------------------
### Setup Sandbox Sharing Profile and Get Activity Details (Python)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
This Python code configures the Yoti SDK for the sandbox environment and retrieves activity details using a generated token. It sets the API endpoint and initializes the client with SDK ID and key file path.
```python
from yoti_python_sdk import Client
import yoti_python_sdk
yoti_python_sdk.YOTI_API_ENDPOINT = "https://api.yoti.com/sandbox/v1"
client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
token_response = sandboxClient.setup_sharing_profile(token_request)
token = token_response.token
activity_details = client.get_activity_details(token)
```
--------------------------------
### Initialize Yoti Client (Python)
Source: https://developers.yoti.com/digital-id-legacy/install-the-sdk
Initialize the Yoti client in Python using the SDK ID and key file path.
```python
from yoti_python_sdk import Client
client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
```
--------------------------------
### Install Yoti Sandbox SDK for Node.js
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Install the Yoti Client and Sandbox SDKs using npm. Ensure you have Node.js and npm installed.
```javascript
// Yoti Client (skip if already installed)
npm install -S -E yoti
// Sandbox
npm install -S -E -D @getyoti/sdk-sandbox
```
--------------------------------
### Generate Customer Letter SDK Example (Java)
Source: https://developers.yoti.com/in-branch-verification/instructions
This Java example demonstrates how to build and execute a signed request for generating customer instructions using the Yoti SDK. Handle potential exceptions like GeneralSecurityException and IOException.
```java
byte[] INSTRUCTIONS_OBJ = ...
try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair()
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withEndpoint("/sessions//instructions")
.withPayload(INSTRUCTIONS_OBJ)
.withHttpMethod("PUT")
.withQueryParameter("sdkId", "")
.build();
YourPojo yourPojo = signedRequest.execute(YourPojo.class);
} catch (GeneralSecurityException | URISyntaxException | IOException | ResourceException ex) {
ex.printStackTrace();
}
```
--------------------------------
### Example Response
Source: https://developers.yoti.com/eSignatures/search-envelope
This is an example of a successful response from the API.
```APIDOC
## Example Response
This is an example of a successful response from the API.
### Response Example
```json
{
"envelopes": [
{
"envelope_id": "string",
"envelope": "string",
"status": "string",
"created_at": "string"
}
],
"total": number
}
```
## Error codes
If the request is unsuccessful a response code and a message will be sent
```
--------------------------------
### Initialize DocScanClient in PHP
Source: https://developers.yoti.com/identity-verification/dbs-rtw-example-code
Shows the basic initialization of the DocScanClient in PHP using the SDK ID and the path to the PEM file. This is the first step before configuring and creating a session.
```php
use Yoti\DocScan\DocScanClient;
use Yoti\DocScan\Session\Create\SdkConfigBuilder;
use Yoti\DocScan\Session\Create\SessionSpecificationBuilder;
$YOTI_CLIENT_SDK_ID = 'YOTI_CLIENT_SDK_ID';
$YOTI_PEM = '/path/to/pem';
$docScanClient = new DocScanClient($YOTI_CLIENT_SDK_ID, $YOTI_PEM);
```
--------------------------------
### Install Yoti Sandbox NuGet Packages (.NET)
Source: https://developers.yoti.com/digital-id-legacy/sandbox
Install the Yoti and Yoti.Sandbox NuGet packages using the Package Manager Console in Visual Studio. Ensure NuGet is installed.
```csharp
// To install the Yoti NuGet package you will need to install NuGet.
// To import the latest Yoti SDK into your project, enter the following
// command from NuGet Package Manager Console in Visual Studio:
// Yoti Client (skip if already installed)
Install-Package Yoti
// Sandbox
Install-Package Yoti.Sandbox
// For other installation methods, see https://www.nuget.org/packages/Yoti
```