Errors

Errors use the GOV.UK Pay shape. field is only present for validation errors.

{ "field": "amount", "code": "P0101", "description": "Missing mandatory attribute: amount" }
HTTP statusCodeMeaning
400P0197 / P0697 / P2197The JSON in the request body is invalid.
400P0601 / P0602Refund amount missing or invalid.
400P1211No payment matches the one_time_token.
400P2501The agreement is already cancelled or inactive.
401n/aNo bearer token sent. Body is {"message":"Unauthorized"}.
402P0010The card was declined (POST /v1/auth).
403n/aBearer token sent but not valid. Body is {"message":"Forbidden"}.
404P0200 / P0300 / P0500 / P0600 / P1000No payment matched the ID.
404P0700No refund matched the ID.
404P2200 / P2500No agreement matched the ID.
404P0402 / P1100 / P1402 / P2402The requested page of search results does not exist.
409P0191The Idempotency-Key has already been used.
409P0502The payment cannot be cancelled in its current state.
409P1003The payment is not capturable.
412P0603 / P0604The payment cannot be refunded, or refund_amount_available does not match.
422P0101 / P2101A mandatory attribute is missing. See field.
422P0102 / P2102An attribute value is invalid. See field and description.
422P0104return_url cannot be used with moto_api.
422P0401 / P1101 / P1401 / P2401A search parameter is invalid.
422P1212The one_time_token has already been used.

Codes P1401 and P1402 (disputes search) are assumed; the public documentation does not list them.