SDK setup
The In-App Shopping SDK is currently available for Android. An iOS SDK is in development; this page will gain an iOS tab when it is released.
Get the SDK
The SDK is published as a Maven package in Open Fabric's distribution repository. Add the repository to your Gradle settings, then declare the dependency:
- Android
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/open-fabric-pba-public/openfabric-in-app-shopping-sdk")
credentials {
// GitHub username and a personal access token with `read:packages`,
// both provided by Open Fabric during onboarding.
username = "<value provided by Open Fabric>"
password = "<value provided by Open Fabric>"
}
}
}
}
dependencies {
implementation("co.openfabric:of-in-app-shopping-sdk:0.1.12")
}
There is a single artifact, co.openfabric:of-in-app-shopping-sdk. Which Open Fabric environment it talks to is set at init through SdkConfig.environment. See Environments.
OfEnvironment | Use |
|---|---|
Dev | Open Fabric's own environment. Not reachable with tenant credentials. |
Sandbox | Integration testing. |
Prod | Live traffic. The default, so a build that sets nothing takes real money. |
Set it to match the environment your backend credentials belong to. Credentials from one environment do not work against another, and the failure is an authorization error at session start rather than a clear message about the mismatch.
Versions
Pin an explicit version. The SDK is pre-1.0 and minor versions have carried breaking API changes.
| Version | Notes |
|---|---|
| 0.1.12 | Current. One artifact with SdkConfig.environment; SdkConfig.simulation for testing; several renames, listed below. |
| 0.1.6 | onPaymentStatus replaces onSuccess; checkoutDetection replaces checkoutUrls; adds paymentStatusDetection. |
| 0.1.5 | Automation engine downloaded from the backend and hash-verified, rather than compiled into the SDK. |
| 0.1.4 and earlier | Pre-release. Not supported. |
0.1.12 is not source-compatible. The removed names have direct replacements:
| Removed | Replacement |
|---|---|
OfInAppShoppingSdk.attach then session.startSession | OfInAppShoppingSdk.startSession, one call |
SessionCallback, CheckoutCallback, OnSessionExpiredCallback | CheckoutListener |
session.requestOrderDetails | session.readOrder |
session.runPaymentAutomation | session.pay |
AutomationCallback | PaymentListener |
onPreconditionFailed | onPaymentBlocked |
PaymentStatus.UNKNOWN | PaymentStatus.UNCONFIRMED |
session.setTestCard | SdkConfig.simulation, see Testing |
the -demo artifact | SdkConfig.environment |
Requirements
- Minimum SDK version: Android 6.0 Marshmallow (API level 23)
- Permissions:
android.permission.INTERNET - A
WebViewin your app to host the merchant site — the SDK enables JavaScript and configures the WebView when you attach it.
Initialize the SDK
Initialize once at application start, before attaching any WebView:
class App : Application() {
override fun onCreate() {
super.onCreate()
OfInAppShoppingSdk.init(
application = this,
config = SdkConfig(
environment = OfEnvironment.Prod,
debug = false, // must be false in production builds
tenantName = "YourBrand",
tenantLogoUrl = "https://cdn.your-company.com/logo.png",
),
)
}
}
SdkConfig property | Description |
|---|---|
environment | Which Open Fabric environment to talk to: OfEnvironment.Dev, Sandbox or Prod. Defaults to Prod. Fixed for the life of the process. |
simulation | Reports a payment outcome you choose instead of waiting for the transaction. Leave unset for live traffic. See Testing. |
debug | Turns on the testing behaviours: card fields are no longer hidden during automation, and page captures, automation steps and merchant console messages are logged. See Testing. Must remain false in production builds; the SDK does not enforce this. |
tenantName | Your display name. The SDK injects no in-page UI — use this to brand your own payment hint or approval overlay. |
tenantLogoUrl | Optional HTTPS logo URL for your own payment UI. |
Open Fabric endpoints are resolved from the artifact you depend on, so there are no URLs to configure.
Sample app
Open Fabric provides a complete reference integration — merchant list, WebView screen, mock backend, approval overlay, and payment flow — that demonstrates every callback and API call described in the following pages. Contact your Open Fabric representative to get access during onboarding.
Next: Create a shopping session.