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
| Parameter | Type | Description |
|---|---|---|
pakms | String | Optional. 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
| Field | Type | Description |
|---|---|---|
expMonth | String | Card expiration month. |
expYear | String | Card expiration year. |
first6 | String | First 6 digits of the card number. |
last4 | String | Last 4 digits of the card number. |
name | String | Name of the cardholder. |
token | String | Token string used for future payment operations. |
brand | CardType | Enum 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.
Updated about 9 hours ago
