# Introduction
URL: /docs/a2a

App-to-app payment integration with the POS+ application using the PlusPay A2A packages.

PlusPay **A2A** (app-to-app) lets your application start payments, cancellations,
end-of-day and parameter operations on the **POS+** application that runs on the
same Android device, query the state of transactions and orders, and receive a
strongly-typed result back.

Your app never talks to the card reader or the banking network directly. It
hands a request to POS+, POS+ performs the payment on its certified payment
stack, and returns the outcome to your app.

## How it works

```
┌─────────────┐   1. request (Intent)    ┌─────────────┐
│             │ ───────────────────────▶ │             │
│  Your App   │                          │    POS+     │
│             │ ◀─────────────────────── │             │
└─────────────┘   2. result (broadcast)  └─────────────┘
```

1. Your app builds a typed request and calls a method on the A2A client.
2. The client launches POS+ through an Android **Intent**.
3. POS+ runs the transaction (card, cash, wallet, EFT-POS, …).
4. POS+ returns the result; the client parses it into a typed response object,
   or throws a typed error.

Because the integration is Intent + broadcast based, **it is Android only**.
There is no iOS support.

## Which package do I use?

There are three packages that expose the **same** capabilities. Pick the one
that matches your app's technology:

<Cards>
  <PlatformCard platform="flutter" title="pluspay_a2a (Flutter)" href="/docs/a2a/installation">
    A Flutter plugin. Use it from Dart/Flutter apps. Strongly-typed Freezed
    request/response models.
  </PlatformCard>

  <PlatformCard platform="kotlin" title="pluspay_a2a_native (Android)" href="/docs/a2a/installation">
    A native Android library (`.aar`). Use it from Kotlin or Java apps. Offers
    both callback and Kotlin coroutine APIs.
  </PlatformCard>

  <PlatformCard platform="react-native" title="pluspay_a2a_react_native (React Native)" href="/docs/a2a/installation">
    A React Native module. Use it from JavaScript/TypeScript apps. Android only.
  </PlatformCard>
</Cards>

Throughout this documentation every code sample is shown for **Flutter, Kotlin,
Java and React Native** in a tabbed block, so the same flow is described once
for all of them.

## Supported operations

| Operation                         | Method                       | Result                                   |
| --------------------------------- | ---------------------------- | ---------------------------------------- |
| Start a payment                   | `startPayment`               | `PPStartPaymentResponseModel`            |
| Cancel a payment                  | `cancelPayment`              | `PPStartPaymentResponseModel`            |
| Start an EFT-POS payment          | `startEftPayment`            | `PPStartPaymentResponseModel`            |
| Cancel an EFT-POS payment         | `cancelEftPayment`           | `PPStartPaymentResponseModel`            |
| Pay an existing order             | `startOrderPayment`          | `PPOrderPaymentResponseModel`            |
| Multi-payment / order             | `startMultiPayment`          | `PPMultiPaymentResponseModel`            |
| Create an order without payment ¹ | `createOrder`                | `PPOrderCreateResponseModel`             |
| End-of-day (settlement)           | `triggerEod`                 | `PPEodResponseModel`                     |
| Parameter update                  | `triggerParameters`          | `PPParametersResponseModel`              |
| Available payment methods ¹       | `getAvailablePaymentMethods` | `PPAvailablePaymentMethodsResponseModel` |
| Query a transaction ¹             | `getTransactionResult`       | `PPStartPaymentResponseModel`            |
| Query an order ¹                  | `getOrderResult`             | `PPOrderPaymentResponseModel`            |
| Technical cancel ¹                | `technicalCancel`            | `PPTechnicalCancelResponseModel`         |

¹ Flutter and React Native only. The native Android package does not support
these operations yet. The last three need Flutter 0.8.0 / React Native 0.4.0.

## Authentication

A2A runs entirely on-device: your app and POS+ exchange data through Android
intents, so there is no API key or token to configure. POS+ authenticates the
cardholder and settles the transaction with the bank.

## Next steps

<Cards>
  <Card title="Installation" href="/docs/a2a/installation">
    Add the package to your Flutter, Android or React Native project.
  </Card>

  <Card title="Initialization" href="/docs/a2a/initialization">
    Create and manage the A2A client lifecycle.
  </Card>

  <Card title="Payments" href="/docs/a2a/payments">
    Start, cancel, EFT and order payments.
  </Card>

  <Card title="Status queries & recovery" href="/docs/a2a/recovery">
    Find out what happened to a transaction and reverse it if needed.
  </Card>

  <Card title="Reference" href="/docs/a2a/reference">
    Enums and response model fields.
  </Card>
</Cards>