In this article, we want to show you how to redirect to a different page after a successful payment. This means you can have your own customized success page instead of you using the default Lema success page.
We recommend implementing the redirect on the widget event PAYMENT_COMPLETE.
Please use the following code block and adjust the target URl:
window.rnwWidget = window.rnwWidget || {};
window.rnwWidget.configureWidget = window.rnwWidget.configureWidget || [];
window.rnwWidget.configureWidget.push(
function
(options) {
options.widget.on(window.rnwWidget.constants.events.PAYMENT_COMPLETE,
function
(event) {
// console.log(event);
// console.log(event.payment);
// console.log(event.paymentStatus);
if
(event.paymentStatus ===
'success'
) {
// event.payment contains all parameters
of the transaction you also find in the RaiseNow Manager// Redirect to another page
window.location = 'http://raisenow.com'; // this would be your own thank you page
event.widget.element.hide();
}
});
});
Please note that if you want to show a download link e.g. for a pay-slip, you would have
to catch this information from event.payment and carry it over to your thank you page.
If you want to show your own customized thank you page only for specific payment methods, please see the code below. You can look up the payment method identifiers in the RaiseNow Manager.
window.rnwWidget = window.rnwWidget || {};
window.rnwWidget.configureWidget = window.rnwWidget.configureWidget || [];
window.rnwWidget.configureWidget.push(function(options) {
options.widget.on(window.rnwWidget.constants.events.PAYMENT_COMPLETE, function(event) {
// console.log(event);
// console.log(event.payment);
// console.log(event.paymentStatus);
if(event.paymentStatus === 'success') {
// event.payment contains all parameters of the transaction you also find in the RaiseNow Manager
// Redirect to another page
var payment_method=event.payment.payment_method;
if(isRedirected(payment_method)){
// Redirect to another page
window.location = 'http://raisenow.com'; // this would be your own thank you page
event.widget.element.hide();
}
}
});
});
function isRedirected(payment_method){
var not_redirected = ['EZS', 'DD', 'ES']
return !not_redirected.includes(payment_method);
}
If you have questions please send an email to support@raisenow.com.
Comments
0 comments
Please sign in to leave a comment.