Check your State Pension Frontend

This service provides the frontend endpoint for the Check your State Pension project, formally known as the National Insurance and State Pension project.

Other components:


This service provides the following useful information to the customer:

  • When they will reach State Pension age
  • How much their State Pension is currently worth
  • A forecast of what their State Pension will be when they reach State Pension age
  • A view of their National Insurance record, including any gaps


This service is written in Scala and Play, and needs at least a JRE version 8 to run.


This customer logs into this service using the Government Gateway


Rather than using IDs or classes, which can change when frameworks are invariably updated, we have switched to using data attributes. Here’s an example, using the page heading pattern.


We’ve added data-component hooks to the component’s semantic elements, and then appropriate attributes to identify the status of the non-semantic elements. These are purposefully using snakecase to avoid visual confusion with the class names.

<header class="hmrc-page-heading" data-component="nisp_page_heading"
  @if(specId){ data-spec="@specId"}>
  <h1 class="@classes.getOrElse("govuk-heading-xl")""
    data-component="nisp_page_heading__h1" { i => id="@{i}"}>
  <p class="govuk-caption-xl hmrc-caption-xl" data-component="nisp_page_heading__p">
    <span data-aria-hidden aria-hidden="true">
    <span data-visually-hidden class="govuk-visually-hidden">

View file

Call the component in the view file and add the new specId parameter:

    text = messages("nisp.main.h1.title"),
    section = messages("")),
    context = messages("nisp.nirecord.context"),
    specId = Some("state_pension__pageheading")

Spec file

Use the component’s specId attribute as scope to target the inner elements.

"render page with heading 'Your State Pension' and context " in {
    "[data-spec='state_pension__pageheading'] [data-visually-hidden]",


In the context of this application we use the following acronyms and define their meanings. Provided you will also find a web link to discover more about the systems and technology.

  • API: Application Programming Interface
  • HoD: Head of Duty
  • JRE: Java Runtime Environment
  • JSON: JavaScript Object Notation
  • NI: National Insurance
  • SP: State Pension
  • NINO: National Insurance Number
  • URL: Uniform Resource Locator


This code is open source software licensed under the Apache 2.0 License.