Skip to main content

Test your integration

Use GOV.UK Pay testing features to check your integration before you go live, and to test changes after your service is live.

The way you test depends on:

  • whether your service is live
  • which payment service provider (PSP) you use
  • whether you are testing the GOV.UK Pay API, the full user journey, or both

If your service is switching from Stripe to Adyen

Read Check how switching from Stripe to Adyen affects your integration for information about changes you need to test.

GOV.UK Pay will confirm how you can test these changes.

Choose a testing mode

Each GOV.UK Pay service has one test point.

You can use it in 2 modes:

  • ‘not live yet’ for a new service
  • sandbox for a live service

Use ‘not live yet’ for a new service

When you first create a GOV.UK Pay service, it is labelled ‘not live yet’ in the GOV.UK Pay admin tool.

Use this mode to:

  • explore how the GOV.UK Pay API works
  • test payments
  • test service settings
  • check your integration before you go live

Use sandbox for a live service

After your service goes live, use sandbox mode to test changes.

To enter sandbox mode:

  1. From the admin tool dashboard, select Enter sandbox mode.
  2. On the Enter sandbox mode page, select Enter sandbox mode.

You can use sandbox mode to:

  • make test payments
  • view test transactions
  • try different settings and functionality
  • run automated smoke tests

Changes in sandbox mode do not affect your live service. Users can still make payments to the live version.

You can leave sandbox mode at any time.

Important limitations when testing GOV.UK Pay

Do not use both testing modes for automated integration tests that run when you change your code.

If you need automated integration tests, build a stub to simulate the GOV.UK Pay API instead. For example, you can use WireMock.

In sandbox mode, use the same test API keys created in ‘not live yet’ mode. Create new live API keys only when you go live to take payments.

What you can test by payment service provider

If your PSP is Adyen

If your service uses Adyen, you can use ‘not live yet’ and sandbox modes to test:

  • transaction fees
  • payments to your bank account
  • 3D Secure (3DS) with specific test card numbers
  • viewing transactions
  • reporting on payments
  • refunding payments

If your PSP is Stripe

If your service uses Stripe, you can use ‘not live yet’ and sandbox modes to test:

  • transaction fees
  • payments to your bank account
  • 3D Secure (3DS) with specific test card numbers

If your PSP is Worldpay

If your service uses Worldpay, you can use ‘not live yet’ and sandbox modes for:

  • reporting on payments
  • smoke testing
  • viewing transactions
  • refunding transactions

Worldpay does not support 3DS testing in sandbox mode.

Worldpay test accounts

You can link a Worldpay test account to GOV.UK Pay.

Some services use a Worldpay test account to connect GOV.UK Pay to Worldpay reporting products.

Most organisations do not need a Worldpay test account. We do not recommend using one unless you have a clear reason.

If you use a Worldpay test account:

  • GOV.UK Pay cannot support problems with the account
  • you should not use it for long-term automated testing

To ask for a Worldpay test account, email govuk-pay-support@digital.cabinet-office.gov.uk.

If we approve your request, we will add the test account as a separate GOV.UK Pay service.

Test the whole user journey

Test the full user journey as well as the API.

You can create a reusable link in the GOV.UK Pay admin tool. It behaves like a payment link created through the API.

You can use the link to:

  • open a GOV.UK Pay payment page from your prototype
  • complete a test payment
  • send the user back to your service with a return_url
  • test the full payment journey

To create a reusable payment link:

  1. Sign in to the GOV.UK Pay admin tool.
  2. Select the service you want to test in My services.
  3. Select Test with your users to create the link.

You can also:

  • use mock card numbers to test successful and unsuccessful payments
  • use HTTP instead of HTTPS for the return_url while your service is in sandbox or ‘not live yet’ mode
  • test any payment links you have already set up

You do not need to set up a secure URL for testing.

Performance testing

You must email govuk-pay-support@digital.cabinet-office.gov.uk for performance testing approval.

Use mock card numbers

Use mock card numbers when you test payments. Do not use real card numbers.

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

Mock card numbers work for all test payments in sandbox and ‘not live yet’ modes.

There are separate sets of mock card numbers for:

Mock card numbers for Adyen

For all Adyen test cards, use 03/30 as the expiry date. GOV.UK Pay also accepts 03/2030.

Use 737 for the card security code (CVC) or card verification value (CVV), except for American Express, which uses 7373.

Testing action Card number Cardholder name Card brand Card type Country
Successful payment 36006666333344 Any Diners Club Credit United States
Successful payment 3569990010095841 Any JCB Credit United States
Successful payment 5555440012345670 Any Mastercard Credit United Kingdom
Successful payment 5355630012345678 Any (except DECLINED, CARD_EXPIRED, CVC_DECLINED or ERROR) Mastercard Debit United Kingdom
Successful payment 4000020000000000 Any Visa Credit United States
Successful payment 4000620000000007 Any Visa Debit United States
Successful payment 4111111111111111 Any Visa Credit Netherlands
Successful payment 370000000000002 Any American Express Debit United Kingdom
Requires 3DS check 371449635398431 Any American Express Credit United Kingdom
Requires 3DS check 4917610000000000 Any Visa Debit United Kingdom
Card declined 5355630012345678 DECLINED Mastercard Debit United Kingdom
Card expired 5355630012345678 CARD_EXPIRED Mastercard Debit United Kingdom
Invalid CVC code 5355630012345678 CVC_DECLINED Mastercard Debit United Kingdom
General error 5355630012345678 ERROR Mastercard Debit United Kingdom

Mock card numbers for Stripe

The PSP transaction fee depends on the card country.

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

Test recurring payments for a Stripe service

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

Use these mock card numbers to test recurring payments with Stripe.

Recurring payments have 2 steps:

  1. Take an initial payment to set up an agreement.
  2. Take later recurring payments automatically.

Each test card gives a result for both steps.

Testing actions Card number Card brand Card type Country
Successful set up payment without 3DS Successful recurring payments 4242424242424242 Visa Credit United States
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 United States

Mock card numbers for Worldpay

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 4111111111111111 Visa Credit - corporate
Successful payment 4000000000000010 Visa Credit or debit
Successful payment 222100000000000 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

Test recurring payments for a Worldpay service

Use these mock card numbers to test recurring payments with Worldpay.

Recurring payments have 2 steps:

  1. Take an initial payment to set up an agreement.
  2. Take later recurring payments automatically.

Each test card gives a result for both steps.

Testing actions Card number Card brand Card type
1. Successful set up payment 2. Successful recurring payment 4000056655665556 Visa Debit
1. Successful set up payment 2. Unsuccessful recurring payment 5105105105105100 Mastercard Debit

Use mock email addresses

If you are testing manually, you can use real email addresses.

If you are doing automated tests, you must use one of these mock email addresses.

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

Minimum testing requirements

Before your service goes live or you release changes to a live service, use the testing methods on this page to check your service can:

  • send users to a GOV.UK Pay payment page
  • complete a successful test payment
  • handle relevant unsuccessful payment journeys
  • receive users when GOV.UK Pay redirects them to the return_url, if your service provides one
  • show users the payment outcome and what to do next, if your service handles the outcome

Unsuccessful payment journeys can include failed payments, cancelled payments, technical errors, or journeys where users do not return to your service.

If you use the GOV.UK Pay API, test that your service can create a payment.

If your service takes recurring payments, test the first payment and at least one recurring payment.

After you finish testing

If your service is not live yet, follow the guidance on going live.

If you tested changes to a live service, release the changes using your organisation’s usual process.

If testing shows a problem, fix the problem and test the affected journey again before you go live or release the change.