[英]How to Redirect Success or Failure Payment in Razorpay
I am New to Integrate Payment Gateway.我是集成支付网关的新手。
How to Redirect a URL after Success or Failure Payments in Razorpay.如何在 Razorpay 中成功或失败付款后重定向 URL。 I want Js Code.我想要 Js 代码。 I thing handler function can use that redirect.我的东西处理函数可以使用该重定向。 How to Use them如何使用它们
var options = {
"key": "rzp_test_aIfnpuWEudWnID",
"amount": "35000", // 2000 paise = INR 20
"name": "Vanakkam Chennai",
"description": "I Run.. Becasue .. I Care",
"image": "http://vanakkamchennai.com/images/about/chennai_2017.jpg",
"callback_url": 'https://www.google.com',
"handler": function (response){
alert(response.razorpay_payment_id);
},
"prefill": {
"name": "Harshil Mathur",
"email": "harshil@razorpay.com"
},
"notes": {
"address": "Hello World"
},
"theme": {
"color": "#F37254"
}
};
The way to redirect a user is to alter the value of location.href
.重定向用户的方法是更改location.href
的值。 Remove alert(response.razorpay_payment_id);
删除alert(response.razorpay_payment_id);
and redirect the user based on if the payment id is defined or not:并根据是否定义了付款 ID 来重定向用户:
// alert(response.razorpay_payment_id);
if (typeof response.razorpay_payment_id == 'undefined' || response.razorpay_payment_id < 1) {
redirect_url = '/you-owe-money.html';
} else {
redirect_url = '/thnx-you-paid.html';
}
location.href = redirect_url;
My example urls are humorous;我的示例网址很幽默; replace them with your actual urls.用您的实际网址替换它们。 Also, you can read more detailed information on location.href and location redirection here .此外,您可以在此处阅读有关location.href 和位置重定向的更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.