Read and verify a payslip
Read the payload from the payslip QR code or its PDF metadata. Send it to Verifiabl. Verifiabl returns the registered payslip data and the employee details.
Send HTTP requests to the Verifier API, or use the .NET verifier SDK. The SDK gets and renews the access token. It sends an idempotency key with each verification, retries temporary errors and stops a call after a time limit. With HTTP, you do these steps yourself. Select HTTP or .NET at the top of the page.
For client options, retries and errors, refer to the Verifier SDK guide. For each type and member, refer to the .NET verifier SDK reference.
For the HTTP contract, refer to the Verifier API reference.
Environments
Section titled “Environments”Set Environment to VerifierEnvironment.Production or VerifierEnvironment.Sandbox. Use sandbox credentials in sandbox. The examples on this page use production.
- API:
https://verify.verifiabl.io - Token:
https://auth.verifiabl.io/oauth/token
- API:
https://verify.sandbox.verifiabl.io - Token:
https://auth.sandbox.verifiabl.io/oauth/token
When you get a token, set audience to the API URL for the environment. Use sandbox credentials in sandbox. The examples on this page use production.
Install the SDK
Section titled “Install the SDK”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.3To read payloads from PDFs and images, also install the extraction package. Refer to Platforms.
dotnet add package Verifiabl.Verifier.Extraction --version 0.1.0-rc.31. Authenticate
Section titled “1. Authenticate”Make a client with the client ID and client secret from your onboarding. The client gets an access token and renews it before it expires.
The Verifier API uses OAuth 2.0 client credentials. Use the client ID and client secret from your onboarding to get an access token.
POST https://auth.verifiabl.io/oauth/token
Content-Type: application/json
{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://verify.verifiabl.io",
"scope": "verifiabl:verifier"
}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),
});Make one client. Use it for all calls. The client is thread-safe. In ASP.NET Core, register it as a singleton. Refer to Make the client.
Send the access token with each request:
Authorization: Bearer YOUR_ACCESS_TOKENUse the token again until it is near expiry. If the API returns 401, get a new token. Then send the request again one time.
2. Read the payload
Section titled “2. Read the payload”Read the PDF metadata first. The property verifiabl:payload in the namespace https://verifiabl.io/ns/ contains the pipe-delimited payload. If the PDF does not have this property, decode the QR code. The QR code contains a scan URL. A copy made with print to PDF, or a photograph of the payslip, does not keep the metadata.
The .NET verifier SDK has an optional extraction package that reads the payload from a PDF or an image.
Use the extraction package to read the payload. Alternatively, read it with your own PDF and QR code tools.
Read the payload with the extraction package
Section titled “Read the payload with the extraction package”VerifyPdfAsync and VerifyImageAsync read the payload and verify it in one call. Do not do step 3. Verification contains the same VerificationResult as step 4.
using Verifiabl.Verifier;using Verifiabl.Verifier.Extraction.Pdf;
using FileStream pdf = File.OpenRead("payslip.pdf");PdfVerificationResult pdfResult = await verifier.VerifyPdfAsync(pdf, cancellationToken: cancellationToken);VerificationResult result = pdfResult.Verification;For images, pixels, limits and platforms, refer to Read payloads from documents.
Read the payload with your own tools
Section titled “Read the payload with your own tools”Read the PDF metadata first. The property verifiabl:payload in the namespace https://verifiabl.io/ns/ contains the payload. If the PDF does not have this property, read the QR code. Some copies of a PDF, and photographs of a payslip, do not keep the metadata.
If your QR code reader returns text from other codes, use VerifiablPayloadText.IsVerifiablShaped to find the Verifiabl codes. Send a payload only if the document has one Verifiabl code.
var payloads = new List<string>();foreach (string text in qrCodeTexts){ bool isNew = !payloads.Exists(found => VerifiablPayloadText.AreSamePayload(found, text)); if (VerifiablPayloadText.IsVerifiablShaped(text) && isNew) { payloads.Add(text); }}
// Send a payload in step 3 only if there is exactly one.string? selected = payloads.Count == 1 ? payloads[0] : null;Then send the payload, as in step 3. With this option, you need only Verifiabl.Verifier, which has no native dependency.
3. Send the payload
Section titled “3. Send the payload”Send the text without changes. If you send a scan URL, keep all of the text after the # character.
POST https://verify.verifiabl.io/v1/verifications/payload
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Idempotency-Key: 5f0c2a7e-8d4b-4c19-9e3a-7b6d1f2c4e80
{
"barcode": "2|n5waC35dPCoRtMXW5_gJqw|JVSWY3DPO5XXE3DE"
}var request = new VerificationRequest(payload);
VerificationResult result = await verifier.VerifyAsync(request, cancellationToken);The SDK sends the text to POST /v1/verifications/payload. It does not read PDFs or images, and it does not open the scan URL.
Each VerificationRequest has its own idempotency key. Keep the request to send it again. Refer to Idempotency key.
Send the request body as JSON. The response body is JSON.
The example includes the optional Idempotency-Key header. Refer to Idempotency key.
4. Read the response
Section titled “4. Read the response”If the payload is verified, step 2 or step 3 gives a VerificationResult. Read it without another call. If the payload could not be verified, the call throws VerifierRejectedException with the code NOT_VERIFIED. Refer to Handle errors.
using System.Text.Json;
string? schema = result.Schema;JsonElement payslip = result.Payslip;JsonElement employee = result.Employee;| Member | Description |
|---|---|
VerifiablReference |
The reference of the payslip. |
Schema |
The payslip schema, for example au.payslip.v2. |
Payslip |
The payslip data that the issuer registered, as JSON. Amounts are decimal strings. |
Employee |
The employee details, as JSON. |
DecryptedAt |
The time that Verifiabl decrypted the payload. |
RequestId |
The request ID. Give it to Verifiabl support if you need help with a verification. |
IdempotencyKey |
The idempotency key of the request. Give it when you ask Verifiabl about the verification or its charge. |
ToString() returns only the reference and the schema.
Map the result
Section titled “Map the result”Map the result after the verification, in your own code. The SDK does not map the result. This example keeps the money value as a string. It fails on a missing field or an unsupported schema.
var mapped = MapPayslip(result);
static (string Reference, string Currency, string Gross) MapPayslip(VerificationResult result){ if (result.Schema != "au.payslip.v2") { throw new NotSupportedException("This mapping requires au.payslip.v2."); }
var fields = result.Payslip.GetProperty("payslip_non_pii"); return ( result.VerifiablReference, fields.GetProperty("currency").GetString()!, fields.GetProperty("gross").GetString()!);}A mapping failure does not cancel the verification. Do not verify the payload again because of it.
The API returns the payslip data and the employee details in the response schema that you agreed with Verifiabl during onboarding.
The status code and code give the result for the payslip:
| Status | code |
Result |
|---|---|---|
200 |
The payload is verified. The response contains the payslip data and the employee details that the issuer registered. | |
422 |
NOT_VERIFIED |
The payload could not be verified. |
Other errors are temporary or are integration faults. Refer to Verification errors.
What a verified payload shows
Section titled “What a verified payload shows”A verified payload matches the record that its issuer registered. The response returns that registered data. Only the payload is checked, not the rest of the document. A verification does not show that the issuer’s data is correct or current. It does not show that the applicant is the person named in the payslip.
A NOT_VERIFIED result means only that the payload could not be verified. A damaged scan, a payslip that is not registered, or a barcode from another product or environment gives the same result.
Errors and retries
Section titled “Errors and retries”The SDK sends the request again after a timeout, a rate limit or a server error. By default, it makes 2 retries, and the call times out after 30 seconds. Refer to Retries and timeouts.
If the call cannot complete, the SDK throws a VerifierException. Use IsRetryable to find if the same call can succeed later. To try again, send the same VerificationRequest. Refer to Handle errors.
Use code to identify an error. Do not compare the error or detail text. This text can change. For the response body, refer to Error responses.
After a timeout, a rate limit or a server error, send the same payload again with the same Idempotency-Key. Use exponential backoff. The same payload gives the same verification result.
For status codes, response fields and a cURL example, refer to Verify a payslip barcode payload.
Idempotency key
Section titled “Idempotency key”Each VerificationRequest has a new idempotency key in IdempotencyKey. The SDK sends the key with each attempt, including its own retries. To try a verification again, send the same request. A new request is a new verification.
To try again from a new request, for example after a restart, save the key before the first attempt. Then set it on the new request:
var request = new VerificationRequest(payload) { IdempotencyKey = savedKey };VerificationResult result = await verifier.VerifyAsync(request, cancellationToken);VerificationResult.IdempotencyKey and VerifierException.IdempotencyKey give the key.
The Idempotency-Key header is optional. Its value is a universally unique identifier (UUID). Make a new UUID for each verification. Send the same UUID with each retry of that verification. Each key applies only to your organisation.
A key that is not a UUID gives 400 VALIDATION_FAILED.
Without a key, each request is a separate verification. Verifiabl charges for each successful verification.
For 1 hour after the first request with a key, a request with the same key and the same payslip verifies the payload again. Verifiabl charges one time for each key, for the first successful verification.
A key that you sent with a different payslip, or first sent more than 1 hour ago, gives 409 IDEMPOTENCY_KEY_REUSED. The response has no result and there is no charge. Send a new key.Make a new request.
When you ask Verifiabl about a verification or a charge, give the key.
Security
Section titled “Security”Send payloads over HTTPS. For how Verifiabl stores and protects data, refer to Architecture and data handling.