1. Documentation
  2. AppFlow
  3. POS Applications
  4. Guides

Guides


Quick guide

If you are looking to perform a quick integration to test AppFlow from your application before reading through the full documentation, this page provides the steps and code snippets that you can copy into your application to make that happen.

  • Add API dependency

implementation 'com.aevi.sdk.pos.flow:payment-initiation-api:<version>

  • Make sure you configure your application to compile with Java 8

  • Add response listeners for your app to be notified of responses to initiated flows

  • Add code to check for FPS and initialise the client

public void initialise() {
    if (!PaymentApi.isProcessingServiceInstalled(context)) {
        // TODO Show a message stating that the AEVI Flow Processing Service must be installed and abort/exit.
    }
    paymentClient = PaymentApi.getPaymentClient(context);
}
  • Add code to initiate payments and requests - here we use sale and tokenisation as examples
    public void initiateSale() {
        Payment payment = new PaymentBuilder()
                .withPaymentFlow("sale")
                .withAmounts(new Amounts(10000, "EUR"))
                .build();

        paymentClient.initiatePayment(payment)
                .subscribe(() -> Log.i("InitiatePayment", "Payment accepted"),
                           this::handleApiException);
    }

    public void initiateTokenisation() {
        Request request = new Request("tokenisation");

        paymentClient.initiateRequest(request)
                .subscribe(() -> Log.i("InitiateRequest", "Request accepted"),
                           this::handleApiException);
    }

    private void handleApiException(Throwable throwable) {
        if (throwable instanceof FlowException) {
            FlowException flowException = (FlowException) throwable;
            Toast.makeText(context, flowException.getErrorCode() + " : " + flowException.getErrorMessage(), Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(context, "Unexpected error: " + throwable.getMessage(), Toast.LENGTH_LONG).show();
        }
    }
  • Wire up the new methods in your application so you can test via UI
  • Install the developer bundle on an Android (API level 21+) device
  • Install and run your application (non-obfuscated variant)
  • Now you can initiate flows!

Next steps

Now that your application has a basic integration, we'd recommend you read through the Flow Initiation Guide and explore the javadocs and samples code. Also make sure to explore the rest of the documentation.