Testing Guide

Berbix provides a testing framework to easily perform and automate end-to-end tests of the Berbix Verify Flow in your app. The framework enables you to mock the completion of a transaction without needing to submit any verification data such as photo ID or selfie images. When overriding the transaction result, all you need to do is specify the type of photo ID data (payload) and which flags you'd like returned in the API response.

You can override transaction results via the API on the server-side or interacting with the client-side JavaScript SDK directly. Instructions for both methods are included below.

Berbix currently provides the following sample verification payload values:

  • us-dl: a sample verification for a US driver license
  • us-id: a sample verification for a US identification card
  • passport: a sample verification for a US passport

Please reference the Sample Response Payload for a complete sample response payload and let us know if you need additional test cases!

Server-Side Testing

To override results via the API, simply call the Overrides endpoint (/transactions/override) after you have created a transaction via the API.

You will need to provide the response_payload and the list of flags (if any) desired in the transaction result. Possible values for the response_payload are enumerated below and you can read through all possible ID flags here.

After overriding the transaction data, you can fetch the verification overridden verification data as you would normally via the API.

Client-Side Testing

To get started, load the Berbix Verify Flow in test mode within your application or create a test transaction using our hosted flow.

In the verification flow, click Test mode- Click to override in the top left corner to start the test result override process.

In the subsequent view, you can select which verification response Payload and Flags you'd like returned in the verification result. After selecting an ID type via the Payload, you can add as many flags as you'd like to simulate common verification scenarios and corresponding business logic based on your flag action mapping. For instance, adding the flag for id_under_21 flag for any of the ID types would mimic the payload for a valid ID of someone under the age of 21.

The verification is overridden once you click Complete. The data is then available in the dashboard and for fetching via the API.

Generating development client tokens for Client-Side SDKs

There are two ways to create transactions for your client SDK integration testing.

  1. Create a transaction using the API documentation to create a transaction and access the client_token to paste into one of the client SDK implementations for testing.
api docs basic authapi docs basic auth

api docs basic auth

  1. Use one of the server side SDKs to create a client token and pass it to the client SDK implementation.

Viewing Overridden Transaction Data

To view overridden transactions, select All Transactions from the transactions list view or visit the transaction dashboard URL directly. Overridden transactions will be denoted by the >> icon in the transactions list view.

The transaction page will be presented similarly to other transactions however no image data will be available. Mock images are presented when fetching the transaction from the API.

Including Berbix in your CI processes

Your Continuous Integration processes might include integration tests that incorporate behavior controlled by the Berbix Verify Flow. Whenever that is the case, we recommend mocking that behavior rather than making calls to Berbix directly. Indeed, the Berbix Verify Flow has ample test coverage, which is continually maintained and improved by the Berbix Team. Moreover, we offer a status page which always contains the most up-to-date information on Berbix's status, obviating the need for you to run a health check against Berbix.

If you cannot mock Berbix in your application, we suggest using our Server-Side Testing options over our Client-Side Testing options. Please note that both of these options are primarily offered as a means to debug your integration, rather than continually test Berbix's behavior, and that we therefore enforce Test Transaction Rate Limits.

Test Transaction Limits

We rate-limit the creation of new test transactions based on the number of completed test transactions in a 4 hour sliding window. By default, you are limited to 25 completed test transactions per 4 hours. If you need this limit raised to debug your integration with Berbix, please reach out to [email protected]

Sample Response Payload

Berbix currently provides the following sample verification payload values:

  • us-dl: a sample verification for a US driver license
  • us-id: a sample verification for a US identification card
  • passport: a sample verification for a US passport

The API response for each payload option will be identical with the exception of the id_type field and the sources for each field. Let us know if you need additional test cases!

🚧

Fields returned vary based on customer

Please note that the specific fields returned via the API depend on your use case and account configuration. Let us know if you are expecting additional fields in your API response.

The example below is for a us-dl response with the id_under_21 flag included.

{
  "entity": "transaction_metadata",
  "id": 6257684466630656,
  "flags": [
    "id_duplicate_detected"
  ],
  "action": "review",
  "fields": {
    "given_name": {
      "value": "GIVEN",
      "confidence": "high",
      "sources": [
        {
          "value": "GIVEN",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "GIVEN",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "middle_name": {
      "value": "MIDDLE",
      "confidence": "high",
      "sources": [
        {
          "value": "MIDDLE",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "MIDDLE",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "family_name": {
      "value": "FAMILY",
      "confidence": "high",
      "sources": [
        {
          "value": "FAMILY",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "FAMILY",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "date_of_birth": {
      "value": "1990-12-15",
      "confidence": "high",
      "sources": [
        {
          "value": "1990-12-15",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "1990-12-15",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "sex": {
      "value": "F",
      "confidence": "high",
      "sources": [
        {
          "value": "F",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "F",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "age": {
      "value": "30",
      "confidence": "high",
      "sources": [
        {
          "value": "30",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "30",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "id_expiry_date": {
      "value": "2025-12-15",
      "confidence": "high",
      "sources": [
        {
          "value": "2025-12-15",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "2025-12-15",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "id_issue_date": {
      "value": "2020-12-15",
      "confidence": "high",
      "sources": [
        {
          "value": "2020-12-15",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "2020-12-15",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "id_number": {
      "value": "A0000000",
      "confidence": "high",
      "sources": [
        {
          "value": "A0000000",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "A0000000",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "id_type": {
      "value": "DL",
      "confidence": "high",
      "sources": [
        {
          "value": "DL",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "DL",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "id_issuer": {
      "value": "US-CA",
      "confidence": "high",
      "sources": [
        {
          "value": "US-CA",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "US-CA",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "address_street": {
      "value": "123 MAIN STREET",
      "confidence": "high",
      "sources": [
        {
          "value": "123 MAIN STREET",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "123 MAIN STREET",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "address_city": {
      "value": "San Francisco",
      "confidence": "high",
      "sources": [
        {
          "value": "San Francisco",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "San Francisco",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "address_subdivision": {
      "value": "CA",
      "confidence": "high",
      "sources": [
        {
          "value": "CA",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "CA",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "address_postal_code": {
      "value": "94105",
      "confidence": "high",
      "sources": [
        {
          "value": "94105",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "94105",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    },
    "address_country": {
      "value": "US",
      "confidence": "high",
      "sources": [
        {
          "value": "US",
          "type": "pdf417",
          "confidence": "high"
        },
        {
          "value": "US",
          "type": "ocr",
          "confidence": "medium"
        }
      ]
    }
  },
  "verifications": {},
  "created_at": "2020-04-16T22:14:35Z",
  "customer_uid": "",
  "duplicates": null,
  "dashboard_url": "https://dashboard.sandbox.berbix.com/transaction?orgId=[...]",
  "implementation_info": "The data for this transaction has been overridden with a test payload. Read more at https://docs.berbix.com/docs/testing"
}