我已将 razorpay 集成到我的结帐页面中。
我需要从我的订单中获取金额,我如何动态获取它。
以下是razorpay 配置。
public totalAmount:number;
rzp1: any;
options = {
key: "rzp_test_m8sE9eaFkPEUHRasfm",
amount: this.totalAmount, // Doesnt work here
name: "Test Pvt Ltd",
description: "Purchase Description",
image: "../../../assets/static/hmicon.png",
handler: function(response) {
this.paymentId=response.razorpay_payment_id;
this.orderanything(this.paymentId);
},
modal: {
ondismiss: function() {}
},
prefill: {
name: "Test",
email: "test123@gmail.com"
},
notes: {
address: "Hello World"
},
theme: {
color: "#F37254"
}
};
public initPay(): void {
this.rzp1 = new this.winRef.nativeWindow.Razorpay(this.options);
this.rzp1.open();
this.totalAmount=this.getTotal();
console.log(this.totalAmount) //here i get the total
}