Read this section to learn about what to do to get started with GOV.UK Pay.
Before you start
Before you start using GOV.UK Pay, you should:
- read how to get started and decide if GOV.UK Pay is right for your service
- sign up to the GOV.UK Pay admin tool
- read the GOV.UK Service Manual guidance on deploying new software
Decide how you want to take payments
There are 2 ways you can take payments with GOV.UK Pay:
- integrate with the GOV.UK Pay API
- set up a payment link
Integrate with the API
If you want to build a technical integration between your service and the GOV.UK Pay API, your service team should have the necessary skills.
You can refer to the GOV.UK Service Manual for more information.
Set up a payment link
Payment links are individual pages for taking online payments.
The GOV.UK Pay API
The GOV.UK Pay API is based on REST principles with endpoints returning data in JSON format, and standard HTTP error response codes. Our API lets you:
- begin and complete payments
- view the event history for individual payments
- view transactions, refunds, and disputes within a specified time period
- issue full or partial refunds
- create agreements to take recurring payments
You’ll be able to create API keys for 2 different accounts. These are your:
- test (‘sandbox’) account, for testing the GOV.UK Pay API and your service
- live account, for taking payments from your users after you switch to live
If your payment service provider (PSP) is Stripe, you can also ask us for a test Stripe account so you can see how transaction fees and payments to your bank account work.
When you’ve signed up for a test account, follow these instructions to get started with our API and make a test API request.
Test the API
Create a test API key
Sign in to the GOV.UK Pay admin tool with the test account login details you received.
Select your account.
Select Settings, then API keys.
Select Create a new API key.
Make sure you keep your API keys safe.
Make a test API request
You can make test API requests to GOV.UK Pay, using your test API key for authentication.
This is an example API request and request body to create a new payment for a passport application:
"description": "New passport application",
Services that use test accounts can optionally use HTTP, rather than HTTPS, for return URLs.
If the test request is successful, you will receive a
201 Created response with
a JSON body.
The JSON includes a
next_url link. This URL is where your service should
redirect your user for them to make their payment.
Read more about taking payments.
Simulate your users’ payment journey
Go to the
next_url with a browser, and you’ll see the payment screen.
Choose a mock card number and
enter it to simulate a payment in the test environment. For the other required
details, enter some test information which should have:
an expiry date that is in the future and in the format MM/YYYY or MM/YY
a valid postcode
Submit the payment.
View transactions at GOV.UK Pay admin tool
Select an account in the GOV.UK Pay admin tool, then select Transactions.
You can also view test transactions using the API.