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)askForTip: Boolean
- (Optional) Flag to determine if the SDK should ask for tipparams: 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
metaData: Map<String, String>?
- (Optional) Map of key-value pairs, providing additional info that will be passed on to the OnoSDKstaffMember: YocoStaff?
- (Optional) Yoco Staff member performing paymenttransactionId: String?
- (Optional) a pre-set transactionId to use for the current transactiontransactionCompleteNotifier: ((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 |
QR | PaymentType.QR |
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 |
Mauritian Rupee (MUR) | SupportedCurrency.MUR |