Update a Klarna customer token

When a purchase token has been created, you can update the status of it. This should be used if you want to cancel a specific customer token.

Date: 11.07.2019

For a description of the status in the lifecycle of a token, please read the customer token lifecycle article .

Request

You can set the status of a token to ‘CANCELLED’ to disable it from being used again to create orders.

1
2
3
4
5
6
7
Path: PATCH /customer-token/v1/tokens/{customerToken}/status
Headers:
Content-Type: application/json

{
    "status": "CANCELLED"
}

Responses

Based on if the request is succesful or rejected, the response will be different.

Successful Response example

The response will only state whether or not the update was successful or not.

1
2
3
4
5
6
Description: Token patch request has been accepted and is being processed.

Headers:
Status Code: 202
Content-Type: application/json
*Empty response*

Example error responses

1
2
3
4
5
6
7
{
    "correlation_id":	"6a9b1cb1-73a3-4936-a030-481ba4bb203b",
    "error_code":	"ERROR_CODE",
    "error_messages":	[
        "ERROR_MESSAGE"
    ]
}

Best practice: You can use the correlation_id to troubleshoot the call in the logs app in merchant portal.

Possible error codes and messages

Error CodeError messageComment
Error Code
NOT_FOUND
Error message
Invalid token ID
Comment
The token you attempted to read is not valid anymore. Or the ID is incorrectly formatted.
Error Code
BAD_VALUE
Error message
[incorrect field]
Comment
If you enter any values that are not allowed, the validation will fail.