Managing tokens

Learn how to manage tokens you stored with Adyen.

Overview

Sometimes your users need to update the payment methods they saved with you or request you to remove a previously saved payment detail. We additionally provide a lookup mechanism to list what tokens exist under a shopper, as well as list which shoppers have a given payment detail.

Managing tokens entails:

List tokens by shopper

To list all tokens contained within a shopper, use our /listRecurringDetails call.

Provide your merchant account and the shopperReference of the shopper you want to list the tokens of.

{
  "merchantAccount":"TestMerchant",
  "shopperReference":"grasshopper77"
}

The response will contain an array of the saved details, which includes the recurringDetailReference that can be used with the shopperReference of the request to make a payment.

Refer to our API Explorer for the full reference.

Update token details

Occasionally, a shopper's card information will get updated, such as a new expiration date, and you will want to be able to update the token to represent this new information.

Perform an /authorise request to update the token. Instead of providing the full card information, provide the shopperReferencerecurringDetailReference, and provide recurring.contract as RECURRING,ONECLICK along with the updated expiration information.

{
  "card" : {
    "expiryMonth" : "06",
    "expiryYear" : "2016"
  },
  "amount": {
    "value": 0,
    "currency": "USD"
  },
  "recurring": {
    "contract":"RECURRING,ONECLICK"
  },
  "selectedRecurringDetailReference":"7219687191761347",
  "reference": "Your Reference Here",
  "merchantAccount": "TestMerchant",
  "shopperReference": "yourShopperId_IOfW3k9G2PvXFu2j",
  "shopperInteraction":"ContAuth"
}

Upon the Authorised response from the /authorise request or Success result from /storeToken, the card information will be updated. The token will stay the same and you can continue to use it for transactions.

Updated card from Account Updater

When using Account Updater to refresh card information, the card details will be updated but the token will always stay the same. This means you don't need to build any additional logic to take advantage of Account Updater with tokens.

Disable stored details

Shoppers sometimes request to remove a given saved payment detail or leave your platform, and you want to remove all details they have saved with you. Remove these saved details with the /disable call.

To disable a single token, provide your merchantAccount, the shopperReference, the recurringDetailReference you want to remove.

{
  "merchantAccount": "TestMerchant",
  "shopperReference": "test12345621217",
  "recurringDetailReference": "8313147988756818"
}

To disable a shopper and all their saved details, provide your merchantAccount and the shopperReference you want to remove.

{
  "merchantAccount": "TestMerchant",
  "shopperReference": "test12345621217"
}

After disabling the details you stored with Adyen, make sure that you also delete the remaining shopper details, if any, from your servers.

See also