AndroidManifest.xml
file to add the Internet permission.Import the Lite Checkout class
LiteCheckout
class in your file. Following you find an example of how to import the LiteCheckout
:LiteCheckout
object provides all the necessary methods to perform transactions. Essentially, LiteCheckout handles calls to Tonder services, allowing transactions to be performed without the need to integrate additional visual components.Initialize Tonder's SDK Instance
Field | Description |
---|---|
mode | Environment mode. Options: stage , production , sandbox , development . Default: stage |
apiKey | Your Tonder API key. You can find it in your Tonder dashboard. |
returnrl | URL where the checkout form is mounted (used for 3DS) |
callBack | Callback function to be invoked after the payment process ends successfully. |
Start Checkout Router method
liteCheckout
instance, you need to call the configureCheckout
method and provide all the necessary data as an object. This method handles the entire checkout process, executing the transaction and returning the payment response. To start, call the configureCheckout
providing the necessary information found below:Parameter | Type | Description |
---|---|---|
order | object | Represents the details of each item in the order. |
total | number | The total amount for the order. This should match the sum of the costs of items in the order. |
customer | object | Information about the customer. |
skyflowTokens | object | The details of the card to be used on the transaction. |
return_url | string | URL to which the customer will be redirected after the checkout process is completed. |
isSandbox | boolean | A boolean indicating if the transaction is being processed in a sandbox environment for testing purposes. |
metadata | object | Optional additional data about the order that might be used for processing or tracking. |
currency | string | The currency in which the transaction is conducted. Refer to the Currencies Reference page for details. |
configureCheckout
parameter, followed by an example code:Example
Initialize the Checkout
injectCheckout
method with your liteCheckout instance, with the code below:getCustomerCards
saveCustomerCard
removeCustomerCard
secureToken
to be able to manage cards with Tonder’s SDK. Refer to the How to Use secureToken for Secure Card Saving to learn how to do this.getCustomerCards
method to retrieve previously saved customer cards:
saveCustomerCard
method to save a new card into the system. This method requires an object as parameter to define the card’s properties:
Sure! Here’s a markdown table with the keys and their descriptions:
Key | Description |
---|---|
card_number | The credit card number without spaces or dashes. |
cvv | The card verification value, a 3 or 4-digit code. |
expiration_month | The month when the card expires. |
expiration_year | The year when the card expires. |
cardholder_name | The full name of the cardholder as on the card. |
removeCustomerCards
method to delete a previously saved customer card by passing the card ID as parameter:
getCustomerPaymentMethods
method:
payment
method. This method requires an object as parameter with the following data:
Key | Description |
---|---|
customer | An object containing customer information |
cart | An object containing cart and item details |
currency | The currency code for the transaction (e.g., “MXN”) |
metadata | An object for additional metadata (e.g., order ID) |
card | An object containing card details for a new card |
payment_method | The selected payment method (optional) |
customer
Key | Description |
---|---|
firstName | Customer’s first name |
lastName | Customer’s last name |
country | Customer’s country |
address | Customer’s street address |
city | Customer’s city |
state | Customer’s state or region |
postCode | Customer’s postal code |
Customer’s email address | |
phone | Customer’s phone number |
cart
Key | Description |
---|---|
total | Total amount for the cart |
items | An array of item objects |
Key | Description |
---|---|
description | Description of the product |
quantity | Quantity of the product |
price_unit | Unit price of the product |
discount | Discount applied to the product |
taxes | Taxes applied to the product |
product_reference | Reference code for the product |
name | Name of the product |
amount_total | Total amount for this product (after discount and taxes) |
card
Key | Description |
---|---|
card_number | The credit card number without spaces or dashes |
cvv | Card Verification Value (3 or 4-digit code) |
expiration_month | Card’s expiration month (e.g., “12”) |
expiration_year | Card’s expiration year (e.g., “25”) |
cardholder_name | Name on the credit card |
card
object with the saved card’s identifier:payment_method
Key | Description |
---|---|
payment_method | The selected payment method (e.g., “Spei”) |
metadata
Key | Description |
---|---|
order_id | Unique identifier for the order |
Create Payment response
verify3dsTransaction()
method to validate if a 3DS challenge was successful or not. Use the example below to call the method and handle the response as needed:
Function | Description |
---|---|
validateCardNumber(cardNumber) | Validates the card number using the Luhn algorithm. |
validateCardholderName(name) | Checks if the cardholder name is valid. |
validateCVV(cvv) | Ensures the CVV is in the correct format. |
validateExpirationDate(expirationDate) | Validates the expiration date in MM/YY format. |
validateExpirationMonth(month) | Checks if the expiration month is valid. |
validateExpirationYear(year) | Validates the expiration year. |