Paytm与离子框架集成

时间:2017-07-03 09:53:26

标签: cordova ionic-framework cordova-plugins

我正在使用此插件进行与离子(https://github.com/samyam-a/PayTM-PhoneGap-Plugin

的paytm集成
cordova plugin add https://github.com/samyam-a/PayTM-PhoneGap-Plugin.git --variable GENERATE_URL=<Checksum Generation URL> --variable VERIFY_URL=<Checksum Validation Url> --variable MERCHANT_ID=<MerchantID> --variable INDUSTRY_TYPE_ID=<IndustryType> --variable WEBSITE=<WAPWebsiteName>

//I am using this function to start transaction inside controller

window.plugins.paytm.startPayment(txn_id, customer_id, email, phone, amount, successCallback, failureCallback);

//Also i have defined successCallback and failureCallback

function successCallback(response)
{
    alert("response=="+JSON.stringify(response))
}  

function failureCallback(error)
{
    alert(error)  
}

由于没有得到任何回复而且无法知道此插件是否正常工作

1 个答案:

答案 0 :(得分:2)

传递回调的方式不正确,回调是作为函数参数传递的函数。所以问题的解决方案是 -

window.plugins.paytm.startPayment(txn_id, customer_id, email, phone, amount, 
function(response) {
    //success callback
}, function(error) {
    //failure callback
});