Send card details to authorise a MOTO payment
POST/v1/auth
You can use this endpoint to authorise payments you have created with authorisation_mode set to moto_api.
Needs no bearer token. It is authorised by the one_time_token in the request body.
In this mock: Needs no bearer token, only the one_time_token from the payment's auth_url_post link. Card 4000000000000002 is declined (402, payment fails with P0010). Any other valid number succeeds.
Request body
| Name | Type | Description |
|---|---|---|
card_numberrequired |
string | The full card number from the paying user's card. |
cardholder_namerequired |
string | The name on the paying user's card. |
cvcrequired |
string | The card verification code (CVC) or card verification value (CVV) on the paying user's card. |
expiry_daterequired |
string | The expiry date of the paying user's card. This value must be in MM/YY format. |
one_time_tokenrequired |
string | This single use token authorises your request and matches it to a payment. GOV.UK Pay generated the one_time_token when the payment was created. |
Example request
curl -X POST "https://publicapi.payments.platform-engineering.com/v1/auth" \
-H "Content-Type: application/json" \
-d '{
"card_number": "4242424242424242",
"cardholder_name": "J. Citizen",
"cvc": "123",
"expiry_date": "09/22",
"one_time_token": "12345-edsfr-6789-gtyu"
}'
Responses
204: Your authorisation request was successful.
400: Your request is invalid. Check the `code` and `description` in the response to find out why your request failed.
| Name | Type | Description |
|---|---|---|
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"
}
402: The `card_number` you sent is not a valid card number or you chose not to accept this card type. Check the `code` and `description` fields in the response to find out why your request failed.
| Name | Type | Description |
|---|---|---|
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"
}
422: A value you sent is invalid or missing. Check the `code` and `description` in the response to find out why your request failed.
| Name | Type | Description |
|---|---|---|
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: There is something wrong with GOV.UK Pay. If there are no issues on our status page (https://payments.statuspage.io), you can contact us with your error code and we'll investigate.
| Name | Type | Description |
|---|---|---|
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"
}