Initialization
Create the A2A client, initialize it and manage its lifecycle.
Before calling any operation you must create a client and call initialize().
Initialization registers the broadcast receiver that listens for results coming
back from POS+. When you are done, call dispose() to release it.
Always initialize() before the first request and dispose() when the
screen/Activity is destroyed. Skipping dispose() leaks the receiver.
Create and initialize
class _CheckoutState extends State<Checkout> {
final _pluspay = PPA2AClient();
@override
void initState() {
super.initState();
_pluspay.initialize();
}
@override
void dispose() {
_pluspay.dispose();
super.dispose();
}
}Resolving the POS+ application
When launching POS+, the client resolves the target application automatically. On Flutter you can optionally provide a fallback package/activity name in case auto-resolution fails on a particular device:
await _pluspay.initialize(
fallbackPackageName: 'com.pluspay.pos',
fallbackActivityName: 'com.pluspay.pos.MainActivity',
);Language
POS+ can show its screens in a different language while it handles your
request. Send the language in the optional locale header field. When the
response has been delivered, POS+ switches back to the language it had before.
- Supported values:
tr,en,ar,de,fr,it,es,ru,zh. Region variants such asen_USoren-USare also accepted. - If
localeis missing or not supported, POS+ stays in its current language. - Kiosk devices ignore the field.
error_messagetexts are always Turkish, whatever thelocale. See Error handling.
Set a default for every request in initialize, or pass locale to a single
request's toRequest. A per-request value wins over the default. Available
from Flutter 0.8.0 and React Native 0.4.0. The supported values are exported
as ppSupportedLocales (Flutter) and PPSupportedLocales (React Native).
// Default for every request
await _pluspay.initialize(locale: 'en');
// Override for one request
await _pluspay.startOrderPayment(
PPOrderPaymentRequestModel.toRequest(orderCode: 'ORD001', locale: 'de'),
);Two API styles (native)
The native package exposes every operation in two equivalent forms:
- Callback — pass a
PPA2ACallback<T>withonSuccess(T)andonError(PlusPayException). - Coroutine —
suspendfunctions that return the typed result directly (Kotlin only).
The Flutter package exposes a single Future-based API. All examples in the
following pages show the idiomatic form for each language.
Continue to Payments.

