如何重定向 Razorpay 中的成功或失败付款
How to Redirect Success or Failure Payment in Razorpay
我是集成支付网关的新手。
如何在 Razorpay 中成功或失败付款后重定向 URL。我想要 Js 代码。我认为处理函数可以使用该重定向。如何使用它们
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"
}
};
重定向用户的方法是改变 location.href
的值。删除 alert(response.razorpay_payment_id);
并根据是否定义了支付 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;
我的示例网址很幽默;用您的实际网址替换它们。此外,您还可以阅读有关 location.href and location redirection here.
的更多详细信息
我是集成支付网关的新手。
如何在 Razorpay 中成功或失败付款后重定向 URL。我想要 Js 代码。我认为处理函数可以使用该重定向。如何使用它们
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"
}
};
重定向用户的方法是改变 location.href
的值。删除 alert(response.razorpay_payment_id);
并根据是否定义了支付 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;
我的示例网址很幽默;用您的实际网址替换它们。此外,您还可以阅读有关 location.href and location redirection here.
的更多详细信息