Quick Start
This tutorial takes you from an initialized SDK to your first sale on the terminal.
Before you begin
Complete the Prerequisites and Add the SDK to your project.
Step 1: Initialize the SDK
Initialize the SDK once, during your application's startup, with
ApoloSdk.Builder. The build() call starts the warm-up, which loads the terminal configuration and authenticates with the payment services.kotlin
ApoloSdk.Builder(applicationContext)
.setCredentials(
clientId = "your_client_id",
clientSecret = "your_client_secret",
terminalCode = "your_terminal_code",
partnerName = "your_partner_name",
partnerPackageName = "com.yourcompany.app",
)
.setOnWarmUpStatus { status ->
when (status) {
WarmUpStatus.Loading -> { /* keep the UI in a waiting state */ }
WarmUpStatus.Success -> { /* the SDK is ready to operate */ }
is WarmUpStatus.Failure -> { /* show the cause; recover with shutdown() + build() */ }
}
}
.build()kotlin
ApoloSdk.Builder(applicationContext)
.setCredentials(
clientId = "your_client_id",
clientSecret = "your_client_secret",
terminalCode = "your_terminal_code",
partnerName = "your_partner_name",
partnerPackageName = "com.yourcompany.app",
)
.setOnWarmUpStatus { status ->
when (status) {
WarmUpStatus.Loading -> { /* keep the UI in a waiting state */ }
WarmUpStatus.Success -> { /* the SDK is ready to operate */ }
is WarmUpStatus.Failure -> { /* show the cause; recover with shutdown() + build() */ }
}
}
.build()Wait for
WarmUpStatus.Success before starting any operation. A Failure carries its cause — for example, a 401 for invalid credentials. To recover, call ApoloSdk.shutdown() and then build() again.Step 2: Get the client
After a successful warm-up, get the initialized client:
kotlin
val apolo = ApoloSdk.getClient()kotlin
val apolo = ApoloSdk.getClient()Step 3: Run your first sale
Start a direct credit sale for a fixed amount in cents. The terminal drives the card capture, PIN, and confirmation, and the result arrives in the callback.
kotlin
apolo.initSale(
context = activity,
saleSetup = BrSaleSetup.Credit(amountInCents = 1000L), // R$ 10.00
onPaymentResult = { result ->
// result.result == "00" indicates an approved transaction
},
)kotlin
apolo.initSale(
context = activity,
saleSetup = BrSaleSetup.Credit(amountInCents = 1000L), // R$ 10.00
onPaymentResult = { result ->
// result.result == "00" indicates an approved transaction
},
)Verify the integration
| Check | What to expect |
|---|---|
| Gradle sync | Completes without JDK errors. |
| Dependency | The SDK resolves from brazil-hml in the debug build type. |
| Initialization | setOnWarmUpStatus emits WarmUpStatus.Success. |
| Client access | After warm-up, ApoloSdk.getClient() returns the client without throwing. |
Next steps
- Process a sale — all payment methods and modes.
- Process a refund — reverse an approved transaction.
- Initialization reference — the full set of Builder options.
On this page
Quick Start