Title: Extra data fields in script tag
Last modified: March 13, 2017

---

# Extra data fields in script tag

 *  Resolved [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/)
 * Hi there,
    Thanks for the plugin! I’m currently using it and would like to pre-
   fill the Email field in the checkout window. I know that I need to add `data-
   email="email@domain.com"` in the `<script>` tag. But there is no way to do this
   currently without editing the plugin directly (which is very bad 🙂 ) So I was
   wondering if it was possible to maybe add an action just before the end of the
   script tag? like `do_action('direct_stripe_before_end_script_tag');` or whatever
   to allow other developers to extend this a bit if needed.
 * Merci !

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8906965)
 * 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](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](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/](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.
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8907163)
 * Hello [@marcusig](https://wordpress.org/support/users/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
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8907202)
 * I refreshed the example as i had forgotten the ?
 * Thank you
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8907454)
 * Thanks Nicolas,
    Looking forward to seeing v2 rolling. Until then I’ll fork it
   and make a few changes.
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8918422)
 * Hello [@marcusig](https://wordpress.org/support/users/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
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8918495)
 * 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.
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8918568)
 * Don’t worry about that, I saw the editions. I’ll include it so you can keep updating
   from WordPress.org
 * Regards
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8932147)
 * Hi [@marcusig](https://wordpress.org/support/users/marcusig/),
 * Check out the code of 1.1.9 version of the plugin and tell me if that’s OK for
   you?
 * Regards
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8933342)
 * Hi Nicolas,
    That’s perfect, it works well for me. Thanks for doing this!
 *  Plugin Author [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * (@nahuelmahe)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8934136)
 * Awesome, thank you.
 * Best regards

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Extra data fields in script tag’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/direct-stripe_7787ff.svg)
 * [Direct Stripe](https://wordpress.org/plugins/direct-stripe/)
 * [Support Threads](https://wordpress.org/support/plugin/direct-stripe/)
 * [Active Topics](https://wordpress.org/support/plugin/direct-stripe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/direct-stripe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/direct-stripe/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Nicolas Figueira](https://wordpress.org/support/users/nahuelmahe/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/extra-data-fields-in-script-tag/#post-8934136)
 * Status: resolved