Finishing a payment
The charge
and refund
functions have a completion handler that has a PaymentResult
object as a parameter. You can get info about the result of the transaction from
this object. The completion handler will always be called when the payment flow
is closing.
The PaymentResult
object has a property of type enum
called result
, which can
be any of the following ResultCode
values.
ResultCode.swift
The result enum helps identify the state of the payment and if an error has occurred.
Payment result example
Handling Tips
The charge
function also accepts a parameter askForTip
. When this feature is
used, you will need to account for any tip amount entered after a payment is
started.
You will get back three amounts in the paymentResult: