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
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.
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.
If you experience any problems when testing, please email us at email@example.com.
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 firstname.lastname@example.org.
Mock card numbers for testing
When you test your integration, you must not use real card numbers.
You should use mock card numbers. For example:
|Testing action||Card numbers to use||Card type||Debit/Credit|
|Simulate a successful transaction||4444333322221111||Visa||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|
When you use mock card numbers, you can enter any valid value for the other details. For example, expiry dates must be in the future.
Worldpay test card numbers
Refer to the Worldpay documentation [external link].
Barclays ePDQ test card numbers
Refer to the ePDQ Get Started guide [external link] and select What credit cards can I use for testing?
Barclays SmartPay test card numbers
Refer to the SmartPay TestCards page [external link].