Mobile SDKs
Securely collect sensitive cardholder data such as the card number and the cvv code in your native iOS or Android app with our new mobile SDKs. Completely outsource your tokenisation processes to our libraries and benefit from a simple, fully PCI DSS compliant integration and features such as:
- Smart, secure and state of the art UI components
- Card brand identification and input validation
- Card scanner
- Theme support: Style various items according to your CI
- Dark mode support
This section covers the credit card number and cvv code tokenizations only.
If you need to process 3D-Secure authentication within your SDKs please refer to our SDK 3D integration.
Access the latest version of our SDKs by following the links below and link the latest release to your app projects.
As a next step, continue with the initialization of our iOS or Android SDK.
For iOS, you can add the SDK to your project by adding a new Swift package dependency in Xcode and pointing to the github repository
datatrans.github.io/ios-sdk
. By default, enable all packages presented in the package selection. If you are building an App Clip project, you may select only your required packages, which will depend on your payment methods and flows. Please reach out to our support if you are unsure about what packages you required. Besides adding the packages via a Swift package dependency, you can also add the SDK via Cocoapods with pod 'Datatrans'
.For the card scanner to work, a usage description for the camera use will be required in your
.plist
file. If you do not provide a description for the camera use, the app will crash when starting the card scanner..plist File
Key : Privacy - Camera Usage Description
Value : $(PRODUCT_NAME) requires camera access to scan cards.
For Android projects, you can link the repo and dependencies as demonstrated here:
Android implementation
repositories {
...
maven { url 'https://datatrans.jfrog.io/artifactory/mobile-sdk/' }
}
dependencies {
...
implementation 'ch.datatrans:android-sdk:2.3.0' // check release notes for latest version
}
If you are building an Instant app, you may exclude specific packages that are not required in your project. This will depend on your tokenisation process, however by default you should be able to exclude all components. Please reach out to our support if you are unsure about what packages you can exclude.
Excluding Dependencies
dependencies {
...
implementation ('ch.datatrans:android-sdk:2.3.1') { // Check release notes for latest version
exclude group: 'io.card', module: 'android-sdk'
}
}
The table below lists all the dependencies which can be excluded.
Feature | Group | Module |
---|---|---|
Credit Card Scanner | io.card | android-sdk |
Google Pay | com.google.android.gms | play-services-wallet |
Samsung Pay | com.samsung.android.sdk | samsungpay |
Create a tokenization object with your
merchantId
and paymentMethodTypes
to start a tokenisation. Below is an example of the suggested minimum options to start a tokenisation with iOS (Swift) and Android (Kotlin, Java). Please read our detailed classes description for iOS and Android to discover more initialization options.Swift
Kotlin
Java
let tokenizationRequest = PCIPTokenization(merchantId: merchantId, paymentMethodTypes: [.Visa, .MasterCard])
tokenizationRequest.delegate = self
tokenizationRequest.start(presentingController: navigationController)
val tokenizationRequest = PCIPTokenization(merchantId, [VISA, MASTER_CARD])
tokenizationRequest.listener = this
TransactionRegistry.startTokenizationRequest(this, tokenizationRequest)
PCIPTokenizationRequest tokenizationRequest = new PCIPTokenization(merchantId, [VISA, MASTER_CARD]);
tokenizationRequest.setListener(this);
TransactionRegistry.INSTANCE.startTokenizationRequest(this, tokenizationRequest);
After the tokenization has been completed, your
PCIPTokenizationDelegate
(iOS) or PCIPTokenizationListener
(Android) is notified about the success, error or cancel state of the processed tokenization. The tokenizationId
as well as additional card meta data are returned in PCIPTokenizationSuccess
class.It is possible to only collect the CVV code of a card. Please check
init(merchantId:cvvOnlyCard:)
for iOS and PCIPTokenization(merchantId: String, cvvOnlyCard: CvvOnlyCard)
for Android in the respective API reference to learn more. To obtain the tokenized values, you first need to submit the
tokenizationId
returned by the SDK to your server. Subsequently, call the GET Token API from your server together with the
tokenizationId
to obtain the tokens for the card number and the CVV code. Additionally, the API returns the expiry dates, the fingerprint of the card number as well as the cardInfo
object. post
https://api.sandbox.datatrans.com
/v1/tokenizations/{tokenizationId}
GET Token
Request
Response
curl -L -X POST 'https://api.sandbox.datatrans.com/v1/tokenizations/210329160815401747' \
-H 'Authorization: Basic MTEwMDAxNzc4OTpNQUd6UUVEbkVxd001d0Vr' \
-H 'Content-Type: application/json'
{
"paymentMethod": "VIS",
"alias": "7LHXscqwAAEAAAGCpe2M7PXWj2StAOG6",
"fingerprint": "F-fgxnFwN-gsIw7y80T-kpBB",
"maskedCard": "489537xxxxxx6287",
"aliasCVV": "aYsIbb_KTQSbmWDrqlPp7hXM",
"expiryYear": "23",
"expiryMonth": "02",
"cardInfo": {
"brand": "VISA",
"type": "debit",
"usage": "consumer",
"country": "US",
"issuer": "U.S. REGION"
}
}
You can style various colors in our Mobile SDKs to match your corporate identity. Check the graphic below to see what color properties can be defined.
On iOS, you can define your preferred colors within the class
ThemeConfiguration
. On Android you can set theming options in your project’s color XML resource file, typically colors.xml. Use the color key names as defined in the table below.
Property | Description | Android | iOS |
---|---|---|---|
Background Color¹ | Background color of the navigation bars. If this is not specified, the navigation bars will be transparent. | barBackgroundColor | dtpl_bar_background_color |
Bar Link Color² | Color of the buttons in the navigation bars. If this is not specified, the color will be the color set in Link Color. | barLinkColor | dtpl_bar_link_color |
Bar Title Color³ | Color of the title within the navigation bars. If this is not specified, the color will be the text color. The text color is either white or black and cannot be customized. | barTitleColor | dtpl_bar_title_color |
Button Color⁴ | Background color of large buttons, such as the Pay button. If this is not specified, the color will be the color set in Link Color. | buttonColor | dtpl_button_color |
Button Text Color⁵ | Text color of large buttons, such as the Pay button. If this is not specified, the color will be set to white. | buttonTextColor | dtpl_button_text_color |
Link Color⁶ | Color of text-only buttons or links and the text cursor. If this is not specified, the link color will be in a blue tone. | linkColor | dtpl_link_color |
Our iOS and Android Mobile SDK integrations are currently translated and supported in the following languages:
- English
en
- German
de
- French
fr
- Italian
it
Please get in touch should you need an additional language to be added for your checkout or if you find a translation error.
Last modified 6mo ago