Refunding a payment

To refund a payment, invoke the refund function, providing the transactionID that was returned to you when you processed the payment.

You may optionally pass in an amountInCents to refund, to refund a portion of the total payment. If the amount is more than the amount still refundable, or the card used for the payment does not support partial refunds, then an error message will be shown to the user.

Refund example
1let userInfo: [AnyHashable: Any] = ["user": "info"]
2let parameters: RefundParameters = RefundParameters(
3 amountInCents: 200,
4 userInfo: userInfo,
5 staffMember: YocoStaff(staffNumber: "1234", name: "Joe Bloggs"),
6 refundCompleteNotifier: { paymentResult in
7 // Get notified immediately when the transaction is complete.
8 }
9)
10
11YocoSDK.refund(
12 transactionID: transactionID,
13 refundParameters: parameters
14) { (result) in
15 let alert = UIAlertController(
16 title: "Refund Completed", message: "Transaction refunded with result: \(result.result)",
17 preferredStyle: .alert)
18 alert.addAction(
19 UIAlertAction(title: "OK", style: .default) { action in
20 alert.dismiss(animated: true)
21 })
22 self.present(alert, animated: true)
23}