Skip to content

GOV.UK Pay API API

by payments.service.gov.uk

API keyHTTPSFinance
Open documentation ↗

Overview

GOV.UK Pay API (This version is no longer maintained. See openapi/publicapi_spec.json for latest API specification)

GOV.UK Pay API is a finance API from payments.service.gov.uk. Requests are authenticated with an API key. It is served over HTTPS. Its OpenAPI description documents 10 endpoints.

At a glance

Authentication
API key
HTTPS
Yes
CORS
Unknown
Category
Finance
Base URL
https://publicapi.payments.service.gov.uk
Version
1.0.3
Endpoints
10
Spec updated
2023-03-06

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "https://publicapi.payments.service.gov.uk/v1/payments" \
  -H "Accept: application/json" \
  -H "X-API-Key: YOUR_API_KEY"
JavaScript
const response = await fetch("https://publicapi.payments.service.gov.uk/v1/payments", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "X-API-Key": "YOUR_API_KEY",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "https://publicapi.payments.service.gov.uk/v1/payments",
    headers={
    "Accept": "application/json",
    "X-API-Key": "YOUR_API_KEY",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/v1/paymentsSearch payments
POST/v1/paymentsCreate new payment
GET/v1/payments/{paymentId}Find payment by ID
POST/v1/payments/{paymentId}/cancelCancel payment
POST/v1/payments/{paymentId}/captureCapture payment
GET/v1/payments/{paymentId}/eventsReturn payment events by ID
GET/v1/payments/{paymentId}/refundsGet all refunds for a payment
POST/v1/payments/{paymentId}/refundsSubmit a refund for a payment
GET/v1/payments/{paymentId}/refunds/{refundId}Find payment refund by ID
GET/v1/refundsSearch refunds

Questions

Does the GOV.UK Pay API API need an API key?

Yes. The GOV.UK Pay API API uses API key authentication; the documentation explains how to get credentials.

Does the GOV.UK Pay API API support HTTPS?

Yes, the GOV.UK Pay API API is served over HTTPS.

How many endpoints does the GOV.UK Pay API API have?

Its OpenAPI description lists 10 endpoints in version 1.0.3. All of them are shown on this page.

What are alternatives to the GOV.UK Pay API API?

Other Finance APIs include Stripe, SEC EDGAR Data, Plaid, Fed Treasury, Razorpay IFSC.

Compare alternatives →

Listed from APIs.guru (CC0).