Ezetap payments SDK can be integrated in both Android native and hybrid applications. Integrating the SDK will allow you to access Ezetap services in your application. SDK is available in
jar
and aar
formats. We recommend using aar
, as you can get started right away!
-
Copy the
aar
file, available in the latest version in release folder, intolibs
folder under your project directory. -
Add the below line in dependencies of your
build.gradle
file in your application.
compile(name: 'ezetapandroidsdk_X', ext: 'aar') Note: 'X' in the 'ezetapandroidsdk_X' represents the version (ex: ezetapandroidsdk_2_0)
- Add the below line in repositories section of your
build.gradle
flatDir {
dirs 'libs'
}
- Add the below provider in your project's
manifest
file inside application tag & replace your application ID in the place of<Your application ID>
. Your app ID/package name can be found in your app'smanifest
file under package tag or in theapplicationId
tag of your Gradle file.
<provider
android:name="com.ezetap.sdk.EzetapFileProvider"
android:authorities="<Your application ID>.EzetapFileProvider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
- If you have set attribute "tools:node" in you manifest for your application node. Please set it as tools:node="merge" as shown below, it is needed to merge all the elements from our manifest.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
tools:node="merge"
android:supportsRtl="true" >
-
You can find SDK
jar
file in the release folder of this repository, Add thejar
file inlibs
folder of your Native Android Project. -
In the
manifest
file of your project add the following permissions-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
- In the
manifest
file of your Android Project, add the below activity
<activity android:name="com.eze.api.EzeAPIActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
- If you intend to support Android Nougat API Level 24 & above, follow these steps:
- Add the below provider in your project's
manifest
file inside application tag & replace your application ID in the place of<Your application ID>
. Your app ID/package name can be found in your app'smanifest
file under package tag or in theapplicationId
tag of your Gradle file.
<provider
android:name="com.ezetap.sdk.EzetapFileProvider"
android:authorities="<Your application ID>.EzetapFileProvider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
- Create a file with name
provider_paths.xml
in yourProject / res / xml
folder and paste the following code:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android" >
<files-path name="ezetap-download" />
<external-path name="ezetap-download" />
</paths>
To integrate this API, you need to have a good grasp of Android app development. The Ezetap integration part involves setting up a project, importing a library and then actual coding with just a few lines of code.
- Android development environment
- Android phone that can connect to internet
- This documentation
- Ezetap app key or login credentials to Ezetap service
- Ezetap device to test card payments
There is a sample Android App inside the sample folder of the repository. You can use this project as a reference to integrate Ezetap SDK.
- Import the project as an Android Project in Android Studio.
- Clean & build the project.
- Run the
EzeNativeSampleActivity
on your Smartphone. EzeNativeSampleActivity.java
will be your point of reference for native Android SDK integration.
Note: The errors you may face while importing the project will most likely be for Android version mismatch which EclipseIDE would normally resolve itself. Changing the Android version or restarting the Eclipse can help u solve this problem
To integrate this API, you need to know how Cordova works & how to configure Cordova Plugin for Android. Ezetap provides a Cordova plugin which is embedded in the SDK which does all the hard work, all you need to do is to configure our plugin to your Android Cordova Project and write simple code snippet to invoke our Plugin.
- Android development environment
- Cordova development setup
- Android phone that can connect to internet
- This documentation
- Ezetap app key or login credentials to Ezetap service
- Ezetap device to test card payments
There is a sample Android App inside the sample
folder of this repository. You can use this project as a reference to integrate with the Ezetap SDK.
- Import the project as an Android Project in Android Studio.
- Clean & build the project.
- Run the
EzeCordovaSampleActivity
on your smartphone. Ezehelper.js
will be your point of reference for Cordova Android SDK integration.
- IMPORTANT: If your project's
targetSdkVersion
is higher or equal to 23(Android 6.0 Marshmallow) please add Android support library v4 to your Android project from here. The Android support libraries are not required if your project'stargetSdkVersion
is lesser than 23. - Good to go, please refer Ezetap API Portal for API usage.
Note: The EzeAPIActivity has to be configured with the same attributes as given above.
Note: The errors you may face while importing the project will most likely be for Android version mismatch which the EclipseIDE would normally resolve itself. Changing the Android version or restarting the Eclipse can help you fix this issue.
- You can find the documentation on how to create a Cordova plugin for Android here.
Note: Refer to the Ezetap Cordova Integration document for Android Nougat support changes, these are highlighted in the guide.