Android SDK
Install and initialize the Bolt Android SDK for checkout, account login, or custom payment flows.
The com.bolt:checkout package provides client APIs for Bolt Checkout, Bolt account login, and custom payment flows. Install and initialize it once, then continue to the guide for the capability you are building.
Installation
The SDK artifact is published to Maven Central. Add it to your app-level build.gradle or build.gradle.kts file:
dependencies {
implementation("com.bolt:checkout:0.9.0")
}You can find the latest version on Maven Central.
SDK initialization
The SDK must be initialized exactly once during your application's lifecycle. The best place to do this is in your custom Application class's onCreate() method.
First, declare your application subclass in your AndroidManifest.xml:
<application
android:name=".MyApplication"
...>
</application>Then initialize BoltCheckout with your application context, publishable key, and environment:
import android.app.Application
import com.bolt.checkout.BoltCheckout
import com.bolt.checkout.model.BoltEnvironment
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
BoltCheckout.init(
application = this,
publishableKey = "YOUR_PUBLISHABLE_KEY",
environment = BoltEnvironment.PRODUCTION, // or BoltEnvironment.SANDBOX for testing
)
}
}BoltCheckout.init() will throw an exception if called more than once. BoltCheckout.get() will throw an exception if called before init() has completed successfully.
Configuration requirements
To use the SDK, ensure you have the following credentials properly configured:
| Credential | Where it's used | Description |
|---|---|---|
publishableKey | BoltCheckout.init() | Your unique merchant identifier provided by Bolt. |
orderToken | BoltCheckoutConfig | A unique, per-checkout token generated by your backend server. |
Next steps
- Android checkout: Launch Bolt Checkout with an order token from your backend.
- SSO Login: Authenticate users with their Bolt account via OAuth 2.0.
- Custom Checkout: Build a custom checkout using the payment flow and authorization APIs.
- API Reference: Full reference for all delegates, result types, and callbacks.