light-mode-image
Learn
Web

Build a web application that can request and verify credentials via the Digital Credentials API

Overview

DC API support is currently offered as a tech preview. As such, functionality may be limited, may not work in all scenarios, and could change or break without prior notice.

This guide demonstrates how to use the Verifier Web SDK to verify credentials using the Digital Credentials API (DC API).

Prerequisites

This guide builds on the Verifier Web SDK tutorial. It is recommended to complete that tutorial first, then return here to add support for the DC API workflow.

You will also need:

  • Version 2.1.0 or later of the Verifier Web SDK.
  • A web browser that supports the Digital Credentials API:
    • Chrome or a Chromium based browser v138 or later.
    • Safari v26 or later.
  • A wallet application that supports the Digital Credentials API for testing:
    • Google's developer wallet.
    • MATTR Labs wallet, available to selected MATTR customers/partners.

Adjusting your web application to use the DC API

Most of the Verifier Web SDK integration remains the same when using the DC API. The Verifier Web SDK automatically uses the DC API when all of the following conditions are met:

  1. The MATTR VII verifier application configuration has DC API support enabled.
  2. The user's browser supports the DC API.
  3. The credential request is for a single credential (DC API doesn't support multiple credentials in one request).
  4. No walletProviderId is provided in the request options.

If any condition is not met, the SDK falls back to the standard OID4VP flow.

These are the adjustments needed to make sure your verifier web application meets these conditions:

Add DC API support to your verifier application configuration

Add the dcApiConfiguration block to your verifier application configuration:

Request
PUT /v2/presentations/applications/{applicationId}
Request body
{
  // ... your existing configuration
  "dcApiConfiguration": {
    "supportedBrowserPlatforms": {
      "mobile": true,
      "desktop": true
    }
  }
}
  • supportedBrowserPlatforms: Specify which platforms should use DC API:
    • mobile: Set to true to enable DC API on mobile browsers.
    • desktop: Set to true to enable DC API on desktop browsers.

Conditionally omit the walletProviderId when calling the requestCredentials method

When requesting credentials via the DC API, the walletProviderId must be omitted (set to undefined) to allow the SDK to use the DC API flow.

You can achieve this by using the SDK's isDigitalCredentialsApiSupported method to check if the user's browser supports DC API and adjusting the request options accordingly (This method returns true if the browser supports DC API, false otherwise):

Request credentials with DC API
const options: MattrVerifierSDK.RequestCredentialsOptions = {
  // The array must contain exactly one query to align with the DC API's single credential requirement.
  credentialQuery: [credentialQuery],
  challenge: MattrVerifierSDK.utils.generateChallenge(),
  openid4vpConfiguration: {
    redirectUri: window.location.origin,
    walletProviderId: MattrVerifierSDK.isDigitalCredentialsApiSupported() ? undefined : "your-wallet-provider-id",
  },
};

const results = await MattrVerifierSDK.requestCredentials(options);

Test the DC API workflow

To test DC API integration, you need:

  1. A supported browser (see compatibility above).
  2. A DC API-compatible wallet with matching credentials:

The user experience should be seamless—the wallet interface appears directly in the browser without leaving your application.

Important considerations

  • No pre-flight check: There's no way to check in advance if the user has a matching credential in a DC API-compatible wallet. If they don't, the request will fail.
  • Error handling: Always implement robust error handling for scenarios where the user lacks compatible credentials or denies consent.

How would you rate this page?