Skip to main content

Manage token state change

A token state provides you with information about the token and whether it can be used for processing. Managing those states is required for proper processing.   

Before you begin

Understand the Token lifecycle management.

Retrieve token state

You can retrieve the token state information by performing a GET call to the /tokens/{token-reference-id}/lifecycle-states endpoint. 

HTTP method: GET
Endpoint: /tokens/fb0dabc0-da2c-46b6-b3a3-8fc6d3190e88/lifecycle-states

Json
{ 
    "identifier": "fb0dabc0-da2c-46b6-b3a3-8fc6d3190e98", 
    "timestamp": "2021-09-15T19:52:48.801", 
    "paymentInstrument": { 
        "tokenReferenceIdentifier": "af0a77c2-3810-457f-8d47-807bab406df8", 
        "cardTokenStatus": "ACTIVE", 
        "stateChangeReason": "RESUME", 
        "statusChangeTimestamp": "2021-09-15T19:52:48.801" 
    }, 
    "requestIdentifier": "10cc0270-7bed-11e9-a188-1763956dd7f6", 
    "responseStatus": "SUCCESS", 
    "responseCode": "ACCEPTED", 
    "responseMessage": "The request is well received." 
} 

Update token state

You can update the state of a token by performing a PATCH call to the /tokens/{token-reference-id}/lifecycle-states endpoint. 

HTTP method: PATCH
Endpoint: /tokens/fb0dabc0-da2c-46b6-b3a3-8fc6d3190e88/lifecycle-states

Json
{
    "paymentInstrument": {
        "stateChangeReason": "SUSPEND",
        "stateChangeReasonText": "Consumer suspended subscription"
    }
}

Response

Json
{
    "identifier": "d389b100-37b1-4239-96f3-7340a75045c6",
    "timestamp": "2021-09-15T19:52:48.801",
    "cardTokenStatus": "SUSPENDED",
    "stateChangeReason": "SUSPEND",
    "tokenReferenceIdentifier": "205c9a37-ae4a-4cb5-8c9a-75de746500b5",
    "requestIdentifier": "379f0966-71a1-4db5-b1b3-0e87cb864ff0",
    "responseStatus": "SUCCESS",
    "responseCode": "ACCEPTED",
    "responseMessage": "The request is well received."
}