Nexstream eGHL Cordova Plugin
Cordova Library for integrating with the eGHL payment gateway's mobile SDK.
Installation
cordova plugin add cordova-plugin-eghl
Usage
Info
To get the version of this plugin at runtime, the following fields are available:
eGHL.version
eGHL.name
### Request payment
Note: makePayment()
and mpeRequest()
only
allow one ongoing request at any time. Any subsequent calls made while the
previous request is still ongoing will receive an error.
To request payment via any channel, including Masterpass Express:
eGHL.makePayment(
{
CurrencyCode : "MYR" | ...
PaymentMethod : "ANY" | "AUTH"
TransactionType : "SALE"
PaymentGateway: "https://..."
ServiceId : "abc"
Password: "password"
PaymentId : "P0000001"
OrderNumber : "P0000001"
PaymentDesc : "eGHL Payment testing"
MerchantReturnUrl : "https://*"
Amount : "123.10"
CustIP : "",
CustName : "Beta Tester"
CustEmail : "Tester@mail.com"
CustPhone : "60123456789"
B4TaxAmt : "",
TaxAmt : "",
MerchantName : "ABC Sdn Bhd"
CustMAC : "",
MerchantApprovalURL : "https://*"
MerchantUnApprovalURL : "https://*"
MerchantCallbackUrl : "https://*"
LanguageCode : "MY" | "EN" | "CN" ...
PageTimeout : "780"
CardHolder : "",
CardNo : "",
CardExp : "",
CardCvv2 : "",
IssuingBank : "",
BillAddr : "",
BillPostal : "",
BillCity : "",
BillRegion : "",
BillCountry : "",
ShipAddr : "",
ShipPostal : "",
ShipCity : "",
ShipRegion : "",
ShipCountry : "",
SessionId : "",
TokenType : "",
Token : "",
Param6 : "",
Param7 : "",
EPPMonth : "",
PromoCode : "",
ReqToken : "",
PairingToken : "",
ReqVerifier : "",
PairingVerifier : "",
CheckoutResourceURL : "",
CardId : "",
PreCheckoutId : "",
PaymentTimeout : -1
sdkTimeout: 60
_finaliseMessage: "Optional message for Finalising Payment (iOS Only)"
_cancelMessage: "Optional message for Cancelling Payment (iOS Only)"
},
function (resp) {
},
function (err) {
}
);
Masterpass Express info
Note: makePayment()
and mpeRequest()
only
allow one ongoing request at any time. Any subsequent calls made while the
previous request is still ongoing will receive an error.
eGHL.mpeRequest(
{
"PaymentGateway": "https://..."
"ServiceID": "abc",
"Password": "password"
"CurrencyCode": "MYR",
"Amount": "123.10",
"TokenType": "MPE / MSC",
"Token": "User identifier, for TokenType==MPE only",
"PaymentDesc": "Payment description...",
},
function (resp) {
},
function (errMsg) {
}
);
Special Android notes
Android may kill your Cordova activity while your user is in the eGHL activity.
When this happens, payment results will NOT be sent to the JavaScript callback
which you passed to the other methods (above). Instead, it will be sent to your
app with the "resume" Cordova event.
document.addEventListener("resume", function (event) {
/* Event:
{
action: "resume",
pendingResult: {
pluginServiceName: "eGHL",
pluginStatus: "OK", // or "Error", etc.
result: ... // same result that would have been passed to
// your normal callback function.
}
}
*/
}, false)
See also:
Message Customisation
iOS:
On iOS, you can only customise the "Finalising Payment" message. Set your own
message by setting the _finaliseMessage
property in the first parameter of
your .makePayment()
call. If you do not set this, the default message set by
eGHL's SDK will be used.
Android:
To customise the messages displayed by the eGHL SDK, set any of these values in
your strings.xml
:
<string name="eghl_progress_message">this is from app strings xml progress </string>
<string name="eghl_verification_message">this is from app strings xml verification</string>
<string name="eghl_cancel_dialog_title">this is from app strings exit title</string>
<string name="eghl_cancel_dialog_message">this is from app strings message</string>
<string name="eghl_prevent_back_toast_message">this is from app strings toast</string>
<string name="eghl_ssl_error_dialog_title">this is from app strings title ssl </string>
<string name="eghl_ssl_error_dialog_message">this is from app strings message ssl </string>