Making a payment
Basic usage
The amount that gets charged is in cents and must be a positive integer.
import YocoSDK
Yoco.charge(1000)
Advanced usage
This example shows you some of the extra functionality you can add to your use of the SDK by adding a PaymentParameters
object to the charge function call.
import YocoSDK
let parameters = PaymentParameters(receiptDelegate: self,
userInfo: [
"user" : "info"
],
metaData: [
"meta" : "data"
],
staffMember: YocoStaff(staffNumber: "1234",
name: "Joe Bloggs"),
adaptiveTheme: true,
transactionCompleteNotifier: { paymentResult in
// Do something once the payment is complete
}))
let transactionID = Yoco.charge(1000,
paymentType: .card,
currency: .zar,
askForTip: true,
parameters: parameters) { paymentResult in
// Do something once the Yoco SDK dismisses
}
Supported Payment Types
Here is a list of the currently supported payment methods:
Method | Swift |
---|---|
Card (default) | PaymentType.card |
QR | PaymentType.qr |
Cash | PaymentType.cash |
note
The cash payment type will just show the receipt screen and will not go through any payment process, it is up to you to handle the receipt.
Supported Currencies
Here is a list of the currently supported currencies:
Currency | Swift |
---|---|
South African Rand (default) | SupportedCurrency.zar |
Mauritian Rupee | SupportedCurrency.mur |