Purchase
1 min
Starting a purchase
Once a device has been selected, you can start a transaction using the startTransaction method on your ToroClient instance:
toro.startTransaction(
amount: 1000, // £10.00
type: .purchase,
currency: .gbp,
metadata: nil,
onCompleted: { receipt in
// Called when a receipt has been generated for a transaction
print("Transaction Completed: \(receipt)")
},
onCancelled: { cancellationType in
// Called when the transaction was cancelled by the attendant or customer
print("Transaction Cancelled: \(cancellationType)")
},
onError: { error in
// Called when an error has occured during a transaction
print("Transaction Error: \(error)")
},
onGratuityConfirmed: { amount, percentage in
print("Customer confirmed a gratuity of \(amount) (\(percentage)%)")
}
)