Refund - AEVI-AppFlow/pos-android-sdk GitHub Wiki
A refund involves transferring back all or a portion of money that was previously charged to a customer, typically via a sale flow.
For general information about initiating payments please see Implementing POS apps. For information about how to handle responses (regardless of type), see Handling Responses.
Create refund request
Payment
requests are built via the PaymentBuilder
. Below are the relevant parameters for a refund.
String flowName = getRefundFlow(); // Optional, if the flow name is known and required
Amounts amounts = new Amounts(1000, "USD"); // $10.00
PaymentBuilder paymentBuilder = new PaymentBuilder()
.withPaymentFlow("refund", flowName)
.withAmounts(amounts);
// If there is a basket detailing what items are being refunded
paymentBuilder.withBasket(basket);
// If you have a card token stored that should be used
paymentBuilder.withCardToken(token);
// If you have customer details
paymentBuilder.withCustomer(customer);
// If you want to add some bespoke data (values can be of any type)
paymentBuilder.addAdditionalData("myDataKey", "myDataValue");
// When done, build the payment
Payment payment = paymentBuilder.build();