Skip to main content
This page provides a reference for the core methods available in the LiteCheckout class of the Flutter Lite SDK.

Core Methods

The Tonder Flutter Lite SDK provides these essential methods for payment processing and card management with complete UI control. Each method serves a specific purpose in the payment integration workflow.
MethodDescription
new LiteCheckout(..)Initializes the SDK with configuration like apiKey and returnUrl.
configureCheckout(..)Configures customer email and secure token for card management operations.
setPaymentData(data)Loads the customer data (name, email, etc.) into the SDK instance.
setCartTotal(total)Sets the total amount for the transaction.
payment(cardData)Processes a payment with the provided card data from your custom form.
saveCustomerCard(cardData)Saves a customer’s card for future use.
getCustomerCards()Retrieves all saved cards for the customer.
removeCustomerCard(cardId)Removes a saved card by its ID.

Method Details

Each method in the Tonder Flutter Lite SDK serves a specific purpose in the payment integration workflow. Below you’ll find detailed information about each method, including their parameters, usage examples, and practical implementation guidance.
Creates a new instance of the LiteCheckout class with the necessary configuration for secure payment processing. This constructor establishes the connection with Tonder’s services and configures the payment environment.
ParameterTypeDescription
apiKeyStringYour Tonder API key for authentication
returnUrlStringURL where users are redirected after payment completion
Here’s an example of how to initialize the LiteCheckout class:
LiteCheckout(
  apiKey: "YOUR_API_KEY",
  returnUrl: "YOUR_RETURN_URL",
)
Sets customer email and the secure token required for card management operations.
ParameterTypeDescription
customerEmailStringCustomer’s email address
secureTokenStringSecure token obtained from your backend (required for card operations)
Here’s an example:
_liteCheckout.configureCheckout(
  customerEmail: 'customer@example.com',
  secureToken: 'SECURE_TOKEN_FROM_BACKEND',
);
Configures the customer information that will be used during the payment process. This data is used to associate the transaction with the customer.
ParameterTypeDescription
dataMap<String, dynamic>Customer information including name, email, etc.
Here’s an example of how to set the customer data:
final customerData = {
  'first_name': 'Juan',
  'last_name': 'Pérez',
  'email': 'juan.perez@example.com'
};
_liteCheckout.setPaymentData(customerData);
Sets the total amount for the transaction. This value is used for payment processing.
ParameterTypeDescription
totalintTotal amount in cents (e.g., 399 for $3.99)
Here’s an example of how to set the cart total:
_liteCheckout.setCartTotal(399); // $3.99
Processes a payment using the provided card data collected from your custom form.
ParameterTypeDescription
cardDataMap<String, dynamic>Card information collected from your custom UI
Here’s an example of how to process a payment:
final cardData = {
  'card_number': '4111111111111111',
  'cardholder_name': 'John Doe',
  'expiration_month': '12',
  'expiration_year': '25',
  'cvv': '123',
};

try {
  final response = await _liteCheckout.payment(cardData);
  print('Payment successful: $response');
} catch (error) {
  print('Payment failed: $error');
}
Securely tokenizes and saves new card details for the customer.
ParameterTypeDescription
cardDataMap<String, dynamic>Card information to be saved
Here’s an example:
final cardData = {
  'card_number': '4111111111111111',
  'cardholder_name': 'John Doe',
  'expiration_month': '12',
  'expiration_year': '25',
  'cvv': '123',
};

try {
  final response = await _liteCheckout.saveCustomerCard(cardData);
  print('Card saved successfully: $response');
} catch (error) {
  print('Error saving card: $error');
}
Retrieves a list of saved cards for the configured customer.
ParameterTypeDescription
None-This method takes no parameters
Here’s an example:
try {
  final cards = await _liteCheckout.getCustomerCards();
  print('Saved cards: $cards');
  // Display cards in your custom UI
} catch (error) {
  print('Error loading cards: $error');
}
Deletes a previously saved card using its unique ID.
ParameterTypeDescription
cardIdStringUnique identifier of the card to remove
Here’s an example:
try {
  await _liteCheckout.removeCustomerCard('card_abc123');
  print('Card removed successfully');
} catch (error) {
  print('Error removing card: $error');
}

Next Steps

Now that you’re familiar with the available methods in the Flutter Lite SDK, explore these guides to enhance your implementation: