Skip to main content

Test your integration

Warning In September 2024, we limited each GOV.UK Pay service to one live account and one test account.

This change did not affect most GOV.UK Pay services.

How test accounts work in GOV.UK Pay

Each GOV.UK Pay service has:

  • one test account to test how GOV.UK Pay works
  • one live account to take real payments from users

Your test account type depends on your chosen payment service provider (PSP).

Payment service provider Test account type
Stripe Stripe test account
Worldpay Sandbox test account

You’re limited to one test account per GOV.UK Pay service. For example, if you have a sandbox test account, you cannot request a Stripe test account on the same GOV.UK Pay service.

Get a Stripe test account

You can use a Stripe test account to see how the following work:

You already have a Stripe test account if you created your GOV.UK Pay service after September 2024 and chose Stripe as your PSP.

You may have a sandbox test account if you created your GOV.UK Pay service before September 2024 and chose Stripe as your PSP.

It is not possible to swap a sandbox test account for a Stripe test account within the same GOV.UK Pay service. To get a Stripe test account, you need to create a new GOV.UK Pay service.

  1. Sign in to the GOV.UK Pay admin tool.
  2. Select Add a new service.
  3. When asked which type of organisation you work for, select Local authority, armed forces or police.
  4. Select Create service.

Your new service will have a Stripe test account.

Test data and API keys in your sandbox test account will not be available in your Stripe test account.

Stripe test accounts have a different set of mock card numbers.

Testing your service

You can use your test account to:

  • explore how the GOV.UK Pay API works
  • run automated smoke tests

Do not use your test account for automated integration tests that run every time you change your code. Build a ‘stub’ to simulate the GOV.UK Pay API instead, using a tool like WireMock or mountebank.

Testing the whole user journey

You should test the whole user journey.

If you’re using the API integration, you can create a link to GOV.UK Pay payment pages and add it to your service’s test page.

  1. Select the account you want to test in the GOV.UK admin tool.
  2. Select Test with your users to create the link.

You can also:

  • use mock card numbers to test both successful and unsuccessful payments
  • use HTTP instead of HTTPs for the return_url with your test account, so you do not need to set up a secure url for testing
  • test any payment links you have set up

You cannot use 3D Secure (3DS) with test accounts.

Performance testing

You must contact us to get written approval before you do any performance testing.

Mock card numbers and email addresses

Use mock card numbers and email addresses with your test account when you try payments as a user.

Do not use real card numbers or fake email addresses with your test account.

You must use mock email addresses when doing automated testing. If you are testing manually, you can use real email addresses.

You can enter any valid value for other payment fields. For example, the card expiry date can be any date in the future.

Mock card numbers

Mock card numbers do not work with your live account.

There are separate sets of mock card numbers for:

If you’re using a test (‘sandbox’) account

Testing action Card number Card brand Card type
Successful payment 4444333322221111 Visa Credit
Successful payment 4242424242424242 Visa Credit
Successful payment 4000056655665556 Visa Debit
Successful payment 4988080000000000 Visa Debit - corporate
Successful payment 4000160000000004 Visa Debit - prepaid
Successful payment 4131840000000003 Visa Debit - corporate prepaid
Successful payment 4000620000000007 Visa Credit - corporate
Successful payment 4000000000000010 Visa Credit or debit
Successful payment 5555555555554444 Mastercard Credit
Successful payment 5105105105105100 Mastercard Debit
Successful payment 5200828282828210 Mastercard Debit
Successful payment 371449635398431 American Express Credit
Successful payment 3566002020360505 JCB Credit
Successful payment 6011000990139424 Discover Credit
Card type not accepted 6759649826438453 Maestro Debit
Card declined 4000000000000002 Visa Credit or debit
Card expired 4000000000000069 Visa Credit or debit
Invalid CVC code 4000000000000127 Visa Credit or debit
General error 4000000000000119 Visa Credit or debit
Testing recurring payments on a test account

Recurring payments are made up of two stages:

  1. An initial payment to set up the agreement for recurring payments.
  2. Further recurring payments that are taken automatically without a user’s input.

To test both stages, we offer mock cards that have two testing actions - one for the initial payment and one for the further recurring payments.

Testing actions Card number Card brand Card type
1. Successul set up payment

2. Successful recurring payment
4000056655665556 Visa Debit
1. Successful set up payment

2. Unsuccessful recurring payment
5105105105105100 Mastercard Debit

If you’re using a test Stripe account

The PSP transaction fee depends on which country the test card is from.

Testing action Card number Card brand Card type Country
Successful payment 4000008260000000 Visa Credit UK
Successful payment 4000058260000005 Visa Debit UK
Successful payment 4000002500000003 Visa Credit France
Successful payment 4242424242424242 Visa Credit US
Successful payment 4000056655665556 Visa Debit US
Successful payment 5105105105105100 Mastercard Debit US
Successful payment 5200828282828210 Mastercard Debit US
Successful payment 371449635398431 American Express Credit US
Requires 3DS check 4000002500003155 Visa Credit France
Card declined 4000000000000002 Visa Credit or debit US
Card expired 4000000000000069 Visa Credit or debit US
Invalid CVC code 4000000000000127 Visa Credit or debit US
Payment disputed and lost 4000000000000259 Visa Credit US
Payment disputed and won 4000000000002685 Visa Credit US
General error 4000000000000119 Visa Credit or debit US
Testing recurring payments on a test Stripe account

There are additional mock card numbers to test recurring payments with Stripe.

Use these cards to test the two main steps of the recurring payment flow:

  • taking a payment to set up an agreement for recurring payments
  • taking further recurring payments without user input

Each card has a different result for these two steps.

Testing actions Card number Card brand Card type Country
Successful set up payment without 3DS

Successful recurring payments
4242424242424242 Visa Credit US
Successful set up payment with 3DS

Successful recurring payments
4000002500003155 Visa Credit France
Successful set up payment with 3DS

Unsuccessful recurring payments
4000002760003184 Visa Credit Germany
Unsuccessful set up payment 4000000000009995 Visa Credit US

 Mock email addresses

Use one of the following mock email addresses when doing automated testing:

  • simulate-delivered@notifications.service.gov.uk
  • simulate-delivered-2@notifications.service.gov.uk
  • simulate-delivered-3@notifications.service.gov.uk