Skip to main content

SDK setup

note

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:

settings.gradle.kts
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>"
}
}
}
}
app/build.gradle.kts
dependencies {
implementation("co.openfabric:of-in-app-shopping-sdk:0.1.12")
}
One artifact, and you choose the environment

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.

OfEnvironmentUse
DevOpen Fabric's own environment. Not reachable with tenant credentials.
SandboxIntegration testing.
ProdLive 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.

VersionNotes
0.1.12Current. One artifact with SdkConfig.environment; SdkConfig.simulation for testing; several renames, listed below.
0.1.6onPaymentStatus replaces onSuccess; checkoutDetection replaces checkoutUrls; adds paymentStatusDetection.
0.1.5Automation engine downloaded from the backend and hash-verified, rather than compiled into the SDK.
0.1.4 and earlierPre-release. Not supported.
Upgrading from 0.1.6

0.1.12 is not source-compatible. The removed names have direct replacements:

RemovedReplacement
OfInAppShoppingSdk.attach then session.startSessionOfInAppShoppingSdk.startSession, one call
SessionCallback, CheckoutCallback, OnSessionExpiredCallbackCheckoutListener
session.requestOrderDetailssession.readOrder
session.runPaymentAutomationsession.pay
AutomationCallbackPaymentListener
onPreconditionFailedonPaymentBlocked
PaymentStatus.UNKNOWNPaymentStatus.UNCONFIRMED
session.setTestCardSdkConfig.simulation, see Testing
the -demo artifactSdkConfig.environment

Requirements​

  • Minimum SDK version: Android 6.0 Marshmallow (API level 23)
  • Permissions: android.permission.INTERNET
  • A WebView in 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:

App.kt
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 propertyDescription
environmentWhich Open Fabric environment to talk to: OfEnvironment.Dev, Sandbox or Prod. Defaults to Prod. Fixed for the life of the process.
simulationReports a payment outcome you choose instead of waiting for the transaction. Leave unset for live traffic. See Testing.
debugTurns 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.
tenantNameYour display name. The SDK injects no in-page UI — use this to brand your own payment hint or approval overlay.
tenantLogoUrlOptional 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.