How to redirect users to a URL using the success callback?

Modified on: Tue, 2 Mar, 2021 at 7:47 AM

Summary


The Checkout Page V3 is a modal popup that can be embedded on your webpage so customers can sign up for your service without leaving your website.


After a successful checkout, the Chargebee checkout popup can be closed by the customers and continue on your website. 


Solution


If you’d like to redirect your customers to a different page after a successful checkout, here’s what you can do:


  1. Success Callback - You can listen to the success callback from the Chargebee js which is called after a sign-up is complete and redirect the customer to a different webpage.


cbInstance.setCheckoutCallbacks(function(cart) {

  // you can define custom callbacks based on cart object

  return {

    loaded: function() {

      console.log("checkout opened");

    },

    close: function() {

      console.log("checkout closed");

    },

    success: function(hostedPageId) {


    },

    step: function(value) {

      // value -> which step in checkout

      console.log(value);

    }

  }

});



Here’s more on the Chargebee JS callback functions.


  1. Redirect URL - You can configure the redirect URL in the plan details page and Chargebee will redirect the customers to this URL after a successful checkout.


Note: For one-time payments checkout redirect URL configuration, refer to this link



Related articles and documentation:

Checkout pages V3

Redirect URL


M
Monica is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.