Making a Payment
info
When calling YocoSDK.charge()
without passing in a ActivityResultLauncher
and handling the PaymentResult
in onActivityResult
, it will be assigned the PaymentResultInfo.RequestCode.CHARGE_REQUEST
code
Parameters
context: Context
- The calling Activity/Fragment initiating the paymentamountInCents: Long
- Amount to be charged in centspaymentType: PaymentType
- Payment type (Default: CARD)currency: SupportedCurrency
- Currency that is associated with payment (Default: ZAR)tippingConfig: TippingConfig
- (Optional) Setting to determine if the SDK should ask for tip (Default DO_NOT_ASK_FOR_TIP)printerConfig: PrinterConfig
- Not set by integrators, set tonull
params: PaymentParameters
- (Optional) Provides additional info regarding the paymentreceiptDelegate: ReceiptDelegate?
- (Optional) Receipt screen callback handler and utiluserInfo: Map<String, Any>?
- (Optional) Map of key-value pairs, providing additional info regarding the user which will be returned to thePaymentResult
staffMember: YocoStaff?
- (Optional) Yoco Staff member performing paymentnote: String
- (Optional) Additional note to attach to this transactionbillId: String
- (Optional) Unique idenitifer of a bill to attach this transaction toreceiptNumber: String?
- (Optional) a pre-set identifier that can be used to lookup this transaction latertransactionCompleteNotifier: ((resultCode: Int, result: PaymentResult) -> Unit)?
- (Optional) transaction completion handler
result: ActivityResultLauncher<Intent>?
- (Optional) activity result handler contract to handle intent result
danger
The context
that is passed as a parameter MUST be calling activity/fragment's context and NOT the application context.
Supported Payment Types
Here is a list of supported payment types:
Payment Type | Value |
---|---|
Card (default) | PaymentType.CARD |
Cash | PaymentType.CASH |
info
The CASH payment type will always assume a successful payment and thus will complete the payment but can provide a way to handle the receipt
Supported Currencies
Here is a list of supported currencies:
Currency | Value |
---|---|
South African Rand (ZAR) (default) | SupportedCurrency.ZAR |
Supported TippingConfigs
Tipping Configuration | Value |
---|---|
Do not ask for tip | TippingConfig.DO_NOT_ASK_FOR_TIP |
Ask for tip on reader | TippingConfig.ASK_FOR_TIP_ON_CARD_MACHINE |
Include amount as tip(programmatically) | TippingConfig.INCLUDE_TIP_IN_AMOUNT(tipInCents:) |