📱Cowpay iOS Framework
This document is a guide for Cowpay iOS Framework. In addition, following the below steps will help you learn how to add and use (Cowpay Framework) in your iOS Application.
Last updated
This document is a guide for Cowpay iOS Framework. In addition, following the below steps will help you learn how to add and use (Cowpay Framework) in your iOS Application.
Last updated
minimum Xcode version 14.2
minimum iOS Deployment 15.2
Download the zip file from Versions page.
Unzip the file you will find CowpayFramework.xcframework file
Add the CowpayFramework.xcframework to your project by drag and drop the file to the Frameworks extension like the screenshot below:
Go to your project's General page
Select your target
Scroll to the Frameworks section
Press the plus button
In this window click on Add Other then Add Package Dependency
Add the following URL to the search bar in the top right corner:
You will find CowpayPackage visible in the packages panel
After clicking on it you can add the package directly from the master branch to get the latest version available. or you can download a specific version by changing the Dependency Rule to Exact Version and writing down the version compatible with your environment.
You can find our versions on the Versions page.
Click Add Package and you are good to go
First Apply to CowpayCallBack Protocol to use callbacks from the framework
PaymentSuccessModel is a protocol in which all methods response models apply. This means when you are using the onSuccess function follow the code below:
Initialize your payment info:
initialize Cowpay init model and pass the payment info and CowbayCallBack Protocol delegate reference
Do not forget to add the CowpayInitModel and PaymentInfo in a do catch block. as it may throw an error when the data sent is not valid
Launch Cowpay:
localizationCode
Select your language code enum value .en for English, and .ar if Arabic. (default is en)
amount
two decimal value like "15.60", sent in case of partial capture
customerEmail
customer valid email (should not be empty or nill)
customerMobile
internationally formatted customer mobile (should not be empty or nill)
customerLastName
customer last name being charged (should not be empty or nill)
customerFirstName
customer first name being charged (should not be empty or nill)
isfeesOnCustomer
is fees on customer or merchant (default is false)
logoStringUrl
merchant logo url (Optional)
merchantMobile
merchant mobile (should be valid mobile number starting with 01 and should not be empty or nill)
description
charge request description that reserve the payment name (should not be empty or nil)
customerMerchantProfileId
ID of the customer being charged on your system (should not be empty or nil)
merchantReferenceId
Unique alphanumeric value required as identifier for the charge request (must be unique per transaction and not be empty or nil)
cowpayEnvironment
.staging || .production (should not be empty or nil)
merchantHashCode
Hash code that is presented in your panel. (should not be empty or nil)
merchantCode
Your code is presented in your panel. (should not be empty or nil)
onSuccess
Call back function if transaction succeeds.
onError
Call back function when an error occurres.
onClosedByUser
Call back function if customer goes back before making a transaction.
cowpayCallBack
A delegate that handles the payment status (Required)
paymentInfo
Your payment info object (Required)