# Initialization Reference

Reference for `ApoloSdk.Builder`, the credentials and sub-merchant configuration, and the warm-up states. For a walkthrough, see [Quick Start](https://docs.globalgetnet.com/en/products/in-store-payments/getnet-toolbox?doc=sdk-wl-quick-start).

## Builder methods

| Method | Required | Description |
| :--- | :--- | :--- |
| `setCredentials(...)` | Yes | Onboarding credentials and integrator identifiers. Without them, warm-up fails. |
| `setSubMerchantInformation(config)` | No | Sub-merchant data, forwarded on each payment request. Depends on your business model. |
| `setOnWarmUpStatus(callback)` | No (recommended) | The channel to track warm-up progress and react to failures. |
| `build()` | — | Returns the `Apolo` client and starts the warm-up. Call it once per application lifecycle. |

## setCredentials

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `clientId` | `String` | Yes | Client identifier for authentication with the payment service. |
| `clientSecret` | `String` | Yes | Client secret associated with the `clientId`. |
| `terminalCode` | `String` | Yes | Code of the terminal running the SDK. |
| `partnerName` | `String` | Yes | Name of the integrating application. |
| `partnerPackageName` | `String` | Yes | Android package name of the integrating application. Must match the real package, or authentication fails. |

## SubMerchantConfig

All fields are required except `url`. Omitting a required field is a compile-time error.

| Field | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `subMerchantId` | `String` | Yes | Sub-merchant identifier. |
| `city` | `String` | Yes | Sub-merchant city. |
| `state` | `String` | Yes | State (UF). |
| `postalCode` | `String` | Yes | Postal code (CEP). |
| `taxId` | `String` | Yes | Tax number — CNPJ or CPF. |
| `street` | `String` | Yes | Street address. |
| `phone` | `String` | Yes | Contact phone. |
| `corporateName` | `String` | Yes | Legal name. |
| `url` | `String?` | No | Defaults to `null`. |

## Warm-up states

`setOnWarmUpStatus` reports the progress of the warm-up:

| State | Meaning | Recommended action |
| :--- | :--- | :--- |
| `Loading` | Internal preparation in progress. | Keep the UI in a waiting state; do not call SDK operations. |
| `Success` | The SDK is ready to operate. | Release the SDK operations. |
| `Failure(cause)` | Preparation could not complete. | Inspect `cause`, show a message, and retry. |

## Lifecycle

| Symbol | Behavior |
| :--- | :--- |
| `ApoloSdk.getClient()` | Returns the current `Apolo` client. Throws `IllegalStateException` if called before a successful `build()`. |
| `ApoloSdk.shutdown()` | Ends the current session so it can be rebuilt. |

To recover from `Failure`, call `shutdown()`, then configure and `build()` again. Do not call `build()` more than once without a prior `shutdown()`, and always get the client through `getClient()` rather than retaining the reference returned by `build()`.

For the warm-up error codes reported through `Failure(cause)` — network conditions, `401`, `404`, `422` — see the warm-up section of [Error codes reference](/en/getnet-toolbox/sdk-white-label/reference-sdk/error-codes).