POS initiation - AEVI-AppFlow/pos-android-sdk GitHub Wiki
List of POS initiation functions and how to use with AppFlow.
To check for support for these on a device, use PaymentClient.getPaymentSettings()
and from the returned instance, paymentSettings.isFlowTypeSupported(flowType)
. See table below for all defined flow functions and their respective types.
You can then get the possible flows for that flow type via paymentSettings.getFlowNamesForType(type)
. The returned values can then be used as request type for a generic Request
, or to be set via paymentBuilder.withPaymentFlow(flowName)
for Payment
initiation.
Note that there may be more than one flow defined for any given type, meaning that you either have to know up-front which one to use (most likely as communicated from AEVI or the acquirer as part of a project), or present the choice to the merchant/operator to choose.
Function | Flow type | Request type |
---|---|---|
Sale/Purchase | sale | Payment |
Refund | refund | Payment |
Pre-Authorisation | preAuthorisation | Payment |
Pre-Auth Completion | preAuthCompletion | Payment |
Reversal/Void | reversal | Payment |
Tokenisation | tokenisation | Request |
Batch closure | batchClosure | Request |
Get previous transaction response | responseRedelivery | Request |
Cash receipt delivery | cashReceiptDelivery | Request |
Receipt redelivery | receiptRedelivery | Request |
etc | etc | etc |
chooseFlow()
would be a bespoke implementation for your application where you select the appropriate flow.
Note that for the majority of cases, there will only be one flow per type defined.
Example for transaction type "sale".
if (paymentSettings.isFlowTypeSupported("sale")) {
String flow = chooseFlow(paymentSettings.getFlowNamesForType("sale"));
Payment payment = new PaymentBuilder()
.withPaymentFlow(flow)
.withAmounts(new Amounts(1000, "EUR"))
.build();
paymentClient.initiatePayment(payment)
.subscribe(new Consumer<PaymentResponse>() {
@Override
public void accept(PaymentResponse paymentResponse) throws Exception {
// Implement
}
});
}
The way to check for supported types and retrieving the flow name is the same regardless of type. See below for generic code, and the following subsections for data input/output for each specific type.
if (paymentSettings.isFlowTypeSupported("tokenisation")) {
String flow = chooseFlow(paymentSettings.getFlowNamesForType("tokenisation"));
Request request = new Request(flow, data);
paymentClient.processRequest(request)
.subscribe(new Consumer<Response>() {
@Override
public void accept(Response response) throws Exception {
// Implement
}
});
}
To retrieve the token from the response, `