Skip to content

easebuzz/paywitheasebuzz-cordova-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova/Phonegap/Ionic plugin for PayWithEasebuzz Mobile SDK.

Supported platforms

Dependencies

Android
iOS

Usage:

1.Install the plugin
2.Commands
cd your-project-folder
$ cordova platform add ios
$ cordova platform add android
$ cordova plugin add /path/to/easebuzz-cordova-kit
$ cordova clean
$ cordova build

Note :For iOS

Note: This release is meant for Xcode 9.4 and above as it uses a framework compiled in Swift 4.1.This will not work in Xcode 9.2 as  you will get a "dlyd error : framework not found error".
Note: The existing plugin not work on simulator.The iOS framework is shipped with simulator architectures ,so you have to replace simulator Easebuzz.framework (from iOS Frameworks folder) with device Easebuzz.framework.
      Please find the below folder path for replacing framework.
 replace path: easebuzz-cordova-kit -> src -> ios -> Easebuzz.framework
 Note: Make sure at the time of uploading app to APPStore, use existing framework - iOS device framework

Note :For Android

Note: Make sure your android platforms build.gradle file and project.properties files are cofigured properly. Eg: If your defaultBuildToolsVersion is "28.0.3", defaultTargetSdkVersion is 28 and defaultCompileSdkVersion is 28 in build.gradle file then value of target in project.properties file should be android-28.


3. Add below meta tag

   <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
  1. Add jquery-1.11.1.min.js and import it before index.js.

Initiate Payment :

Generate access key using the Initiate Payment API at your backend. 
(It is mandatory to integrate the Initiate Payment API at Backend only)
Initiate Payment API Doc : https://docs.easebuzz.in/api/initiate-payment
Pass extra parameter 'isMobile' = 1 to the Initiate Payment API, If  you are
generating an access key for Mobile App Integrations.

Integration code :

proceedToPayment: function () {
        params = {
            "access_key": "Access key generated by the Initiate Payment API",
            "pay_mode": "production",
            }

                    // Please do not change the key names in the parameters.
        window.plugins.PayWithEasebuzz.EasebuzzPay(params, function(payment_response) {
                        var result = payment_response.result
                        var detail_response = payment_response.response
                        // Do your own code to handle the payment response based on result 
                        // and detail_response.
                        }, function(err) {
                            // Do your own code to handle error.
                        });
        }
For Typescript(Ionic) :
        public proceedToPayment() {
            let params = {
                "access_key": "Access key generated by the Initiate Payment API",
                "pay_mode": "production",
            }


        window['plugins'].PayWithEasebuzz.EasebuzzPay(params, function(payment_response) {
            var result = payment_response.result
            var detail_response = payment_response.response
            // Do your own code to handle the payment response based on result 
            // and detail_response.
        }, function(err) {
           // Do your own code to handle error.
        });
  }

Request parameters and Sample payment response/result :

Result : To decide payment transaction is successful or failed.

    var result = payment_response.result

Value of the result can be :
“payment_successfull” : result contains this value, if the payment transaction completed successfully.

“txn_session_timeout“ : result contains this value, if the payment transaction failed because of the
transaction time out.

“user_cancelled” : result contains this value, if the the user pressed the cancel button during the payment process.

“error_server_error” : result contains this value, if the server side error occured during payment process.

“bank_back_pressed” : result contains this value if user press the back button on bank page.

“invalid_input_data” : result contains this value if payment request input parameters are not valid.

“payment_failed” : result contains this value if payment fails from the bank side.

“error_noretry” : This result can be considered as failed payment.

“retry_fail_error” : This result can be considered as failed payment.

“trxn_not_allowed” : This result can be considered as failed payment.


To check request parameters click on below link.
https://docs.easebuzz.in/mobile-integration-android/handle-response


To check sample payment response on below link.
https://docs.easebuzz.in/mobile-integration-android/request-response-desc

About

paywitheasebuzz-cordova-lib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6