I am creating a plugin where the user is submitting data to a controller.

With a successful saving of the data in the controller/service I want to honour the standardised redirect param:

<input type="hidden" name="redirect" value="success/{stripeId}"/>

The stripeId is a property of the PaymentModel $payment being passed to the redirectToPostedUrl param:


This works in that when the person is redirected the person is brought to page desired with url like this:


The problem is that craft cannot find the success template and the success page does not show since it is trying to find a template a success/ directory called ch_5GW2RFTNvW8qeR.html

2 Solutions I have found:

Option 1) My plugin users need to set up a route manually in the control panel to allow this to resolve correctly (and have full control over where the success page is and what the url looks like):

image of manual route setup

Option 2) The other option is that I use the Plugin hook registerSiteRoutes to register a front end route to that template. The obvious problem with that is I either need to make that hard coded, or user configurable (pain).

Since I would obviously need to make it user configurable, it kinda defeats the purpose of the user of the plugin being able to decide the name="redirect" value="success/{stripeId}" in the first place. I would imagine I would have to come up with my own redirection/routing config and logic. I understand this is not a problem in the control panel actions since I know what I want my urls to be, but as a plugin developer I want to give flexibility to users of my plugin to choose their front-end urls.

Any thoughts? I am leaning towards having to put into the documentation of my plugin that they need to do option 1 above, but still think its not optimal.

Edit: Just had another idea. Option 3) Since I will be giving my users demo templates for the front end forms on installation - should I possibly create a route in the craft_routes table for the user? That way on first install everything should work without needing to manually set up a bunch of routes manually to match my demo templates.

  • Couldn't you also just redirect to http://web.dev/success?id=ch_5GW2RFTNvW8qeR
    – Brad Bell
    Commented Dec 5, 2014 at 16:54
  • yes indeed Brad, will consider that the best option so far. Not as aesthetically pleasing but works!!! You the man, have a drink of water. Commented Jan 15, 2015 at 14:54

1 Answer 1


Maybe not the prettiest URL, but I think the simplest solution would be to redirect to something like:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.