📱Cowpay Android SDK
This document is a guide for Cowpay Android SDK. In addition, following the below steps will help you learn how to add and use (Cowpay SDK) in your Android Application.
1. REQUIREMENTS
Minimum Android SDK 24
Target API level 34
2. INSTALLATION
1- Add the JitPack repository to the project-level build.gradle file:
2- Add Frames SDK dependency to the module gradle file:
You can find the latest version here
3- Update org.jetbrains.kotlin.android in build.grade (Project: Your Project) to be 1.9.0:
4- Update kotlinCompilerExtensionVersion in build.grade (Module :app) to be 1.5.1:
3. IMPORT
4. USAGE
Step 1: Initialize the payment info:
Step 2: Initialize the SDK:
CowpaySDK.init function is used for Initializing Cowpay SDK instance to use it.
It’s a throws function so please put it in a try…catch blocs.
Step 3: launch SDK and create a callback object:
CowpaySDK.launch function is used for launching Cowpay SDK.
It’s a throws function so please put it in a try…catch blocs.
CowpayCallBack object contains Success, error and closedByUser call backs
5. ADDITIONAL OPTIONS
If you want to do an action based on payment method you can make success call back like that:
5. VALUES DESCRIPTION
localizationCode
Select your language code LocalizationCode.EN for English, and LocalizationCode.AR for Arabic. The default value is English
environment
Select the environment CowpayEnvironment.STAGING for staging and CowpayEnvironment.PRODUCTION for production.
amount
Transaction amount. Two decimal values like "15.60", were sent in case of partial capture. (Required)
description
charge request description that reserves the payment name. (Required)
customerMerchantProfileId
The ID of the customer being charged on your system. (Required)
merchantReferenceId
A unique alphanumeric value is required as an identifier for the charge request. (Required)
customerFirstName
customer first name (Required)
customerLastName
customer last name (Required)
customerEmail
customer valid email address. (Required)
customerMobile
Nationally formatted customer mobile that should start with 01. (Required)
isFeesOnCustomer
Boolean variable, True if the customer will pay transaction fees and false if not.
Default value is false.
merchantCode
Your code that presented in your panel. (Required)
merchantHash
Hash Key that is presented in your panel. (Required)
merchantPhoneNumber
merchant phone number. (Required)
merchantLogo
merchant logo url
CowpayCallback
Call back functions model. It contains success, error, and closedByUser callbacks. (Required)
success
Call back function if transaction succeeds.
error
Call back function when an error occurres.
closedByUser
Call back function if customer goes back before making a transaction.
paymentSuccessMode
Payment success model that contains paymentReferenceId and paymentMethodName.
paymentReferenceId
Payment reference number.
paymentMethodName
Payment method name (credit card, fawry, etc…)
Last updated