# Customer Token

## Get Customer Token

> Retrieve the payment token associated with the customer identified by the specified customer key.

```json
{"openapi":"3.0.1","info":{"title":"Recurring Payments API","version":"2.0"},"paths":{"/rest/v2/customers/{customerKey}/tokens":{"get":{"tags":["Customer Token"],"summary":"Get Customer Token","description":"Retrieve the payment token associated with the customer identified by the specified customer key.","operationId":"get_1","parameters":[{"name":"customerKey","in":"path","description":"Unique identifier of the customer.","required":true,"schema":{"type":"string"}},{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"ClearentCustomerTokensResponsePayload":{"type":"object","properties":{"customer-tokens":{"$ref":"#/components/schemas/tokens"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"tokens":{"type":"object","properties":{"token":{"type":"array","items":{"$ref":"#/components/schemas/customer-token"}}},"description":"tokens","xml":{"name":"tokens"}},"customer-token":{"required":["card-type","customer-key","exp-date","last-four-digits","token-id"],"type":"object","properties":{"customer-key":{"type":"string","description":"Unique identifier of the customer to associate with the token."},"token-id":{"type":"string","description":"Unique identifier of the existing payment token that represents the card number."},"exp-date":{"type":"string","description":"Expire date of the card (MMYY)."},"card-type":{"type":"string","description":"Type of payment card associated with the token.","enum":["AMEX","Discover","JCB","MasterCard","VISA"]},"last-four-digits":{"type":"string","description":"Last four digits of the card number associated with the token."},"description":{"type":"string","description":"Description of the customer's card to help identify the payment method."},"default":{"type":"boolean","description":"Indicates whether this card is the default payment method for the customer."},"avs-address":{"type":"string","description":"Street address used for Address Verification Service (AVS) validation for the payment card."},"avs-zip":{"type":"string","description":"ZIP or postal code used for Address Verification Service (AVS) validation."}},"description":"Represents a stored payment token for a customer.","xml":{"name":"customer-token"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```

## Add Token to a Customer

> Add an existing payment token to the customer identified by the specified customer key.

```json
{"openapi":"3.0.1","info":{"title":"Recurring Payments API","version":"2.0"},"paths":{"/rest/v2/customers/{customerKey}/tokens":{"post":{"tags":["Customer Token"],"summary":"Add Token to a Customer","description":"Add an existing payment token to the customer identified by the specified customer key.","operationId":"post","parameters":[{"name":"customerKey","in":"path","description":"Unique identifier of the customer.","required":true,"schema":{"type":"string"}},{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/customer-token"}},"application/xml":{"schema":{"$ref":"#/components/schemas/customer-token"}}},"required":true},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"customer-token":{"required":["card-type","customer-key","exp-date","last-four-digits","token-id"],"type":"object","properties":{"customer-key":{"type":"string","description":"Unique identifier of the customer to associate with the token."},"token-id":{"type":"string","description":"Unique identifier of the existing payment token that represents the card number."},"exp-date":{"type":"string","description":"Expire date of the card (MMYY)."},"card-type":{"type":"string","description":"Type of payment card associated with the token.","enum":["AMEX","Discover","JCB","MasterCard","VISA"]},"last-four-digits":{"type":"string","description":"Last four digits of the card number associated with the token."},"description":{"type":"string","description":"Description of the customer's card to help identify the payment method."},"default":{"type":"boolean","description":"Indicates whether this card is the default payment method for the customer."},"avs-address":{"type":"string","description":"Street address used for Address Verification Service (AVS) validation for the payment card."},"avs-zip":{"type":"string","description":"ZIP or postal code used for Address Verification Service (AVS) validation."}},"description":"Represents a stored payment token for a customer.","xml":{"name":"customer-token"}},"ClearentCustomerTokensResponsePayload":{"type":"object","properties":{"customer-tokens":{"$ref":"#/components/schemas/tokens"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"tokens":{"type":"object","properties":{"token":{"type":"array","items":{"$ref":"#/components/schemas/customer-token"}}},"description":"tokens","xml":{"name":"tokens"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```

## Update a Token

> Update the customer-key, status (ACTIVE, INACTIVE, or DELETED), or description of an existing payment token associated with the specified customer. To update other token details, you must delete the token and create a new one.

```json
{"openapi":"3.0.1","info":{"title":"Recurring Payments API","version":"2.0"},"paths":{"/rest/v2/customers/{customerKey}/tokens":{"put":{"tags":["Customer Token"],"summary":"Update a Token","description":"Update the customer-key, status (ACTIVE, INACTIVE, or DELETED), or description of an existing payment token associated with the specified customer. To update other token details, you must delete the token and create a new one.","operationId":"put_1","parameters":[{"name":"customerKey","in":"path","description":"Unique identifier of the customer.","required":true,"schema":{"type":"string"}},{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/customer-token"}},"application/xml":{"schema":{"$ref":"#/components/schemas/customer-token"}}},"required":true},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ClearentCustomerTokensResponsePayload"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"customer-token":{"required":["card-type","customer-key","exp-date","last-four-digits","token-id"],"type":"object","properties":{"customer-key":{"type":"string","description":"Unique identifier of the customer to associate with the token."},"token-id":{"type":"string","description":"Unique identifier of the existing payment token that represents the card number."},"exp-date":{"type":"string","description":"Expire date of the card (MMYY)."},"card-type":{"type":"string","description":"Type of payment card associated with the token.","enum":["AMEX","Discover","JCB","MasterCard","VISA"]},"last-four-digits":{"type":"string","description":"Last four digits of the card number associated with the token."},"description":{"type":"string","description":"Description of the customer's card to help identify the payment method."},"default":{"type":"boolean","description":"Indicates whether this card is the default payment method for the customer."},"avs-address":{"type":"string","description":"Street address used for Address Verification Service (AVS) validation for the payment card."},"avs-zip":{"type":"string","description":"ZIP or postal code used for Address Verification Service (AVS) validation."}},"description":"Represents a stored payment token for a customer.","xml":{"name":"customer-token"}},"ClearentCustomerTokensResponsePayload":{"type":"object","properties":{"customer-tokens":{"$ref":"#/components/schemas/tokens"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"tokens":{"type":"object","properties":{"token":{"type":"array","items":{"$ref":"#/components/schemas/customer-token"}}},"description":"tokens","xml":{"name":"tokens"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```
