redirectToPostedUrl with object (Model) passed to it and keep template resolving 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:

&lt;input type="hidden" name="redirect" value="success/{stripeId}"/&gt;

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

$this-&gt;redirectToPostedUrl($payment);

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

http://web.dev/success/ch_5GW2RFTNvW8qeR

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):



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.
Maybe not the prettiest URL, but I think the simplest solution would be to redirect to something like:

http://web.dev/success?id=ch_5GW2RFTNvW8qeR