Also the success_query and error_query don’t really work.
example: when you do
wp_redirect( get_permalink( $d_stripe_general['direct_stripe_error_page'] ) . '/' . $error_query );
you are likely to get a result like
http://mywebsite.com/my_success_page/some_query=some_value (which is what I get)
so you’ll be missing the ‘?’ and it will break the link (404) -> http://mywebsite.com/my_success_page/?some_query=some_value
I think what should be done is break the $success_query into an array, and use add_query_arg() to insert the parameters. Like that you would make sure that it gets the wanted parameters, no matter the original url.
https://developer.wordpress.org/reference/functions/add_query_arg/
And finally it would be great to have an action to allow to do something when the payment is a success, just before the redirect :
// added action, allows developers to do things there
do_action( 'direct_stripe', $post_id ); //pass the recorded transation post_id
//Redirection after success
wp_redirect( get_permalink( $d_stripe_general['direct_stripe_success_page'] ) . '/' . $success_query );
This would be very usefull if we want to do something with $success_query for example.
Hello @marcusig,
Thank you for using direct stripe.
I started a version 2 of the plugin that will be made with actions ans filters but cannot promise when it will be released…
For the query vars it’s far from being the best solution but as you can see in the given example I include the ? and encode the & for a second var in the shortcode argument.
Don’t hesitate to create your own branch on github!
Best regards
I refreshed the example as i had forgotten the ?
Thank you
Thanks Nicolas,
Looking forward to seeing v2 rolling.
Until then I’ll fork it and make a few changes.
Hello @marcusig,
I have seen your fork on github, I will push the version 1.1.9 to WordPress.org soon, do you want me to include your actions and the encoded query vars in it?
Best regards
Hi Nicolas,
Feel Free to use it.
I didn’t add hooks everywhere, mostly where I needed for my own project.
For exemple the one I only added to the Payment file, not the Subscription and other options.
But could do that tomorrow maybe.
Don’t worry about that, I saw the editions. I’ll include it so you can keep updating from WordPress.org
Regards
Hi @marcusig,
Check out the code of 1.1.9 version of the plugin and tell me if that’s OK for you?
Regards
Hi Nicolas,
That’s perfect, it works well for me. Thanks for doing this!