Test your integration
This change will not affect most GOV.UK Pay services. If your service has more than one test account, we will be in touch to help you prepare.
Please do not request additional test accounts.
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.
- Select the account you want to test in the GOV.UK admin tool.
- 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.
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:
- transaction fees
- payments to your bank account
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:
- An initial payment to set up the agreement for recurring payments.
- 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