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.
Return
Result: On Success CardToken, On ErrorResultError
Example:
val result = coreMethods.generateCardToken(
cardNumberState = cardNumberPCIState,
expirationDateState = expirationDatePCIState,
securityCodeState = securityCodePCIState,
buyerIdentification = BuyerIdentification(
name = "APRO",
number = "012345678909",
type = "CPF"
)
)
when (result) {
is Result.Success -> {
val token = result.data.token
// Use token for payment processing
}
is Result.Error -> {
// Handle error
}
}
Parameters
PCIFieldState containing the card number
PCIFieldState containing the card expiration date
PCIFieldStatecontaining the card security code
BuyerIdentification information including name and document
See also
Generate Card Token with a cardId call. This uses the PCIFieldState for pass the values of the card in a secure way
Return
Result: On Success CardToken, On Error ResultError name, number and type
Example:
val result = coreMethods.generateCardToken(
cardId = "<cardID>",
expirationDateState = expirationDatePCIState,
securityCodeState = securityCodePCIState,
buyerIdentification = BuyerIdentification(
name = "APRO",
number = "012345678909",
type = "CPF"
)
)
when (result) {
is Result.Success -> {
val token = result.data.token
// Use token for payment processing
}
is Result.Error -> {
// Handle error
}
}
Parameters
String The card id of a saved card
PCIFieldStatecontaining the card security code
PCIFieldState containing the card expiration date
BuyerIdentification information including name and document