Get a payment's events

GET/v1/payments/{paymentId}/events

You can use this endpoint to get a list of a payment’s events. A payment event is when a payment’s state changes, such as when the payment is created, or when the paying user submits their details.

Requires a bearer token.

In this mock: One event is recorded for every state change.

Path parameters

NameTypeDescription
paymentId
required
string Payment identifier

Example request

curl -X GET "https://publicapi.payments.platform-engineering.com/v1/payments/{paymentId}/events" \
  -H "Authorization: Bearer $TOKEN"

Responses

200: OK - your request was successful.

NameTypeDescription
_links object links for events resource
_links.self object A link related to a payment
_links.self.href string A URL that lets you perform additional actions to this payment when combined with the associated method.
_links.self.method string An API method that lets you perform additional actions to this paymentwhen combined with the associated href.
events[] array of objects
events[]._links object Resource link for a payment of a payment event
events[]._links.payment_url object A link related to a payment
events[]._links.payment_url.href string A URL that lets you perform additional actions to this payment when combined with the associated method.
events[]._links.payment_url.method string An API method that lets you perform additional actions to this paymentwhen combined with the associated href.
events[].payment_id string The unique ID GOV.UK Pay automatically associated with this payment when you created it.
events[].state object A structure representing the current state of the payment in its lifecycle.
events[].state.can_retry boolean If can_retry is true, you can use this agreement to try to take another recurring payment. If can_retry is false, you cannot take another recurring payment with this agreement. can_retry only appears on failed payments that were attempted using an agreement for recurring payments.
events[].state.code string An API error codethat explains why the payment failed. code only appears if the payment failed.
events[].state.finished boolean Indicates whether a payment journey is finished.
events[].state.message string A description of what went wrong with this payment. message only appears if the payment failed.
events[].state.status string Where the payment is in the payment status lifecycle.
events[].updated string When this payment’s state changed. This value uses Coordinated Universal Time (UTC) and ISO-8601 format - YYYY-MM-DDThh:mm:ss.SSSZ.
payment_id string The unique ID GOV.UK Pay automatically associated with this payment when you created it.
{
  "_links": {
    "self": {
      "href": "https://an.example.link/from/payment/platform",
      "method": "GET"
    }
  },
  "events": [
    {
      "_links": {
        "payment_url": {
          "href": "https://an.example.link/from/payment/platform",
          "method": "GET"
        }
      },
      "payment_id": "hu20sqlact5260q2nanm0q8u93",
      "state": {
        "code": "P010",
        "message": "User cancelled the payment",
        "status": "created"
      },
      "updated": "2017-01-10T16:44:48.646Z"
    }
  ],
  "payment_id": "hu20sqlact5260q2nanm0q8u93"
}

401: Your API key is missing or invalid. Read more about [authenticating GOV.UK Pay API requests](https://docs.payments.service.gov.uk/api_reference/#authentication)

404: Not found

NameTypeDescription
code string An API error codethat explains why the payment failed.<br><br>code only appears if the payment failed.
description string Additional details about the error.
field string The parameter in your request that's causing the error.
header string The header in your request that's causing the error.
{
  "code": "P0102",
  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000",
  "field": "amount",
  "header": "Idempotency-Key"
}

429: Too many requests

NameTypeDescription
code string A GOV.UK Pay API error code. You can find out more about this code in our documentation.
description string Additional details about the error
{
  "code": "P0900",
  "description": "Too many requests"
}

500: Downstream system error

NameTypeDescription
code string An API error codethat explains why the payment failed.<br><br>code only appears if the payment failed.
description string Additional details about the error.
field string The parameter in your request that's causing the error.
header string The header in your request that's causing the error.
{
  "code": "P0102",
  "description": "Invalid attribute value: amount. Must be less than or equal to 10000000",
  "field": "amount",
  "header": "Idempotency-Key"
}