Open iDroidindia opened 7 years ago
@iDroidindia for time being you can try my fork at https://github.com/uzumakinaruto123/CordovaPayTM by installing as cordova plugin add https://github.com/uzumakinaruto123/CordovaPayTM.git
and additional params. I have fixed success response and response format in it. check readme for response format.
Hi,
Thanks for the reply.
I am still facing issue. Is there any sample HTML with the JavaScript in which this plugin has been called & used. Stuck with it & not able to come out.
Any help would be highly appreciated.
Did you check the example in readme there , it uses PayTM
as namespace and not window.plugins.paytm
. Btw , looking at your error , problem seems to be different. Make sure you execute it inside deviceready event. I do use it , but in ionic project and not in vanilla cordova. But , I am sure it will work without any issue.
Hi,
<!DOCTYPE html>
Connecting to Device
Device is Ready
what is the error you get now ? may be create a repository for your project or zip it. It would be easy to check.
I tried on vanilla cordova project , and everything is working fine !
Now , the possible cause for not working in your project is that you are using inline script which is restricted by meta tag. replace http-equivalent meta tag with this <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />
or refer this index.html , you can directly replace this content ( considering you installed plugin correctly )
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<!--
Customize this policy to fit your own app's needs. For more guidance, see:
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
Some notes:
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
-->
<!--<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 *">-->
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div><br><br>
<button class="event listening button" id="myBtn">Make Payment</button> <br><br>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
// Call onDeviceReady when Cordova is loaded.
//
// At this point, the document has loaded but cordova-1.7.0.js has not.
// When Cordova is loaded and talking with the native device,
// it will call the event `deviceready`.
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
// Now safe to use the Cordova API
//pay();
console.log('device is ready');
document.getElementById("myBtn").addEventListener("click", pay);
}
function pay() {
console.log('paying');
PayTM.startPayment("0213232", "fgfdgf", "abc@gmail.com" ,"1234567890", "10", "staging", successCallback, failureCallback);
function successCallback(result) {
//staging (or) product
var response = JSON.parse(result);
var transactionBankTxnId = response.BANKTXNID;
var transactionOrderId = response.ORDERID;
var transactionTxnDate = response.TXNDATE;
var transactionTxnId = response.TXNID;
var transactionStatus = response.STATUS;
alert(JSON.stringify(response));
console.log("Payed Successfully");
}
function failureCallback(message) {
alert('Failed because: ' + message);
console.log('Failed because: ' + message);
}
}
</script>
</body>
</html>
Hi,
Great, started getting the Failure response.
Thanks for the help...
Hi,
Sorry for bother you, again. Is there any Correct credential for staging to get the Successful response. I have tried many credentials with which I have an account on PayTM, still no luck with Success response.
Thanks..
yes ! you need to host this kit on your own server https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_PHP .
And reinstall plugin with your url credentials (for generate and checksum url). you need to configure cofig file in the kit too.
Installation should look something like this (testing credentials ):-
cordova plugin add https://github.com/uzumakinaruto123/CordovaPayTM.git --variable GENERATE_URL=http://www.yoururl.com/kit/generateChecksum.php --variable VERIFY_URL=http://www.yoururl.com/kit/verifyChecksum.php --variable MERCHANT_ID=DIY12386817555501617 --variable INDUSTRY_TYPE_ID=Retail --variable WEBSITE=DIYtestingwap
Sandbox credential source : - http://paywithpaytm.com/developer/discussion/topic/sandbox-test-credentials-for-testing-paytm-solutions/
Ok,
Thanks, its done.....
I am trying to integrate in phonegap iOS app with demo credentials using this plugin : https://github.com/uzumakinaruto123/CordovaPayTM.git successfully installed but I am getting OOPS error when click pay button. Payu Admin Team Says add Callback_url in your Code.
Checksum generator Link : http://www.juneapps.com/paytmkit/generateChecksum.php
Verify Checksum link : http://www.juneapps.com/paytmkit/verifyChecksum.php
Can you please guide me to resolve this issuse
Hi,
I am facing issues in using this plugin. I tried creating a small Cordova App & used this plugin. However, not able to get the success response. Following is the my code:
index.html
<!DOCTYPE html>
Apache Cordova
Connecting to Device
Device is Ready
config.xml file
<?xml version='1.0' encoding='utf-8'?>