Table of contents

Testing GOV.UK Pay

When your GOV.UK Pay account is switched to live, you will still have a ‘test’ account for general testing and experimenting with different settings and features.

When you test, you should make sure that you’ve tested with 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 about this in the Security section.

Make a demo payment

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

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.

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 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

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.

Mock card numbers for testing

When you’re testing your integration, you must not use real card numbers. Use the below test numbers.

When you’re using these card numbers, you can enter any valid value for the other details (name, expiry date, card security code etc). For example, it expiry dates must be in the future.

 
Testing action Card numbers to use Card type Debit/Credit
Simulate a successful transaction 4444333322221111 Visa Credit
4242424242424242 Visa Credit
4000056655665556 Visa Debit
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
 

Worldpay test card numbers

Please refer to Worldpay’s documentation

Barclays ePDQ test card numbers

Please refer to the ePDQ Get Started guide and click on What credit cards can I use for testing?

Barclays SmartPay test card numbers

Please refer to the SmartPay TestCards page.