GOV.UK Pay API
payments · Finance
GOV.UK Pay API (This version is no longer maintained. See openapi/publicapi_spec.json for latest API specification)
Authentication
Sample Requests
Search payments by reference, state, 'from' and 'to' date. The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments?page=1&email=test%40example.com&state=created&to_date=example&from_date=example&reference=example&card_brand=example&display_size=example&cardholder_name=example&to_settled_date=example&from_settled_date=example&last_digits_card_number=example&first_digits_card_number=example"
import requests
params = {
"page": "1",
"email": "[email protected]",
"state": "created",
"to_date": "example",
"from_date": "example",
"reference": "example",
"card_brand": "example",
"display_size": "example",
"cardholder_name": "example",
"to_settled_date": "example",
"from_settled_date": "example",
"last_digits_card_number": "example",
"first_digits_card_number": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments');
url.searchParams.set('page', '1');
url.searchParams.set('email', '[email protected]');
url.searchParams.set('state', 'created');
url.searchParams.set('to_date', 'example');
url.searchParams.set('from_date', 'example');
url.searchParams.set('reference', 'example');
url.searchParams.set('card_brand', 'example');
url.searchParams.set('display_size', 'example');
url.searchParams.set('cardholder_name', 'example');
url.searchParams.set('to_settled_date', 'example');
url.searchParams.set('from_settled_date', 'example');
url.searchParams.set('last_digits_card_number', 'example');
url.searchParams.set('first_digits_card_number', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments")
q := baseURL.Query()
q.Set("page", "1")
q.Set("email", "[email protected]")
q.Set("state", "created")
q.Set("to_date", "example")
q.Set("from_date", "example")
q.Set("reference", "example")
q.Set("card_brand", "example")
q.Set("display_size", "example")
q.Set("cardholder_name", "example")
q.Set("to_settled_date", "example")
q.Set("from_settled_date", "example")
q.Set("last_digits_card_number", "example")
q.Set("first_digits_card_number", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments")
uri.query = URI.encode_www_form({
"page" => "1",
"email" => "[email protected]",
"state" => "created",
"to_date" => "example",
"from_date" => "example",
"reference" => "example",
"card_brand" => "example",
"display_size" => "example",
"cardholder_name" => "example",
"to_settled_date" => "example",
"from_settled_date" => "example",
"last_digits_card_number" => "example",
"first_digits_card_number" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments?" . http_build_query([
"page" => "1",
"email" => "[email protected]",
"state" => "created",
"to_date" => "example",
"from_date" => "example",
"reference" => "example",
"card_brand" => "example",
"display_size" => "example",
"cardholder_name" => "example",
"to_settled_date" => "example",
"from_settled_date" => "example",
"last_digits_card_number" => "example",
"first_digits_card_number" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Search refunds by 'from' and 'to' date. The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds?page=1&to_date=example&from_date=example&display_size=example&to_settled_date=example&from_settled_date=example"
import requests
params = {
"page": "1",
"to_date": "example",
"from_date": "example",
"display_size": "example",
"to_settled_date": "example",
"from_settled_date": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds');
url.searchParams.set('page', '1');
url.searchParams.set('to_date', 'example');
url.searchParams.set('from_date', 'example');
url.searchParams.set('display_size', 'example');
url.searchParams.set('to_settled_date', 'example');
url.searchParams.set('from_settled_date', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds")
q := baseURL.Query()
q.Set("page", "1")
q.Set("to_date", "example")
q.Set("from_date", "example")
q.Set("display_size", "example")
q.Set("to_settled_date", "example")
q.Set("from_settled_date", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds")
uri.query = URI.encode_www_form({
"page" => "1",
"to_date" => "example",
"from_date" => "example",
"display_size" => "example",
"to_settled_date" => "example",
"from_settled_date" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/refunds?" . http_build_query([
"page" => "1",
"to_date" => "example",
"from_date" => "example",
"display_size" => "example",
"to_settled_date" => "example",
"from_settled_date" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Return information about the payment The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}"import requests
response = requests.get(
"https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}",
)
print(response.json())const url = 'https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}';
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/payments.service.gov.uk/payments/1.0.3/v1/payments/{paymentId}";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with GOV.UK Pay API?
GOV.UK Pay API is a Finance API. Developers commonly use finance APIs for:
- processing payments and handling transactions
- building subscription and billing systems
- automating invoicing and financial reporting
- fraud detection and risk scoring
- connecting to banking and accounting software
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. GOV.UK Pay API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide