Mobile
Introduction
The Software Development Kits for Android and iOS are libraries with a simple set of tools that allow you to easily communicate with the Paysafe Wallet API. The Android SDK is written in Kotlin using coroutines but Java is fully supported as well, using callback functions. The iOS SDK is a dynamic framework written in Swift.
By using the SDK, you can take advantage of pre-built features such as:
- Automatic SDK setup
- Automatic token management
- Built-in services for performing HTTP API calls to the Paysafe Wallet API
Main Concepts
Asynchronous Operations
The Android SDK is using suspend
functions to perform asynchronous operations using Kotlin coroutines.
All suspend
functions are safe to call from the main thread. Each suspend
function has a Java
version, suffixed with Async, with the same parameters and a callback.
The iOS SDK uses completion closures to notify caller when async operation is completed. Completion closure is always
called on the Main thread and provides Result
with either data or error. Async functions also return cancellation
handle for canceling in flight operations.
Wallet
All SDK features are exposed through the Wallet
object. The Wallet object is responsible for the SDK setup and
all services and API operations are accessible through it.
Wallet Operations
The SDK provides a set of services that are used for performing HTTP requests to the Paysafe Wallet API. Each of those services are responsible for different flows, such as user management, transactions, deposits, etc.
Error Handling
The SDK provides a unified approach to handling errors by throwing a WalletException
/WalletError
whenever an error
is returned by the Paysafe Wallet API.