generateCardToken
Generates a secure card token from the provided card details. This method handles the tokenization of card information in a PCI-compliant manner, ensuring sensitive data is never exposed in the application. The method returns a Result type that can be either Success with a CardToken or Error with details.
Return
Result
Example:
val result = coreMethods.generateCardToken(
cardNumberState = cardNumberField,
expirationDateState = expirationField,
securityCodeState = securityCodeField,
buyerIdentification = BuyerIdentification(
name = "John Doe",
number = "12345678",
type = "CPF"
)
)
when (result) {
is Result.Success -> {
val token = result.data.token
// Use token for payment processing
}
is Result.Error -> {
// Handle error
}
}
Parameters
PCI-compliant state containing the card number
PCI-compliant state containing the card expiration date
PCI-compliant state containing the card security code
Buyer identification information including name and document
See also
Generate Card Token with a cardId call.
This return a Result.Success of CardToken data model or a Result.Error of ResultError This uses the PCIFieldState for pass the values of the card in a secure way This is a suspend function and should be called only from a coroutine or another suspend functionC
Parameters
String The card id of a saved card
PCIFieldState of the security code text field
PCIFieldState of the expiration date text field. This should only be provided if required.
BuyerIdentification data class that`s handle the buyer identification name, number and type