File size: 798 Bytes
89a1081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function openJsCheckoutPopup(orderId, txnToken, amount)
{
var config = {
	"root": "",
	"flow": "DEFAULT",
	"data": {
		"orderId": orderId, 
		"token": txnToken, 
		"tokenType": "TXN_TOKEN",
		"amount": amount 
		},
		"merchant":{
		"redirect": true
	},
	"handler": {
	"notifyMerchant": function(eventName,data){
		console.log("notifyMerchant handler function called");
		console.log("eventName => ",eventName);
		console.log("data => ",data);
		}
	}
};
	if(window.Paytm && window.Paytm.CheckoutJS){
		// initialze configuration using init method 
		window.Paytm.CheckoutJS.init(config).then(function onSuccess() {
			// after successfully updating configuration, invoke checkoutjs
			window.Paytm.CheckoutJS.invoke();
		}).catch(function onError(error){
			console.log("error => ",error);
		});
}
}