The Tonder Ionic SDK Full 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.
This guide will walk you through all the steps, from installation and configuring our SDK to fit your application.
With Tonder’s SDK installed, and requirements met, you are ready to configure and use the SDK. The following step-by-step process takes you through everything, from starting a new instance, to performing a new transaction using the needed methods:
1
Mobile settings
Follow the instructions below to configure your mobile application for Android and iOS devices.
To deploy your app on Android, you must add the Internet permission to your AndroidManifest.xml file. Add the following code to your XML:
<!-- Required to fetch data from the internet. --><uses-permissionandroid:name="android.permission.INTERNET"/>
2
Add the required ID to your HTML
Tonder’s Ionic SDK Full requires a tonder-checkout ID to function, which needs to be added to an empty div as shown below:
<div><h1>Checkout</h1><!-- You have to add an entry point with the ID 'tonder-checkout' --><divid="tonder-checkout"></div></div>
3
Initialize Tonder's SDK Instance
Initialize Tonder’s Ionic SDK Full instance:
import{InlineCheckout}from"@tonder.io/ionic-full-sdk";const apiKey ="You can find this in your Tonder Dashboard";const returnUrl ="http://my-website:8080/checkout-success";const inlineCheckout =newInlineCheckout({ apiKey, returnUrl,});
The InlineCheckout object includes all the functionalities of LiteCheckout and adds the capability to handle the rendering of the card payment form. InlineCheckout not only manages transactions but also facilitates the visual integration of the payment form in your application, providing a complete payment experience.
Below is a table of all parameters available, including the required ones for initialization:
Property
Type
Required
Description
apiKey
string
✔️
The API key used for authentication and authorization.
returnUrl
string
✔️
The URL to which the user is redirected after the checkout process, regardless of success or failure.
After properly configuring your Full SDK instance, you have at your hand various methods to work with Tonder. Below you will find a detailed information about the checkout data needed with an example, and all the available methods in the SDK.
The payment function payload needs to be an object with detailed information about the customer, currency and cart. Below you find details abou each needed field:
Field
Description
firstName
The first name of the customer.
lastName
The last name of the customer.
country
The customer’s country of residence.
address
The customer’s street address.
city
The city of residence of the customer.
state
The state or region within the country.
postCode
The postal code or ZIP code of the customer’s address.
email
The email address for communication with the customer.
phone
The contact phone number of the customer.
Field
Description
currency
The currency used by the customer.
Field
Description
total
The total amount for the customer’s purchase.
items
An array containing details of individual items in the purchase.
Once you have set the payment data, you will need to notify the cart of the total amount by calling the setCartTotal method. This method takes a single parameter, a number representing the total amount, which should match the value set in the checkoutData. Here is an example code to help you call it correctly:
You can use the setCustomerEmail method to register a customer’s email in Tonder. This method requires a string parameter and can be called using the following example:
The injectCheckout method is a function that allows you to incorporate Tonder’s Checkout feature into your application. This function leverages the element with the ID tonder-checkout that was added in Step 1 to display the checkout components on your page. To use this method, use the following code:
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:
inlineCheckout.verify3dsTransaction().then(response=>{console.log('Verify 3ds response', response);if(response.transaction_status==='Success'){alert('3DS Transaction verified.');// Proceed with normal payment flow}elseif(response.transaction_status==='Failed'){alert('3DS Transaction Failed');}});
You can customize your checkout in two ways using Ionic SDK Full. You can either include a style parameter when creating the InlineCheckout instance or use HTML and CSS.
Below you will find more details about both options:
To customize your checkout using HTML and CSS, you can use predefined classes in your HTML and customize them in the CSS.
The styles parameter is related to the style of the inputs inside the checkout form. To customize the checkout container and the cards list, you can use the global styles and classes presented below: