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 firstname.lastname@example.org.
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 email@example.com.
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|
|4131840000000003||Visa||Debit Corporate Prepaid|
|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|