Guides • Accept Payments
Refund payments
doc

Refund payments via the Revolut Reader iOS SDK

In case you need to return money to your customers, you can initiate refunds for transactions that were completed successfully. This functionality can be used to issue both full and partial refunds, depending on the scenario.

1. Define the amount and currency to refund

First, you need to define the amount to refund by instantiating a Money object, see the following example for a 1£ refund:

let money = Money(amount: 100, currency: .GBP)

2. Define refund

Defining a refund works similar to accepting payments. To initiate a refund, you need to create a RefundDefinition instance, containing a Money object (you can also use the object you defined in the previous section).

To associate the refund with a specific payment, you need to pass the paymentId parameter in the RefundDefinition.

Optionally, you can provide a description to help you identify these transactions easier.

let paymentId = "<paymentId>" // Replace with the actual paymentId from the previous transaction

let refundDefinition = RefundDefinition(
money: money, // The object defined in the previous step.
description: "Refund for a macchiato",
paymentId: paymentId
)

3. Start refund flow

To start the refund flow call the refund function on your RefundDefinition:

RevolutCardReaderKit.shared.refund(
definition: refundDefinition, // The object defined in the previous step.
onResult: { result in
// Handle the result of the refund process
// This could include updating the user interface, logging the refund, or handling errors
}
)

For a full list of available parameters, see: Revolut Reader iOS SDK: Parameters.

info

Processing refunds do not require interaction with the Revolut Reader.

Example with all possible parameters

let money = Money(amount: 100, currency: .GBP)
let paymentId = "<paymentId>" // Replace with the actual ID of the payment from the previous transaction

let refundDefinition = RefundDefinition(
money: money,
description: "Refund for a macchiato",
paymentId: paymentId
)

RevolutCardReaderKit.shared.refund(
definition: refundDefinition,
onResult: { result in
// Handle the result of the refund process
// This could include updating the user interface, logging the refund, or handling errors
}
)
Was this page helpful?