Skip to main content
The TapiPay native SDK opens the payment widget inside your Android or iOS app, on a screen owned by the SDK, and tells you through events what the user is doing. It is the mobile counterpart of the payment methods SDK: it mounts the same views (payments and autopay management) and uses the same data to identify your company and your user.

Android

Kotlin, Jetpack Compose or Views. Installed with Gradle.

iOS

Swift, SwiftUI or UIKit. Installed with Swift Package Manager.

How it works

  1. Your app calls Tapipay.present(...) (or shows the SDK’s TapipayButton) with your user’s identifier and your company’s.
  2. The SDK opens the TapiPay widget on a native screen, on top of your app.
  3. While the user pays or manages their autopay enrollments, the SDK delivers events to a callback.
  4. Your app closes the widget when it needs to, or the user closes it with the Close button or the back gesture.
No SDK event confirms a payment. When PaymentSubmitted (Android) or .paymentSubmitted (iOS) arrives, the user submitted the payment, but it is not settled yet. The real status reaches your backend through the payment notification.

Requirements

On both platforms you need:
  • Your end user’s identifier (identifier), the same one you send when you create the debt.
  • Your company alias (organization) or your company code (companyCode). They work the same as in the web SDK: see Identify your company.

Android

1. Add the TapiPay repository

The SDK is distributed through a TapiPay Maven repository. Add it to your project’s settings.gradle.kts:
settings.gradle.kts

2. Add the dependency

In your app module’s build.gradle.kts:
build.gradle.kts
The artifact is named button for compatibility, but it contains the full SDK: the widget screen, the events and the optional button.
You do not need to change your AndroidManifest.xml: the SDK already declares the INTERNET permission and its own screen. You do not need ProGuard or R8 rules either: the SDK ships its own. The SDK brings Jetpack Compose and Material 3 as dependencies. If your app uses Views (XML), you can still open the widget with Tapipay.present(); only TapipayButton requires Compose.

3. Open the widget

Call Tapipay.present() from any Context (ideally an Activity):
present() throws IllegalArgumentException if the configuration is invalid: identifier is missing, you pass neither organization nor companyCode, or you use selectionStrategy with the autopay view. The event callback is always invoked on the main thread.

4. Close the widget

The widget does not close by itself after a payment. Close it when you need to:
dismiss() does not emit any event (you already know you closed it) and does nothing if no widget is open. You can call it from any thread.

Compose button (optional)

If your app uses Jetpack Compose, TapipayButton renders a Material 3 button that opens the widget when tapped:
It takes colors and typography from your MaterialTheme. If you pass onClick, the button does not open the widget and hands the tap to you.

TapipayConfig options

Events on Android

TapipayEvent is a sealed interface:
Always include an else -> branch in your when. New SDK versions can add events: without else, your code stops compiling or silently ignores the event. Kotlin may flag the else as redundant; keep it anyway.

Appearance on Android

TapipayAppearance configures the native top bar that wraps the widget. If you pass nothing, it uses your MaterialTheme colors. You can also redefine the default texts in your app with the tapipay_button_text, tapipay_checkout_title, tapipay_checkout_close and tapipay_checkout_load_failed resources.

Android best practices

  • One widget at a time. If you call present() while a widget is already open (for example, on a double tap), the call is ignored.
  • Do not capture the Activity in the callback. The SDK keeps the callback while the widget is open. Forward events to a ViewModel or check the Lifecycle before touching the UI.
  • Rotation and dark mode do not recreate the widget screen. If Android destroys the screen due to low memory, the widget reloads and the user has to fill in the form again.

iOS

1. Add the package

The SDK is distributed through Swift Package Manager from this repository:
  1. Open File → Add Package Dependencies…
  2. Paste the repository URL.
  3. Under Dependency Rule, choose Up to Next Minor Version from 0.1.0.
  4. Add the Tapipay product to your app target.
Xcode embeds the framework with no extra steps.
While the SDK is on 0.x versions, use Up to Next Minor Version (.upToNextMinor): you get fixes (0.1.x) without a 0.2.0 release changing your build unexpectedly. The SDK is only distributed through Swift Package Manager (no CocoaPods or Carthage).
You do not need to add permissions or keys to your Info.plist.

2. Open the widget

Tapipay.present() presents the widget modally over the visible screen. Call it from the main thread:
By default the SDK presents the widget from your app’s visible screen. To choose where it is presented from, pass the from: parameter with your UIViewController.

3. Close the widget

The widget does not close by itself after a payment. Close it when you need to:
dismiss() does not emit .closed (you already know you closed it) and does nothing if no widget is open.

SwiftUI button (optional)

TapipayButton is a SwiftUI button that opens the widget when tapped:
If the configuration is invalid, the button does not throw: it delivers the error as a .failed event. If you pass onClick, the button does not open the widget and hands the tap to you.

TapipayConfig options on iOS

Events on iOS

Always include @unknown default in your switch. New SDK versions can add events: without @unknown default, if an event your app does not know arrives, the app crashes.

Configuration errors

Tapipay.present() validates the configuration before opening the widget and throws a TapipayError:

Appearance on iOS

Autopay management

With view = TapipayView.AUTOPAY (Android) or view: .autopay (iOS), the SDK mounts autopay management: your user sees their enrolled payment methods, enrolls a new one or removes an existing one.
As on the web, autopay events only expose the payment method type, the last 4 digits and an opaque id. Account holder data and full account or card numbers never travel.

Staging environment

Use staging while you build and test your integration, and remove the parameter (or use production) before you publish your app.

After the payment

The widget does not close by itself when the user submits the payment: it shows a “payment submitted” screen and stays open until someone closes it. The widget always opens inside your app. If the user taps a link to another site, it opens in the browser; tel:, mailto: or other app links open with the matching system app.

Coming soon

Two-way channel between your app and the SDK. We are building a two-way communication channel between your app and the SDK. It will bring new features to the TapiPay SDKs. We will let you know in What’s new when it is available.