Android POS quickstart
Verify a merchant terminal on Android, then accept a test WollettePay payment over NFC. The first checkpoint is terminal readiness; a payment result is a later checkpoint.
Choose your path
Both paths need the approved inputs below. Verify terminal association before adding other features. Use installation for SDK access and the current release/build status.
The repository starter download contains new association-only apps from 2dc4eca. The original complete starters retain their payment/key/receipt/recovery examples at 8cf5088.
Before you start
| Input | Needed for | Get it from |
|---|---|---|
| Approved SDK dependency/source | Build | Wollette; minimal starter 2dc4eca, original complete starter 8cf5088 |
| Test API origin | Association and payments | Wollette's approved environment |
| Merchant token and remaining lifetime | Association and payments | Your merchant authentication service |
| Merchant, branch, POS, original serial and capabilities | Association and payments | Your terminal provisioning flow |
| Existing test order and checkout flow ID | Complete payment starter/payment tests | Your host checkout system |
| Amount, currency and approved test location | Complete payment starter/payment tests | Your host order/location flow |
| Prepared Android consumer HCE wallet | NFC payment tests | An approved physical consumer app/device |
Confirm POS installation and provisioning first. POS uses a merchant session and terminal key; consumer DeveloperId credentials are separate.
For an association-only test, use the minimal repository app below or the existing-app component path. The complete payment starter reads order/location configuration during setup even though its association call does not submit a payment.
Run the repository starter
Use an authorised SDK checkout at b68c5259a3953e90afe000f4ea0a699b0f4fd9fc. The source-only download needs that SDK checkout; follow its README.
Open examples/android in Android Studio with Java 17 and Android SDK 35, then run the pos-app module. From the SDK root:
./android/gradlew -p examples/android :pos-app:assembleDebug- Enter the approved API origin, current merchant token and its actual remaining lifetime in seconds.
- Enter the original merchant/branch/POS IDs, serial, device name and complete actual comma-separated capabilities. Do not invent a new identity.
- Select Check terminal association. Expected: the original serial and capabilities returned by Wollette. Stop and resolve any mismatch with provisioning.
- Clear merchant session calls SDK cleanup; it does not initiate or cancel a payment.
The screen is examples/android/pos-app/src/main/kotlin/com/wollette/starter/PosStarterActivity.kt. Configuration fields and the merchant token are not persisted. After restart, reenter the same context and a current token. The app uses storage ID pos-starter; keep it and the API origin stable when adapting the source. Association alone requires no payment key, order, second device or consumer developer key.
The new POS host app compiled in the 6 November main-branch CI run. No live association or physical payment was executed. This app has no payment, checkout, key-maintenance or refund UI. Use the original complete example below and the payment guides when adding those features; keep one SDK owner per namespace.
Original complete payment starter
The following numbered steps apply only to the original complete starter download, built on 2 November against 8cf5088. Its configuration and payment controls differ from the minimal association app.
1. Configure the test app
Connect the authorised SDK with the bundle's prepare-sdk.py. Copy app/src/main/assets/wollette.properties.example to wollette.properties and replace the required values. Keep the API URL, storage ID and original terminal identity unchanged after a restart.
Use API 24+, Java 17 and compileSdk 35. The Gradle project declares its dependencies and the library supplies NFC permission. Storage, signing and SDK work run in Dispatchers.IO in this starter.
Supply all actual capabilities, including NFC and BAAS for this example. An emulator build does not demonstrate NFC operation.
2. Attach the merchant and verify the terminal
Enter a merchant test token and its remaining lifetime on screen, then select Attach merchant and check terminal. The token is held in memory; it is not a bundled configuration value or a saved UI field.
The app applies the session, selects the original terminal and calls ensureDeviceAssociation(). An existing association is returned unchanged, so the app checks the registered capabilities.
Checkpoint: The app reports the selected terminal's key state and any retained operation. If an operation exists, use recovery before creating a key or accepting another payment. See sessions and terminals.
3. Prepare a usable key
| Key state | Next action |
|---|---|
| Ready | Continue |
| Rotation due | Continue while usable; schedule explicit rotation |
| Missing | Use Create missing terminal key only for approved new setup, or import a trusted existing key |
| Expired | Follow explicit rotation in the key guide |
| Recovery required | Follow explicit unknown-key recovery |
The starter does not automatically rotate/import keys. See terminal key management. Resolve a saved financial operation before any key mutation.
4. Accept a payment or initiate a refund
Use a supported physical NFC reader and a prepared Android consumer HCE payment screen. Select Accept test payment. For a refund, configure a distinct host refund checkout and the original payment request ID, then select Initiate test refund.
The app records its host attempt before calling pay or refund. The SDK retains its own encrypted operation. A return value contains a status, request ID and idempotency ID.
Checkpoint: Display the returned status. A tag-read/transfer stage is not authorisation. An authorised payment still needs your host's order/split completion; the starter has no order-completion service.
See pay, refund and the result-handling guide.
5. Save the result before acknowledging
The supplied CheckoutStore saves the host order, original request details and returned result separately from the SDK journal. If saving fails, the app leaves the SDK entry intact.
| Result | Starter action |
|---|---|
| Authorised, declined, blocked or failed | Save result, then acknowledge the retained entry; block another initiation for this checkout |
| Pending authorisation or timed out | Save the current result and retain the SDK operation; offer recovery |
| Exception/cancellation | Preserve the host attempt; inspect the SDK operation before any retry |
Checkpoint: A definitive saved checkout cannot initiate again after acknowledgement or app restart. If later host completion fails, resume that unfinished step rather than calling pay again.
The sample store illustrates one test checkout. Your production host owns durable order storage, duplicate prevention, split allocation, refund limits and completion.
6. Stop and recover
Stop local attempt cancels local work; it does not cancel a submitted server payment. After restart, reattach the original merchant/session/terminal context, then use:
- Inspect saved operation to see its phase.
- Recover retained result/request for a cached result or known request ID.
- Replay saved unknown submission only for a submitted operation without a request ID. The SDK reuses the exact saved request and enforces its recovery window.
- Abandon never-submitted attempt only for an acknowledgeable pre-submission phase, after the active call has ended.
An existing host attempt with no SDK journal remains blocked for reconciliation. Keep IDs and storage stable; see operation recovery.
Troubleshooting
| Symptom | Check | Next action |
|---|---|---|
| Session required/expired | Correct merchant token and remaining lifetime | Attach a renewed session, then recover retained work |
| Forbidden/changed context | Original merchant, branch, POS and serial | Restore the matching context |
| Association lacks capability | Registered values, not only local configuration | Confirm provisioning with Wollette |
| Missing/expired/recovery key | keyState() and saved operation | Use the corresponding key-maintenance path |
| NFC unavailable/permission failure | Hardware, NFC state and platform provisioning | Correct device setup; inspect saved operation before retry |
| Timed out or unknown submission | Journal phase and any known request ID | Recover the original operation |
| Result save/acknowledgement fails | Host receipt and SDK journal | Preserve both; recover and finish host handling |
| Empty journal but host attempt exists | Original checkout/receipt | Reconcile externally; do not start a replacement payment |
First-run milestones
| Milestone | Required setup | What success proves |
|---|---|---|
| Compile | Approved source/dependency and native toolchain | Host code and imports resolve |
| Verify association | Merchant session, original terminal identity/capabilities and stable storage | The API recognises the terminal; no second device or payment key needed for this component check |
| Receive a payment result | Original order/location, resolved journal, usable key and prepared physical payer/reader | Inspect the actual financial status; data transfer alone is not authorisation |
| Complete the host flow | Durable receipt/order state and backend completion | The host finishes once and prevents duplicate initiation |
The complete payment starter's configuration includes order/location inputs before its setup action. For an association-only first test in your existing app, use the smaller component below.
Integrate into your existing app
Download the copyable integration components. The POS feature supplies association only; your application supplies config, merchant authentication, original terminal details and a setup screen.
| Component | App ownership |
|---|---|
PosAssociationFeature | Keep one feature for each API URL and storageId; it creates and retains its SDK instance |
| Merchant login/renewal | Your authentication service supplies the token and its real remaining lifetime |
| Terminal configuration | Your provisioning flow supplies merchant/branch/POS/serial/name and complete capabilities |
| Setup screen | One task, returned association display, cancellation and typed errors |
| Payment/order service | Original checkout, durable receipts, key/journal handling and host completion |
Use the feature as the SDK owner for that API URL and storageId. When adding payments, keep association, keys and financial calls in that same service. Give independently managed terminals distinct stable storage IDs; selecting a terminal does not create a new storage namespace. Do not create another SDK instance for the same namespace.
After restart, reuse the same API URL and storageId, attach a current merchant session and restore the original terminal. Inspect pendingOperation() before changing keys or starting a new charge. On screen exit cancel setup/acquisition; logout and terminal selection have their own lifecycle rules.
Connect the association screen
Copy PosAssociationFeature.kt from the component download's Kotlin source directory after adding the POS dependency. Construct it in an IO coroutine and retain it in your application service container.
import com.wollette.examples.PosAssociationFeature
val feature = withContext(Dispatchers.IO) {
PosAssociationFeature(applicationContext, config)
}
val registered = feature.connect(accessToken, expirySeconds, terminal)config, terminal, accessToken and expirySeconds come from the POS access pack and your host authentication flow. Display registered.serialNo, compare its returned capabilities, and stop setup if the association mismatches. Association does not create keys or initiate a payment. The complete helper runs synchronous setup on IO. Handle WollettePosException by kind/status/uncertainty and propagate coroutine cancellation.
Next steps
Run the success, decline, interruption and relaunch scenarios in POS limitations and support. Then add NFC/Bluetooth coordination, refund handling and your production order lifecycle.
The download records actual compilation checks. Physical NFC/Bluetooth, approved backend outcomes, key replacement and end-to-end payments/refunds still need acceptance testing.