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
var tippingSetting: TippingConfig = TippingConfig.DO_NOT_ASK_FOR_TIP
let receiptNumber = UUID().uuidString
let parameters = PaymentParameters(receiptDelegate: self,
userInfo: [
"user" : "info"
],
staffMember: YocoStaff(staffNumber: "1234", name: "Joe Bloggs"),
receiptNumber: receiptNumber,
note: "test note",
transactionCompleteNotifier: { paymentResult in
// Do something once the payment is complete
}))
let transactionID = Yoco.charge(1000,
paymentType: .card,
currency: .zar,
tippingConfig: tippingSetting,
parameters: parameters) { paymentResult in
// Do something once the Yoco SDK dismisses
}

Supported Payment Types

Here is a list of the currently supported payment methods:

MethodSwift
Card (default)PaymentType.card
CashPaymentType.cash
note

The cash payment type will show the receipt screen and will not go through any payment process, it is up to you to handle the receipt.

Supported TippingConfigs

ConfigurationSwift
Do not ask for tipTippingConfig.DO_NOT_ASK_FOR_TIP
Ask for tip on readerTippingConfig.ASK_FOR_TIP_ON_CARD_MACHINE
Include amount as tip(programmatically)TippingConfig.INCLUDE_TIP_IN_AMOUNT(tipInCents:)

Supported Currencies

Here is a list of the currently supported currencies:

CurrencySwift
South African Rand (default)SupportedCurrency.zar