无法将 razorpay 集成到 angular 4
unable to integrate razorpay in angular 4
我正在尝试集成 razorPay 支付网关。
payNow( ) {
var options = {
"key": "rzp_test_dveDexCQKoGszl",
"amount":((this.buyNow==1)?this.shared.totalAmountWithDisocuntBuyNow:this.shared.totalAmountWithDisocunt)*100, // 2000 paise = INR 20
"name": " MARKET",
"description": "Order #",
"handler": function (response){
console.log(response);
alert(response.razorpay_payment_id);
this.paid();
this.shared.addOrder(this.buyNow,response.razorpay_payment_id);
},
"prefill": {
"name": this.shared.orderDetails.billing_firstname + " " + this.shared.orderDetails.billing_lastname,
"email": this.shared.customerData.customers_email_address,
"contact": this.shared.customerData.customers_telephone,
},
"notes": {
"address": this.shared.orderDetails.billing_street_address+', '+this.shared.orderDetails.billing_city+', '+this.shared.orderDetails.billing_state+' '+this.shared.orderDetails.billing_postcode+', '+this.shared.orderDetails.billing_country
},
"theme": {
"color": "blue"
}
};
var rzp1 = new Razorpay(options);
rzp1.open();
// body...
}
paid()
{alert();}
我已经在处理程序中定义了回调函数。但问题是它成功记录了响应并提醒它但它没有调用
this.paid()
要么
this.shared.addOrder(this.buyNow,response.razorpay_payment_id);
没有任何控制台错误。它只是不调用任何上述的甲硫氨酸函数。
通过使用以下语法将处理函数绑定到函数来调用处理函数
"handler":this.shared.addOrder.bind(this,this.buyNow) ,
这有效。
我正在尝试集成 razorPay 支付网关。
payNow( ) {
var options = {
"key": "rzp_test_dveDexCQKoGszl",
"amount":((this.buyNow==1)?this.shared.totalAmountWithDisocuntBuyNow:this.shared.totalAmountWithDisocunt)*100, // 2000 paise = INR 20
"name": " MARKET",
"description": "Order #",
"handler": function (response){
console.log(response);
alert(response.razorpay_payment_id);
this.paid();
this.shared.addOrder(this.buyNow,response.razorpay_payment_id);
},
"prefill": {
"name": this.shared.orderDetails.billing_firstname + " " + this.shared.orderDetails.billing_lastname,
"email": this.shared.customerData.customers_email_address,
"contact": this.shared.customerData.customers_telephone,
},
"notes": {
"address": this.shared.orderDetails.billing_street_address+', '+this.shared.orderDetails.billing_city+', '+this.shared.orderDetails.billing_state+' '+this.shared.orderDetails.billing_postcode+', '+this.shared.orderDetails.billing_country
},
"theme": {
"color": "blue"
}
};
var rzp1 = new Razorpay(options);
rzp1.open();
// body...
}
paid()
{alert();}
我已经在处理程序中定义了回调函数。但问题是它成功记录了响应并提醒它但它没有调用
this.paid()
要么
this.shared.addOrder(this.buyNow,response.razorpay_payment_id);
没有任何控制台错误。它只是不调用任何上述的甲硫氨酸函数。
通过使用以下语法将处理函数绑定到函数来调用处理函数
"handler":this.shared.addOrder.bind(this,this.buyNow) ,
这有效。