> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.gbgplc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run the age verification sample app

> Run the gaming age verification sample app against your own journey, on a backend that calls the GBG Go Journey API v2 directly or through the Core SDK.

In this tutorial, you'll run a working player sign-up application against your own GBG Go journey.

The source for this sample app is on GitHub:

* [go-sample-frontend](https://github.com/gbgplc/go-sample-frontend): the React front end, shared by all three sample apps.
* [go-sample-backend-java](https://github.com/gbgplc/go-sample-backend-java): the Java backends.
* [go-sample-backend-typescript](https://github.com/gbgplc/go-sample-backend-typescript): the TypeScript backends.

Each backend repository holds two implementations of the same service, in separate folders:

* `api-implementation/` calls the Journey API with hand-written HTTP requests.
* `sdk-implementation/` calls the Journey API through the Core SDK.

You need the front end and one backend. Every backend exposes the same HTTP API, so the front end works with any of them.

## What this tutorial covers

By the end, you'll have a player sign-up application that:

* Starts a verification journey through the Journey API v2, either directly or through the Core SDK.
* Renders each screen from the journey's own configuration, rather than from hardcoded forms.
* Collects identity details, contact details, a current and previous address, a photo ID, and a selfie.
* Confirms the player meets the age requirement and screens them for financial vulnerability.
* Polls for the outcome and shows the decision, including a referral to manual review.

When a journey finishes, you can see it in the [Investigation](https://docs.go.gbgplc.com/docs/go-v2/platform/investigate/overview.md) portal.

> [!NOTE]
>
> This tutorial covers the developer-first integration, through the Journey API or the Core SDK. It doesn't cover hosted journeys or the Bridge SDKs. For how the sample apps are built and what they share, see the [Sample applications overview](https://docs.go.gbgplc.com/docs/go-v2/tutorials/sample-apps-overview.md).

## Prerequisites

* Access to the Go dashboard, with permission to create and publish journeys.
* Licences for the modules this tutorial uses. Licences are assigned to your department by GBG, and an unlicensed module shows a warning icon in the Journey builder.
* An API client. See [Manage API clients](https://docs.go.gbgplc.com/docs/go-v2/platform/account-management/manage-api-clients.md) for how to create one and get your client ID and secret.
* Node.js v18 or higher, for the front end and the TypeScript backend.
* JDK 21 and Maven, only if you choose the Java backend.
* Git, to clone the sample repositories.

The TypeScript SDK backend needs Node.js 18.17 or later.

The modules this journey uses are Document Classification v2, Document Extraction v2, Document Authentication v2, Facematch Verification, PEPs and Sanctions Standard, Address Verification (Global), Financial Vulnerability, Age Verification, and Data Verification.

## Part 1: Build the journey

The application renders its screens from whatever your journey collects, so the journey comes first.

A gaming journey has two obligations beyond confirming identity. It has to establish that the player is old enough, and it has to flag signs of financial vulnerability so that safer gambling measures can follow.

The finished journey looks like this. Nine modules run in sequence, then one evaluation node routes the player to accept, reject, or manual review.

![The age verification journey in the Journey builder, showing nine verification modules followed by an evaluation node with three decision branches](https://mintcdn.com/gbg-loqate/OqzRdZL16lGMrRFl/images/gaming-journey.png?fit=max\&auto=format\&n=OqzRdZL16lGMrRFl\&q=85\&s=53cd8e2b3e9d3dae99378cc48457c037)

The gaming age verification journey

**1. Add the modules**

In the Journey builder, add these modules in order:

| Module | What it does |
| - | - |
| Document Classification (Document Classification V2) | Identifies the document and confirms it is a type you accept |
| Document Extraction (Document Extraction V2) | Reads the data fields off the document |
| Document Authentication (Document Authentication V2) | Checks the document is genuine |
| Facematch Verification (Facematch Verification - NIST) | Compares the selfie against the document photo |
| PEPs and Sanctions (PEPs and Sanctions Standard) | Screens the player against politically exposed person and sanctions lists |
| Address Verification (Global) | Confirms the address is real and matches the player |
| Financial Vulnerability (UK Financial Vulnerability) | Returns a risk signal used for safer gambling checks |
| Age Verification (US Source 2 (including DOB)) | Confirms the player meets the age requirement |
| Data Verification (UK: Single match all sources) | Matches the player's details against trusted data sources |

> [!NOTE]
>
> Select the **v2** variant of each document module, for example **Document Classification v2** rather than **Document Classification**. The v2 variants are built for this API.

For instructions, see [Configure modules](https://docs.go.gbgplc.com/docs/go-v2/platform/journey-builder/configure-module.md).

**2. Set the country on Address Verification**

Address Verification takes the country from its own settings rather than from the player's address, so it needs setting before the journey runs.

1. Click the **Address Verification (Global)** module in the journey.
2. Click **Settings**.
3. In the **Country** field, enter the ISO3 code for the country you verify addresses in, for example `GBR`.
4. Click **Save all settings**.

> [!NOTE]
>
> ISO3 codes are the GO platform convention, so `GBR`, `FRA` or `DEU`. An ISO2 code such as `GB` is also accepted. For US addresses, use the dedicated US variant instead, which is certified for USPS DPV and CASS.

**3. Add the evaluation**

Add an **Evaluation** node after the modules and configure these three decisions. For how to add and configure one, see [Set up evaluation](https://docs.go.gbgplc.com/docs/go-v2/platform/journey-builder/set-up-evaluation.md).

| Decision | Classification | Match | Conditions |
| - | - | - | - |
| Reject | Negative | Any Match | PEPs and Sanctions is MATCH, Financial Vulnerability is High Risk, or Age Verification is Under Age |
| Manual review | Neutral | Any Match | Financial Vulnerability is Medium Risk, or Document Authentication is Medium Risk |
| Accept | Positive | Any Match | Document Classification is Document Classified, Document Extraction is Extraction Successful, Document Authentication is Low Risk, PEPs and Sanctions is NO MATCH, Financial Vulnerability is Low Risk, or Age Verification is Of Age |

Set the classification on each decision as shown. The application reads it to choose a result screen, where `positive` renders an approval, `negative` a decline, and `neutral` a referral to manual review.

Give each decision branch an **End of journey** node.

**4. Publish to Preview**

Click **Publish to Preview**. You'll see the confirmation message *Delivery deployed successfully*.

Use Preview while you build and test. Publish to Production when you're ready for real players. The application works the same against either, and only the resource ID changes.

**5. Copy the resource ID and version**

Go to **Dashboard** in the Journey builder and copy the **Resource ID** and **Version number**.

You'll combine them as `<resourceId>@<version>`, for example:

```
3e1582a0e437a4ceb5fffb0f9f1a0340cc4073d47cac7e034a97a92ba2115237@xn0ajeh5
```

> [!WARNING]
>
> Pin the exact version rather than using `@latest`. Every republish creates a new version, and a pinned application keeps running the version you tested until you change it deliberately.

## Part 2: Set up the backend

Choose a backend. Each one exposes the same HTTP API, so the front end works with any of them.

| Backend | Calls GBG Go with | Folder | Port |
| - | - | - | - |
| Java API | Hand-written HTTP requests | `go-sample-backend-java/api-implementation` | 8083 |
| TypeScript API | Hand-written HTTP requests | `go-sample-backend-typescript/api-implementation` | 8083 |
| Java SDK | The Core SDK, `com.gbg:go-core-sdk` | `go-sample-backend-java/sdk-implementation` | 8093 |
| TypeScript SDK | The Core SDK, `@gbg/go-core` | `go-sample-backend-typescript/sdk-implementation` | 8093 |

> [tab] Java API
>
> ```bash theme={null}
> git clone https://github.com/gbgplc/go-sample-backend-java.git
> cd go-sample-backend-java/api-implementation
> ```
>
> > [!WARNING]
> >
> > `.env.local` is listed in `.gitignore`, so Git doesn't track it. Never commit your client secret, and never put it in `application-*.yml`.
>
> Copy the example environment file:
>
> ```bash theme={null}
> cp .env.example .env.local
> ```
>
> Open `.env.local` and set your client credentials:
>
> ```bash theme={null}
> GBG_CLIENT_ID=your-client-id
> GBG_CLIENT_SECRET=your-client-secret
> ```
>
> Open `src/main/resources/application-ridgeline-play.yml` and set your journey:
>
> ```yaml theme={null}
> app:
>   resource-id: your-resource-id@your-version
> ```
>
> Start the service in live mode:
>
> ```bash theme={null}
> ./run.sh ridgeline-play live
> ```
>
> It listens on `http://localhost:8083`. The script finds JDK 21, loads `.env.local`, and starts the right profile.

> [tab] TypeScript API
>
> ```bash theme={null}
> git clone https://github.com/gbgplc/go-sample-backend-typescript.git
> cd go-sample-backend-typescript/api-implementation
> npm install
> ```
>
> > [!WARNING]
> >
> > `.env.local` is listed in `.gitignore`, so Git doesn't track it. Never commit your client secret, and never put it in a market config.
>
> Copy the example environment file:
>
> ```bash theme={null}
> cp .env.example .env.local
> ```
>
> Open `.env.local` and set your client credentials:
>
> ```bash theme={null}
> GBG_CLIENT_ID=your-client-id
> GBG_CLIENT_SECRET=your-client-secret
> ```
>
> Open `lib/config/markets/ridgelinePlay.ts` and set your journey:
>
> ```typescript theme={null}
> resourceId: 'your-resource-id@your-version',
> ```
>
> Start the service in live mode:
>
> ```bash theme={null}
> npm run dev:ridgeline-play:live
> ```
>
> It listens on `http://localhost:8083`.

> [tab] Java SDK
>
> ```bash theme={null}
> git clone https://github.com/gbgplc/go-sample-backend-java.git
> cd go-sample-backend-java/sdk-implementation
> ```
>
> > [!WARNING]
> >
> > `.env.local` is listed in `.gitignore`, so Git doesn't track it. Never commit your client secret, and never put it in `application-*.yml`.
>
> Copy the example environment file:
>
> ```bash theme={null}
> cp .env.example .env.local
> ```
>
> Open `.env.local` and set your client credentials:
>
> ```bash theme={null}
> GBG_CLIENT_ID=your-client-id
> GBG_CLIENT_SECRET=your-client-secret
> ```
>
> Open `src/main/resources/application-ridgeline-play.yml` and set your journey:
>
> ```yaml theme={null}
> app:
>   resource-id: your-resource-id@your-version
> ```
>
> Start the service in live mode:
>
> ```bash theme={null}
> ./run.sh ridgeline-play live
> ```
>
> It listens on `http://localhost:8093`. The script finds JDK 21, loads `.env.local`, and starts the right profile.

> [tab] TypeScript SDK
>
> ```bash theme={null}
> git clone https://github.com/gbgplc/go-sample-backend-typescript.git
> cd go-sample-backend-typescript/sdk-implementation
> npm install
> ```
>
> > [!WARNING]
> >
> > `.env.local` is listed in `.gitignore`, so Git doesn't track it. Never commit your client secret, and never put it in a market config.
>
> Copy the example environment file:
>
> ```bash theme={null}
> cp .env.example .env.local
> ```
>
> Open `.env.local` and set your client credentials:
>
> ```bash theme={null}
> GBG_CLIENT_ID=your-client-id
> GBG_CLIENT_SECRET=your-client-secret
> ```
>
> Open `lib/config/markets/ridgelinePlay.ts` and set your journey:
>
> ```typescript theme={null}
> resourceId: 'your-resource-id@your-version',
> ```
>
> Start the service in live mode:
>
> ```bash theme={null}
> npm run dev:ridgeline-play:live
> ```
>
> It listens on `http://localhost:8093`.

Run one backend at a time. The Java and TypeScript versions of each backend use the same port.

Every backend also has a mock mode that needs no credentials. Run `./run.sh ridgeline-play mock` or `npm run dev:ridgeline-play` to use it.

### Set your region

The samples default to the EU platform. If your tenant is in another region, then change the base URL and the region together, in the folder you chose:

> [!WARNING]
>
> Change both values. Authentication succeeds regardless of region, so a mismatch shows up later as journey calls failing against the wrong host.

> [tab] Java
>
> In `src/main/resources/application-ridgeline-play.yml`:
>
> ```yaml theme={null}
> go:
>   region: us
>   base-url: https://us.platform.go.gbgplc.com/v2/captain/
> ```

> [tab] TypeScript
>
> In `lib/config/markets/ridgelinePlay.ts`:
>
> ```typescript theme={null}
> go: {
>   region: 'us',
>   baseUrl: 'https://us.platform.go.gbgplc.com/v2/captain/',
> },
> ```

## Part 3: Set up the front end

The front end is one repository holding three applications. This tutorial uses the gaming one.

```bash theme={null}
git clone https://github.com/gbgplc/go-sample-frontend.git
cd go-sample-frontend
npm install
```

Create `apps/ridgeline-play/.env.local`, pointing at the backend you chose:

> [tab] API backend
>
> ```bash theme={null}
> NEXT_PUBLIC_ONBOARDING_TRANSPORT=rest
> NEXT_PUBLIC_API_BASE_URL=http://localhost:8083
> ```

> [tab] SDK backend
>
> ```bash theme={null}
> NEXT_PUBLIC_ONBOARDING_TRANSPORT=rest
> NEXT_PUBLIC_API_BASE_URL=http://localhost:8093
> ```

> [!NOTE]
>
> The front end compiles `NEXT_PUBLIC_*` values into the browser bundle when it starts. Never put credentials here, and restart the front end after you change them.

Start the front end:

```bash theme={null}
npm run dev:ridgeline-play
```

Open `http://localhost:3002`. With the backend already running, you'll land on the first screen of your own journey.

> [!TIP]
>
> If you see the **Sign up** screen, then the whole chain is working, from the browser through the front end and backend to GBG Go.

To understand the request flow the app uses, see [How the applications are built](https://docs.go.gbgplc.com/docs/go-v2/tutorials/sample-apps-overview.md#how-the-applications-are-built). For the calls each backend makes, see [How the API backends call GBG Go](https://docs.go.gbgplc.com/docs/go-v2/tutorials/sample-apps-overview.md#how-the-api-backends-call-gbg-go) and [How the SDK backends call GBG Go](https://docs.go.gbgplc.com/docs/go-v2/tutorials/sample-apps-overview.md#how-the-sdk-backends-call-gbg-go).

## Troubleshooting

> [accordion] The address screen keeps coming back
>
> This journey asks for six address components rather than the three some journeys use, so a screen plan written against a shorter address submits an incomplete element and the journey stays on that screen.

> [accordion] The app shows a generic 'A few more details' form
>
> The screen plan doesn't recognise something the journey collects, so the app falls back to a plain form rather than stalling.
>
> This usually means the journey changed after the plan was written. Check the backend log for `No screen mapped for outstanding elements`, which names the unmapped elements, then add them to the screen plan.

> [accordion] A screen asks for details the customer already entered
>
> The journey's required fields changed under the same resource ID. A republish can add required elements, so an address that needed three components can come back needing six, and a screen plan written against the old shape submits an incomplete element.
>
> Re-read `collects` after every republish rather than assuming the shape holds.

> [accordion] Every request fails with an expired session
>
> The backend keeps sessions in memory, so restarting it invalidates every session in progress. Start a new journey.
>
> For the same reason, the samples run one journey per browser tab. The session ID lives in `sessionStorage`, so reloading resumes the journey, but a new tab starts a fresh one.

> [accordion] Authentication succeeds but journey calls fail
>
> The region is mismatched. The token endpoint is global, so authentication works regardless, but journey calls go to a regional host. Check that `region` and `base-url` name the same region.

> [accordion] A module returns an error rather than a decision
>
> A module that errors is different from one that declines, because nothing was decided about the customer.
>
> Open the journey in the [Investigation](https://docs.go.gbgplc.com/docs/go-v2/platform/investigate/overview.md) portal and look at the failing step. It carries an error code, a problem description, a suggested action, and a correlation ID. Quote the correlation ID when contacting support, because it identifies the exact execution.

> [accordion] The backend logs 'No SDK submit mapping for field'
>
> The front end submitted a field that the SDK backend can't map onto the SDK's types, so the backend didn't send it. The journey might then ask for the same details again.
>
> Add the field to the submit mapping. In Java, that's `FieldMapping.KNOWN` in `SdkInteractionMapper.java`. In TypeScript, it's `buildSdkSubmitRequest.ts`.

> [accordion] The front end still talks to the backend you used before
>
> The front end reads `NEXT_PUBLIC_API_BASE_URL` when it starts. Set it to the port of the backend you're running now, then stop and restart the front end.

> [accordion] The backend won't start because the port is in use
>
> Another backend is using the port. The Java and TypeScript SDK backends share ports 8091 to 8093, so stop the other one first.

> [accordion] ConnectionError: fetch failed, or UNABLE\_TO\_GET\_ISSUER\_CERT\_LOCALLY
>
> This applies to the TypeScript backend only. Node.js uses its own list of trusted certificate authorities, so behind a TLS-inspecting proxy every call to GBG Go fails.
>
> On Node.js 22.15 or later, run `export NODE_OPTIONS=--use-system-ca` before you start the backend. On older versions, set `NODE_EXTRA_CA_CERTS` to the path of your proxy's root certificate.

## Next steps

> [card] [Review the outcome](https://docs.go.gbgplc.com/docs/go-v2/platform/investigate/overview.md)
>
> See the journeys you ran, module by module, in the Investigation portal.

> [card] [Configure outcomes](https://docs.go.gbgplc.com/docs/go-v2/guides/product-guides/configure-outcome-decisions.md)
>
> Change what each module reports, and how your evaluation turns those into decisions.

> [card] [Publish to Production](https://docs.go.gbgplc.com/docs/go-v2/platform/journey-builder/publish-journey.md)
>
> Move from Preview to Production when you're ready for real customers.

> [card] [Explore the API](https://docs.go.gbgplc.com/docs/go-v2/api-reference/endpoint/start-journey.md)
>
> The full Journey API v2 reference.
