Accept popular payment methods with a single client-side implementation.
Use this integration if you want your iOS application to:
- Accept cards and other payment methods.
- Save and display cards for reuse.
Make sure you have an active FawryPay account, or create an account.
Download and test our sample application.
On this page, we will walk you through the Android SDK integration steps:
- InstallingFawryPaySDK.
- InitializeandConfigureFawryPayAndroidSDK.
- Override the SDK colors.
- Return payment processing information and inform your client of the payment result.
This document illustrates how our gateway can be integrated into your iOS application in simple and easy steps. Please follow the steps in order to integrate the FawryPay iOS SDK in your application.
- Add the following repository to your (root)
build.gradle
repositories { ...
jcenter()
maven { url 'https://nexus.mobile.fawry.io/repository/maven-public/' }
}
- And add the following to your (app)
build.gradle
dependencies {
...
implementation 'com.fawry.fawrypay:avl:0.0.18'
}
- Add the following to your
Manifest.xml
<application
...
tools:replace="android:allowBackup" />
- Finally add the following property to your
build.properties
android.enableJetifier=true
- Create an instance of
- LaunchCustomerModel
- LaunchMerchantModel
- FawryLaunchModel
and pass the required parameters (Required and optional parameters are determined below).
LaunchCustomerModel
PARAMETER | TYPE | REQUIRED | DESCRIPTION | EXAMPLE |
---|---|---|---|---|
customerName | String | optional | - | Name Name |
customerEmail | String | optional | - | email@email.com |
customerMobile | String | optional | - | +0100000000 |
customerProfileId | String | optional | - | 1234 |
AVLInfo
PARAMETER | TYPE | REQUIRED | DESCRIPTION | EXAMPLE |
---|---|---|---|---|
billTypeCodeWith Fees | Int | mandatory | - | 4433 |
billTypeCodeWith outFees | Int | mandatory | - | 3344 |
internationalBANs | ArrayList [String] | mandatory | BANs related to the bank to use the billTypeCodeWithoutFees | arrayListOf("51234 5","5506900 |
BANValidationSize | Int | mandatory | - | 6 |
onUsAvlFees | Double | mandatory | - | 5.0 |
offUsAvlFees | Double | mandatory | - | 7.0 |
LaunchMerchantModel
PARAMETER | TYPE | REQUIRED | DESCRIPTION | EXAMPLE |
---|---|---|---|---|
merchantCode | String | required | Merchant ID provided during FawryPay account setup. | +/IPO2sghiethhN6tMC== |
merchantRefNum | String | required | Merchant's transaction reference number is random 10 alphanumeric digits. You can call FrameworkHelper.shared?.getMerchantReferenceNumber() to generate it rather than pass it. | A1YU7MKI09 |
secretCode | String | required | provided by support | 4b8jw3j2-8gjhfrc-4wc4-scde-453dek3d |
FawryLaunchModel
PARAMETER | TYPE | REQUIRED | DESCRIPTION | EXAMPLE |
---|---|---|---|---|
launchCustomerModel | LaunchCustomerModel | optional | Customer information. | - |
launchMerchantModel | LaunchMerchantModel | required | Merchant information. | - |
allow3DPayment | Boolean | optional - default value = false | to allow 3D secure payment make it “true” | - |
skipReceipt | Boolean | optional - default value = false | to skip receipt after payment trial | - |
skipLogin | Boolean | optional - default value = false | to skip login screen in which we take email and mobile | - |
beneficiaryWalletNumber | String | mandatory | - | “01234567890” |
avlValues | Double | mandatory | - | 7.00 |
billingAcct | String | mandatory | - | “01234567890” |
avlInfo | AVLInfo | mandatory | - | “01234567890” |
apiPath | String | optional | - | "fawrypay-a pi/api/" |
- Calling Mode:
- Payment Mode: Call launchAVL from CalllaunchAVLfromFawrySdk.launchAVL
PARAMETER | TYPE | REQUIRED | DESCRIPTION | EXAMPLE |
---|---|---|---|---|
activity | Activity | required | The activity which will be the starting point of the SDK. | - |
_fawryLaunch Model | FawryLaunchModel | required | Has info that needed to launch the SDK | Example in step 3 |
_baseUrl | String | required | Provided by the support team. Use staging URL for testing and switch for production to go live. | (https://atfawry.fawrystaging.com) (staging) (https://atfawry.com) (production) |
_languages | String | required | SDK language which will affect SDK's interface languages. | FawrySdk.Langua ges.ENGLISH |
If you want to change colors: - You need to know the ID of the color you want to change then add a color in your colors file in the host app with the same id but with the value you want
If you changed these colors it will change the main screen color in the payment fragment I made it black and red as an example in the host app, but you can change it to whatever you want. For example:
<color name="fawry_blue">#FF000000</color>
<color name="fawry_yellow">#F44336</color>
<color name="fawry_green">#FFEB3B</color>
<color name="dim_text_color">#FFFFFFFF</color>
<color name="fawry_black">#FFFFFFFF</color>
<color name="fawry_white">#FFFFFFFF</color>
<color name="fawry_background">#809199</color>
and for logo you can add a png file in the drawable package and name it fawry_pay_logo.png and for fonts you can add fonts in your package with the names:
fawry_bold_font
fawry_regular_font
There are 5 callbacks:
-
onInit() { }
- called before launching the flow successfully.
-
onPreLaunch(onPreLaunch: FawryPreLaunch) { onPreLaunch.onContinue() }
- called when the flow is launched.
-
onFailure(error: String) { }
- if the payment didn't pass.
- if you enabled the receipt, this callback will be called after clicking the done button in the receipt.
- if you disabled the receipt, this callback will be called upon the finish of the payment screen and the failure of the payment.
-
onPaymentCompleted(msg:String,data:Any?){}
- will be called only whether the payment passed or not. And it's called upon receiving the response of the payment either success or fail.
-
onSuccess(msg:String,data:Any?){}
- if the payment passed.
- if you enabled the receipt, this callback will be called after clicking the done button in the receipt.
- if you disabled the receipt, this callback will be called upon the finish of the payment screen and the success of the payment.