Skip to main content

Test your integration

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 prototype 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 with test accounts.

If your payment service provider (PSP) is Stripe, you can request a test Stripe account from your account in the GOV.UK Pay admin tool. You can use a test Stripe account to see how the following work:

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.

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 5101110000000004 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
Successful payment 36148900647913 Diners Club 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

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
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
General error 4000000000000119 Visa Credit or debit 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