Set up the SDK
The .NET verifier SDK verifies payslip payloads with Verifiabl. Verifiabl.Verifier sends the payload text and returns the result. The optional Verifiabl.Verifier.Extraction package reads the payload from a PDF, an image file or pixels.
This page gives the requirements, the client and its options. The guide also has these pages:
- Retries and timeouts: what the SDK retries and how to set the timeout.
- Handle errors: the exceptions that the SDK throws and what to do.
- Read payloads from documents: the extraction package.
For the steps to read and verify a payslip, follow Read and verify a payslip. For each type and member, refer to the .NET verifier SDK reference.
Requirements
Section titled “Requirements”The package supports .NET 8 or newer, and .NET Framework 4.7.2 or newer.
dotnet add package Verifiabl.Verifier --version 0.1.0-rc.3Make the client
Section titled “Make the client”Make one client. Use it for all calls. The client is thread-safe. It gets an access token and renews it before it expires.
using Verifiabl.Verifier;
string clientId = Environment.GetEnvironmentVariable("VERIFIABL_CLIENT_ID")!;string clientSecret = Environment.GetEnvironmentVariable("VERIFIABL_CLIENT_SECRET")!;
IVerifierClient verifier = new VerifierClient(new VerifierClientOptions{ Environment = VerifierEnvironment.Production, Auth = VerifierAuth.ClientCredentials(clientId, clientSecret),});In ASP.NET Core, register one client as a singleton. Then inject IVerifierClient.
using Verifiabl.Verifier;
builder.Services.AddSingleton<IVerifierClient>(_ => new VerifierClient(new VerifierClientOptions { Environment = VerifierEnvironment.Production, Auth = VerifierAuth.ClientCredentials(clientId, clientSecret), }));Give the cancellation token of the HTTP request to VerifyAsync. If the caller disconnects after the SDK sends the request, Verifiabl can record and charge the verification.
Client options
Section titled “Client options”| Option | Name | Default |
|---|---|---|
| Credentials | Auth |
Required |
| Environment | Environment |
VerifierEnvironment.Production |
| Timeout | Timeout |
30 seconds |
| Retries | MaxRetries |
2 |
| HTTP client | HttpClient |
Built in |
| Local verifier URL | VerifierBaseUrl |
None |
- Credentials are the client ID and the client secret from your onboarding. Set them with
VerifierAuth.ClientCredentials. Keep the client secret in a secrets manager. - Environment is production or sandbox. Use sandbox credentials with the sandbox. A payslip registered in one environment cannot be verified in the other.
- Timeout is the maximum time for one call, as a
TimeSpan. It includes the token request, all retries and the waits between them. Refer to Retries and timeouts. - Retries is the number of retries after the first attempt. Set
0to stop retries. - HTTP client replaces the
HttpClientthat the SDK uses. Most integrations do not set it. - Local verifier URL is for local development only. Use the environment for sandbox and production.
If you set HttpClient, the SDK does not dispose it. Keep its Timeout at Timeout.InfiniteTimeSpan. The SDK applies its own timeout. Do not add a retry handler to the HttpClient. The SDK retries.