Table of contents

Testing GOV.UK Pay

When your GOV.UK Pay account is made live, you will still have a ‘test’ account for general testing and experimenting with different settings and features. You can read more in the Switching to live section.

When you test, you should make sure that you use mock card numbers to simulate both successful and unsuccessful transactions. You must use test cards with your test account. Real card numbers will not work.

You should also:

  • only use your test account, not your live account

  • make sure that test calls to the GOV.UK Pay API succeed with 200 codes

  • test the whole user journey from your service to the payment service provider

HTTP with test accounts

Services using test accounts can optionally use HTTP (rather than HTTPS) for return URLs. You can read more in the Security section.

Make a demo payment

You can try the payment experience as a user, and then view the completed payment in the GOV.UK Pay transactions list.

Test your service with your users

You can create a reusable link to integrate your service prototype with GOV.UK Pay, and test with your users. This feature only works in test accounts, and not in live accounts.

Integration testing

To check your integration with GOV.UK Pay is working as expected, you should run a series of tests. You can read more about software testing and smoke testing in the GOV.UK Service Manual.

Ideally you should build tests to include both the GOV.UK Pay API and its frontend user journey. The GOV.UK Pay interface is continuously iterated, so you should not rely on any specific page layout. You can still build tests that address form elements such as buttons, using their IDs. Alternatively, you can build stubs that will emulate GOV.UK Pay functionality.

You can read the section on How to integrate with the GOV.UK Pay API. You can also read the Versioning section to find out about the evolution of the GOV.UK Pay API.

If you experience any problems when testing, please email us at govuk-pay-support@digital.cabinet-office.gov.uk.

Performance testing

The contract you have with GOV.UK Pay requires you to seek written approval from GOV.UK Pay before you conduct any performance testing. If you’d like to carry out any kind of performance testing, including in a rate-limiting environment, please contact us at govuk-pay-support@digital.cabinet-office.gov.uk.

Submit a test transaction using mock card numbers

When you test your integration with GOV.UK Pay by submitting a test transaction, you must use mock card numbers.

You can enter any valid value for the other required information for that test transaction. For example, card expiry dates can be any date in the future.

The following example mock card numbers only work with a test account. If you use mock card numbers after you have switched to a live account, your payment service provider will not authorise the payment.

 
Testing action Card numbers to use Card type Debit/Credit
Simulate a successful transaction 4444333322221111 Visa Credit
4242424242424242 Visa Credit
4000056655665556 Visa Debit
4988080000000000 Visa Debit Corporate
4000160000000004 Visa Debit Prepaid
4131840000000003 Visa Debit Corporate Prepaid
5101180000000007 Mastercard Credit Corporate
5105105105105100 Mastercard Debit
5200828282828210 Mastercard Debit
371449635398431 American Express Credit
3566002020360505 JCB Credit
6011000990139424 Discover Credit
36148900647913 Diners Club Credit
Simulate card type not accepted 6759649826438453 Maestro Debit
Simulate a declined card 4000000000000002 Visa N/A
Simulate an invalid CVC security code 4000000000000127 Visa N/A
Simulate an expired card 4000000000000069 Visa N/A
Simulate a general processing error 4000000000000119 Visa N/A