Login

Contact

Refunds

The PayButton also makes it really easy to implement Refunds, Pre-Authorizations and Captures, allowing you to support the payment workflows that your merchants require.

Your transaction is based on a set of TransactionParameters and used in conjunction with MposUi.createTransactionIntent().

To perform a full or partial refund, you need to create new TransactionParameters with the transactionIdentifier the of the previous charge transaction. For partial refunds, you need to specify the amount that should be refunded.

Here's how you can perform refunds:


TransactionParameters parameters = new TransactionParameters.Builder()
        .refund("<transactionIdentifer>")
        // For partial refunds, specify the amount to be refunded
        // and the currency from the original transaction
        //.amountAndCurrency(new BigDecimal("1.00"), io.mpos.transactions.Currency.EUR)
        .build();
Intent intent = ui.createTransactionIntent(transactionParameters);
startActivityForResult(intent, MposUi.REQUEST_CODE_PAYMENT);
                
            

As a result, you will receive one of the following via the onActivityResult():

  • The original transaction that now contains information about the refund in the transaction.refundDetails;
  • An error indicating why refunding the charge failed.

To check if a transaction can be refunded in general, have a look at transaction.refundDetails.status.