ebs-cordova-plugin
v1.1.0
Published
A Cordova plugin for the EBS Express Checkout android SDK
Downloads
10
Maintainers
Readme
PhoneGap app integration
EBS has a native android client which can be used by PhoneGap applications.
Installation
This requires phonegap/cordova CLI 5.0+ (current stable v1.5.3).
phonegap plugin add ebs-cordova-plugin
or
cordova plugin add ebs-cordova-plugin
Define Parameters
The following parameters are define to your js file.
Algorithm
Algorithm should be following format.
MD5 or SHA512 or SHA1
Mode
Mode should be following format.
Test or Live
Parameters
var merchantId="<your_merchant_id>";
var secretKey="<your_secret_key>";
var algorithm="<your_algorithm>";
var mode="<your_mode_of_transaction>";
var txnAmt="1.00";
var refernceNo="<your_reference_no>";
var failureId="1";
var currency="INR";
var txnDescrip="Test Transaction";
var billingEmail="[email protected]";
var billingName="Test_Name";
var billingAddress="North Mada Street";
var billingCity="Chennai";
var billingPostalCode="600019";
var billingState="Tamilnadu";
var billingCountry="IND";
var billingPhone="01234567890";
var shippingEmail="[email protected]";
var shippingName="Test_Name";
var shippingAddress="North Mada Street";
var shippingCity="Chennai";
var shippingPostalCode="600019";
var shippingState="Tamilnadu";
var shippingCountry="IND";
var shippingPhone="01234567890";
var hidePaymentOpt="false";
var hideCreditCard="false";
var hideCashCard="false";
var hideDebitCard="false";
var hideNetBanking="false";
var hideStoredCard="false";
var customParam = {'account_details': 'saving','merchant_type': 'gold',};
##Define Success and Failure Response Callback:
When the user has completed the payment (could be success or failure), the user will get response.
var onPaymentSuccess = function (response) {
var json = JSON.parse(response);
var PaymentId = json["PaymentId"];
var AccountId = json["AccountId"];
var MerchantRefNo = json["MerchantRefNo"];
var Amount = json["Amount"];
var DateCreated = json["DateCreated"];
var Description = json["Description"];
var Mode = json["Mode"];
var IsFlagged = json["IsFlagged"];
var BillingName = json["BillingName"];
var BillingAddress = json["BillingAddress"];
var BillingCity = json["BillingCity"];
var BillingState = json["BillingState"];
var BillingPostalCode = json["BillingPostalCode"];
var BillingCountry = json["BillingCountry"];
var BillingPhone = json["BillingPhone"];
var BillingEmail = json["BillingEmail"];
var DeliveryName = json["DeliveryName"];
var DeliveryAddress = json["DeliveryAddress"];
var DeliveryCity = json["DeliveryCity"];
var DeliveryState = json["DeliveryState"];
var DeliveryPostalCode = json["DeliveryPostalCode"];
var DeliveryCountry = json["DeliveryCountry"];
var DeliveryPhone = json["DeliveryPhone"];
var PaymentStatus = json["PaymentStatus"];
var PaymentMode = json["PaymentMode"];
var SecureHash = json["SecureHash"];
if( PaymentStatus == "Authorized") {
gotoThankYouPage()
}
else {
gotoFailurePage()
}
};
Define back button callback
If the user presses back button, then the transaction is aborted midway by the user. Our plugin will let you know when this happens through a callback. You may define the function as:
var onTransactionAborted = function (aborted) {
gotoFailurePage()
};
Once all these variables are declared correctly, you are ready to put it together and setup the payment flow:
ExpressCheckout.startCheckoutActivity({
"onPaymentSuccess": onPaymentSuccess,
"onTransactionAborted": onTransactionAborted,
"parameters": {
"merchantId":merchantId,
"secretKey":secretKey,
"algorithm":algorithm,
"mode":mode,
"txnAmt":txnAmt,
"refernceNo":refernceNo,
"failureId":failureId,
"currency":currency,
"txnDescrip":txnDescrip,
"billingEmail":billingEmail,
"billingName":billingName,
"billingAddress":billingAddress,
"billingCity":billingCity,
"billingPostalCode":billingPostalCode,
"billingState":billingState,
"billingCountry":billingCountry,
"billingPhone":billingPhone,
"shippingEmail":shippingEmail,
"shippingName":shippingName,
"shippingAddress":shippingAddress,
"shippingCity":shippingCity,
"shippingPostalCode":shippingPostalCode,
"shippingState":shippingState,
"shippingCountry":shippingCountry,
"shippingPhone":shippingPhone,
"hidePaymentOpt":hidePaymentOpt,
"hideCreditCard":hideCreditCard,
"hideCashCard":hideCashCard,
"hideDebitCard":hideDebitCard,
"hideNetBanking":hideNetBanking,
"hideStoredCard":hideStoredCard,
"customParam":customParam,
}
});
Help & Support
If you notice any errors or issues with the integration, please reach out to us at [email protected]. You may also search our Knowledge base to see if the issue has already been addressed by our team.