Flutter SDK Lite
The Tonder Flutter SDK Lite is a solution for integrating our system into your mobile application. This solution ensures PCI DSS (Payment Card Industry Data Security Standard) by securely collecting and tokenizing sensitive data in the browser, without exposing your front-end infrastructure to any sensitive data.
With the Lite SDK, you can create personalized designs and workflows to register your customers’ cards in the vault. This gives you with the flexibility to customize the registration process according to your business needs and preferences.
This guide will walk you through all the steps, from installation and configuring our SDK to fit your application.
Installation
Tonder’s Flutter SDK Lite can be installed using the following command, or by adding the dependency directly into your project:
Requirements
To deploy to Android or MacOS you need to add the following:
To deploy to Android, you need to edit your AndroidManifest.xml
file, adding the internet permission to it:
Configuration
With Tonder’s SDK installed, and requirements met, you are ready to configure and use our SDK. The following step-by-step process takes you through everything, from starting a new instance, to using the available methods:
Import the SDK into your file
You need to start by adding the import statement for the liteCheckout
class in your file. Following you find an example of how to import the liteCheckout
:
Initialize Tonder's SDK Instance
Initialize the Tonder’s Flutter SDK instance with the following parameters:
Field | Description |
---|---|
baseUrlTonder | Tonder’s API base URL. -> Live server: https://stage.tonder.io -> Mock Server: https://stoplight.io/mocks/tonder/tonder-api-v1-2/3152148 |
apiKeyTonder | Your Tonder API key. You can find it in your Tonder dashboard. |
Ensure all API keys and sensitive data are secured and not hardcoded in production applications. Use environment variables or a secure way to load such configurations.
Use the methods available
After initializing the SDK, you have at your disposal a set of methods, allowing you full control over the checkout process. Refer to the Class Methods section to learn more about each one.
Class Methods
After configuring your Lite Checkout instance, you have at your hand various methods to work with Tonder. Below you will find all the available methods, with an example of the data returned by each so you can understand how they work:
Get Business
Customer Register
Create Order
Start Checkout Router
Get Vault Token
Register Customer Card
Get Customer Cards
Delete Customer Card
Get Device Session ID
3DS Verification
Get Business
This method retrieves all the information about your business. Get details on providers public keys, vault information, and more. To call it, do the following:
Customer Register
The customerRegister
allows you to retrieve a customer’s authorization token by adding their email address as the only parameter to this method. To retrieve it, execute the following:
Create Order
To create a new order with the Lite SDK, use the createOrder
method. This method requires an object as parameter with the following data:
Field | Description |
---|---|
business | Your business’s API key. |
client | Authentication token for the client recovered with the customerRegister method. |
billing_address_id | ID of the billing address (null if not available). |
shipping_address_id | ID of the shipping address (null if not available). |
amount | Total amount of the order. |
status | Status of the order. |
reference | Reference information for the order. Recovered with the getBusiness method. |
is_oneclick | Boolean indicating one-click order (true/false). |
items | List of items in the shopping cart. |
Where each item
has the following properties:
Field | Description |
---|---|
description | A textual description of the item. |
quantity | The quantity of the item. |
price_unit | The price per unit of the item. |
discount | The discount applied to the item, if any. |
taxes | The taxes applicable to the item. |
product_reference | A numerical reference or identifier for the item. |
name | The name of the item. |
amount_total | The total amount for the item, including taxes and discounts. |
With the data, call the method like presented below:
Create Payment
To create a new payment with the Lite SDK, use the createPayment
method. This method requires the following parameters:
Field | Description |
---|---|
business_pk | The primary key or identifier for the business associated with the payment. |
amount | The total amount of the payment. |
date | The date when the payment is made or processed. |
order | The identifier for the order associated with this payment. |
Start Checkout Router
The startCheckoutRouter
method initiates the checkout process for the customer. This method requires the following to be added as parameter object:
Field Name | Description |
---|---|
card | Card details used in the transaction. |
name | The first name of the client or customer. |
last_name | The last name of the client or customer. |
email_client | The client’s email address. |
phone_number | The client’s phone number. |
return_url | URL to which users should be redirected after payment. |
id_product | Identifier for the product being purchased. |
quantity_product | Optional numerical value indicating the quantity of the product ordered. |
id_ship | Identifier for the shipping information. |
instance_id_ship | Identifier related to a specific instance of shipping. |
amount | The total amount of the transaction. |
title_ship | title or name for the shipping method. |
description | The transaction or product details. |
device_session_id | Dynamic field typically used for fraud prevention, identifying the device. |
token_id | Token associated with the payment method. |
order_id | The order identifier. |
business_id | The business identifier associated with the transaction. |
payment_id | The payment identifier. |
source | The source or origin of the transaction. |
To call this method, use the example below:
Get Vault Token
Use the getVaultToken
to retrieve the vault credential that is required to register a customer’s card. Use the following example to call this method:
Register Customer Card
Using the customer’s token and the skyflow id, you can register the customer’s card in the vault. The table below presents the required data, followed by an example call to the registerCustomerCard
method:
Field Name | Description |
---|---|
customerToken | A token that uniquely identifies the customer. Used for authentication and access control. |
data.skyflow_id | An identifier generated by Skyflow used to track or reference a customer in a secure and compliant way. |
Get Customer Cards
Use the getCustomerCards
to retrieve all registered cards for the customer, allowing them to use a saved card to perform transactions. Below are the parameters to execute this call, followed by an example call to it:
Field | Description |
---|---|
customerToken | A token that uniquely identifies and authenticates the customer making the request. |
query | A query string used to specify and filter the details required, such as card type or status. |
Delete Customer Card
Use the deleteCustomerCard
to delete any registered card for the customer, allowing them to removed a saved card from the system. Below are the parameters to execute this call, followed by an example call to it:
Field | Description |
---|---|
customerToken | A token that uniquely identifies and authenticates the customer making the request. |
skyflowId | An optional identifier generated by Skyflow, used to specify which card should be deleted. If not provided, it defaults to an empty string. |
Get Device Session ID
Using the getOpenpayDeviceSessionID
method, you can retrieve your device session id. This method requires you to add the following data to the parameter of the call:
Field Name | Description |
---|---|
merchant_id | The unique identifier for the merchant in the system. |
public_key | The public key associated with the merchant for transaction security. |
production_mode | Optional boolean indicating whether the system is in production mode or not. Defaults to null which might imply a test mode unless specified. |
The returned data will be your device’s session id.
3DS Verification
You can use the 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: