问题描述
我已根据ionic 3的 Razorpay 文档给出的步骤实施了 Razorpay ,并将演示代码写入测试模式,但我混淆了何时进入 Live 模式,然后我想更改自己的代码,否则此代码将起作用。贝娄是我的演示代码,请在此处输入代码:
<ion-col width-50 style="padding: 0px;position: sticky;background-color: #488aff;font-size: 1.5rem;">
<ion-label fixed color="white" text-center style="width: 170px;" (click)="pay()">Make Payment</ion-label>
</ion-col>
pay()
{
var options = {
description: 'Credits towards consultation',image: 'https://i.imgur.com/3g7nmJC.png',currency: 'INR',key: 'rzp_test_VJC2EhL3qcduHV',//'rzp_test_1DP5mmOlF5G5ag',amount: '5000',//this.amount * 100,name: 'Name',// order_id:val,handler: function (response){
alert(response.razorpay_payment_id);
alert(response.razorpay_order_id);
alert(response.razorpay_signature)
},prefill: {
email: 'abc@gmail.com',contact: this.MobileNo,name: this.LoginUserName
},theme: {
color: '#F37254'
},modal: {
ondismiss: function() {
alert('dismissed')
}
}
};
var successCallback = (payment_id) => {
alert('payment_id: '+JSON.stringify(payment_id));
//Navigate to another page using the nav controller
//this.navCtrl.setRoot(Successpage)
//Inject the necessary controller to the constructor
// this.confirm_appointment();
callApi(payment_id,options.amount,options.prefill.contact);
};
var cancelCallback = (error) => {
alert(error.description + ' (Error ' + error.code + ')');
//Navigate to another page using the nav controller
//this.navCtrl.setRoot(ErrorPage)
};
// RazorpayCheckout.open(options,successCallback,cancelCallback);
RazorpayCheckout.on('payment.success',successCallback);
RazorpayCheckout.on('payment.cancel',cancelCallback);
RazorpayCheckout.open(options,cancelCallback);
var callApi = (payment_id,amount,contact) => {
let data = {
'Payment_Id' : payment_id,'Razorpay_Order':'','Amount' : amount,'Contact':contact,'CreateAt':'','Status':'Authorized'
};
alert('data = '+JSON.stringify(data));
this.apiServices.Paymentinsert(data)
.map(res => res.json())
//.do(data => { console.log(data); })
.subscribe(data =>{
alert(JSON.stringify(data));
},(err)=>{
alert("Failed = "+err);
});
// api to capture the payment
/* this.webService.callPost('paymentCapture',data).then((response) => {
console.log("Response is",response);
}).catch((error) => {
console.log(error);
})*/
}
}
请帮助我...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)