Tokenization

Overview

Use card-present tokenization to capture card data for future processing with the Ecommerce Charge endpoint.

A card token is a unique, single-use code that represents a customer’s credit card details. It securely processes payments without exposing the actual card information.

Note: Tokens generated by tokenizeCard are compatible only with the Ecommerce API. Do not use these tokens with the Clover Go SDK charge request.

iOS implementation

Exchange card data for a Clover token using the tokenizeCard function:

public func tokenizeCard(pakms:String? = nil) -> AsyncThrowingStream<TokenizeCardEvent, Error>

Parameters

ParameterTypeDescription
pakmsStringOptional. If omitted, the SDK generates a key using the logged-in merchant's credentials. Override this default functionality only at the instruction of your Developer Relations (Dev Rel) Representative.

Response

The tokenizeCard function returns an AsyncThrowingStream with the following values:

public enum TokenizeCardEvent {
    case progress(PaymentProgressEvent)
    case complete(TokenizeCardResponse)
}
  • progress(PaymentProgressEvent): Returns multiple times. This follows the same flow and values defined in the Card present payments section.
  • complete(TokenizeCardResponse): Returns once upon completion; contains the token response object.

TokenizeCardResponse Object

FieldTypeDescription
expMonthStringCard expiration month.
expYearStringCard expiration year.
first6StringFirst 6 digits of the card number.
last4StringLast 4 digits of the card number.
nameStringName of the cardholder.
tokenStringToken string used for future payment operations.
brandCardTypeEnum representing the card type/brand.

Next Steps

The returned token is valid only for the merchant account associated with the PAKMS key. You cannot use this token for transactions on other merchant accounts.

Use the returned token to process payments using the Ecommerce API.