GOV.UK Pay API

{Payment Id}

{Payment Id} Overview

{
  "amount": 150000,
Integer (Int32) *

Amount in pence. Can't be more than the available amount for refunds

  "refund_amount_available": 200000
Integer (Int32)

Amount in pence. Total amount still available before issuing the refund

}

Cancel payment

Open in API Explorer
POST /v1/payments/{paymentId}/cancel

Cancel a payment based on the provided payment ID and the Authorisation token. The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'. A payment can only be cancelled if it's in a state that isn't finished.

Example Request

Format:
curl --request POST \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo/cancel \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo/cancel",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo/cancel",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

payload = ""

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/v1/payments/foo/cancel", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo/cancel"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required foo

Responses

204 No Content

No Content

(Empty Response)
400 Bad Request

Cancellation of payment failed

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
409 Conflict

Conflict

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}

Find payment by ID

Open in API Explorer
GET /v1/payments/{paymentId}

Return information about the payment The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'

Example Request

Format:
curl --request GET \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("GET", "/v1/payments/foo", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required foo

Responses

200 OK

OK

{Payment Id} Payment with all links
{
  "amount": 1200,
Integer (Int64)

Amount

  "state": {
  "state": { ... }
Object

State

    "status": "created",
String *

Current progress of the payment in its lifecycle

    "finished": true,
Boolean *

Whether the payment has finished

    "message": "User cancelled the payment",
String *

What went wrong with the Payment if it finished with an error - English message

    "code": "P010"
String *

What went wrong with the Payment if it finished with an error - error code

  },
  "description": "Your Service Description",
String

Description

  "reference": "your-reference",
String

Reference

  "email": "your email",
String

Email

  "payment_id": "hu20sqlact5260q2nanm0q8u93",
String

Payment

  "payment_provider": "worldpay",
String

Payment Provider

  "return_url": "http://your.service.domain/your-reference",
String

Return Url

  "created_date": "2016-01-21T17:15:00Z",
String

Created Date

  "refund_summary": {
  "refund_summary": { ... }
Object

Refund Summary

    "status": "available",
String

Availability status of the refund

    "amount_available": "589170615283802112",
Integer (Int64)

Amount available for refund in pence

    "amount_submitted": "589170615283802112"
Integer (Int64)

Amount submitted for refunds on this Payment in pence

  },
  "settlement_summary": {
  "settlement_summary": { ... }
Object

Settlement Summary

    "capture_submit_time": "2016-01-21T17:15:00Z",
String

Date and time capture request has been submitted (may be null if capture request was not immediately acknowledged by payment gateway)

    "captured_date": "2016-01-21"
String

Date of the capture event

  },
  "card_details": {
  "card_details": { ... }
Object

Card Details

    "last_digits_card_number": "1234",
String

Last Digits Card Number

    "cardholder_name": "Mr. Card holder",
String

Cardholder Name

    "expiry_date": "12/20",
String

Expiry Date

    "billing_address": {
    "billing_address": { ... }
Object

Billing Address

      "line1": "address line 1",
String

Line1

      "line2": "address line 2",
String

Line2

      "postcode": "AB1 2CD",
String

Postcode

      "city": "address city",
String

City

      "country": "UK"
String

Country

    },
    "card_brand": "Visa"
String

Card Brand

  },
  "_links": {
  "_links": { ... }
Object

Links

    "self": {
    "self": { ... }
Object

self

      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "GET"
String

Method

    },
    "next_url": {
    "next_url": { ... }
Object

next_url

      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "GET"
String

Method

    },
    "next_url_post": {
    "next_url_post": { ... }
Object

next_url_post

      "type": "multipart/form-data",
String

Type

      "params": {
      "params": { ... }
Object

Params

      },
      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "POST"
String

Method

    },
    "events": {
    "events": { ... }
Object

events

      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "GET"
String

Method

    },
    "refunds": {
    "refunds": { ... }
Object

refunds

      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "GET"
String

Method

    },
    "cancel": {
    "cancel": { ... }
Object

cancel

      "type": "multipart/form-data",
String

Type

      "params": {
      "params": { ... }
Object

Params

      },
      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "POST"
String

Method

    }
  },
  "card_brand": "Visa"
String

Card Brand

}
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}

Submit a refund for a payment

Open in API Explorer
POST /v1/payments/{paymentId}/refunds

Return issued refund information. The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'

Example Request

Format:
curl --request POST \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE' \
  --header 'content-type: application/json' \
  --data '{"amount":150000,"refund_amount_available":200000}'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'
request["content-type"] = 'application/json'
request.body = "{\"amount\":150000,\"refund_amount_available\":200000}"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo/refunds",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ amount: 150000, refund_amount_available: 200000 }));
req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"amount\":150000,\"refund_amount_available\":200000}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

payload = "{\"amount\":150000,\"refund_amount_available\":200000}"

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE",
    'content-type': "application/json"
    }

conn.request("POST", "/v1/payments/foo/refunds", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds"

	payload := strings.NewReader("{\"amount\":150000,\"refund_amount_available\":200000}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required

paymentId

foo

Request Body

Name Type Required Description Example
body Object Required

requestPayload

{
  "amount": 150000,
Integer (Int32) *

Amount in pence. Can't be more than the available amount for refunds

  "refund_amount_available": 200000
Integer (Int32)

Amount in pence. Total amount still available before issuing the refund

}

Responses

202 Accepted

ACCEPTED

(Empty Response)
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
412 Precondition Failed

Refund amount available mismatch

(Empty Response)
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}

Get all refunds for a payment.

Open in API Explorer
GET /v1/payments/{paymentId}/refunds

Return refunds for a payment. The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'

Example Request

Format:
curl --request GET \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo/refunds",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("GET", "/v1/payments/foo/refunds", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required foo

Responses

200 OK

OK

(Empty Response)
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}

Return payment events by ID

Open in API Explorer
GET /v1/payments/{paymentId}/events

Return payment events information about a certain payment The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'

Example Request

Format:
curl --request GET \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo/events \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo/events",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo/events",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("GET", "/v1/payments/foo/events", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo/events"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required foo

Responses

200 OK

OK

{Payment Id} Payment events information
{
  events: [
Array

Events

    {
    { ... }
Object

A List of Payment Events information

      "payment_id": "hu20sqlact5260q2nanm0q8u93",
String

Payment

      "state": {
      "state": { ... }
Object

state

        "status": "created",
String *

Current progress of the payment in its lifecycle

        "finished": true,
Boolean *

Whether the payment has finished

        "message": "User cancelled the payment",
String *

What went wrong with the Payment if it finished with an error - English message

        "code": "P010"
String *

What went wrong with the Payment if it finished with an error - error code

      },
      "updated": "updated_date",
String

updated

      "_links": {
      "_links": { ... }
Object

Links

        "payment_url": {
        "payment_url": { ... }
Object

payment_url

          "href": "https://an.example.link/from/payment/platform",
String

Href

          "method": "GET"
String

Method

        }
      }
    }
  ]
  "payment_id": "hu20sqlact5260q2nanm0q8u93",
String

Payment

  "_links": {
  "_links": { ... }
Object

Links

    "self": {
    "self": { ... }
Object

self

      "href": "https://an.example.link/from/payment/platform",
String

Href

      "method": "GET"
String

Method

    }
  }
}
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}

Find payment refund by ID

Open in API Explorer
GET /v1/payments/{paymentId}/refunds/{refundId}

Return payment refund information by Refund ID The Authorisation token needs to be specified in the 'authorization' header as 'authorization: Bearer YOUR_API_KEY_HERE'

Example Request

Format:
curl --request GET \
  --url https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds/foo \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds/foo")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "publicapi.payments.service.gov.uk",
  "port": null,
  "path": "/v1/payments/foo/refunds/foo",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds/foo",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("publicapi.payments.service.gov.uk")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("GET", "/v1/payments/foo/refunds/foo", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://publicapi.payments.service.gov.uk/v1/payments/foo/refunds/foo"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
paymentId String Required foo
refundId String Required foo

Responses

200 OK

OK

(Empty Response)
401 Unauthorized

Credentials are required to access this resource

(Empty Response)
404 Not Found

Not found

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}
500 Internal Server Error

Downstream system error

{Payment Id} Payment error
{
  "field": "amount",
String

Field

  "code": "P0102",
String

Code

  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000"
String

Description

}