Name of the Action or Filter hook followed by the arguments available for that hook.

Actions :

  • ‘direct_stripe_before_button’ => Triggered before each button
    1 $button_id
  • ‘direct_stripe_after_button’ => Triggered after each button
    1 $button_id
  • ‘direct_stripe_after_form’ => triggered after each button
  • direct_stripe_before_success_redirection‘ => Triggered after a successful transaction
    1.$chargeID, 2.$post_id, 3.$button_id, 4.$user_id
  • ‘direct_stripe_before_error_redirection’ => Triggered after a transaction fails
    1.$chargeID, 2.$post_id, 3.$button_id, 4.$user_id

Filters :

  • ‘ds_filter_params’, => Filter the params/settings sent to Stripe modal form ( Example Gist )
     1.$params
  • ‘direct_stripe_div_before’,  => Edit parent element of the button
     1.$str_before, 2.$button_id, 3.$ds_class => ID set in the button settings page
  • ‘direct_stripe_donation_input’ => Edit donation input markup
    1.$html => <input type="number" name="donationvalue" id="donationvalue" />, 2 $instance => generated on page load, $button_id => ID set in the button settings page
    
  • ‘direct_stripe_button_class’ => Edit button classes
    1.$classes, 2. $button_id => ID set in the button settings page, 3. $instance => generated on page load
  • ‘direct_stripe_button’  => Edit Button markup ( Example Gist )
        1.$button, 2.$instance => generated on page load, 3.$button_id => ID set in the button settings page, 4.$ds_button_class
  • ‘direct_stripe_div_after’  => Edit closing tag of parent element
        1.$button_id
    
    
    
  • ‘direct_stripe_validation_bubble’
    1. $bubble, 2. $button_id, 3. $instance
  • ‘direct_stripe_processing_transaction_spinner’ => Edit Ajax spinner ( Example Gist )
    1.$all the html, 2.$begin, 3.$end, 4.$text, 5.$dots, 6.$instance
  • ‘direct_stripe_charge_data’
    1.$chargerdata, 2.$user, 3.$token, 4.$amount, 5.$currency, 6.$capture, 7.$description
  • ‘direct_stripe_subscription_data’
    1.$subscriptiondata, 2.$user, 3.$token, 4.$button_id, 5.$plan_id, 6.$coupon, 7.$description
  • ‘direct_stripe_setup_fee_data’
    1.$setupfeedata, 2.$user, 3.$token, 4.$setup_fee, 5.$currency, 6.$description
  • ‘direct_stripe_success_user_email_subject’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_success_admin_email_subject’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_error_user_email_subject’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_error_admin_email_subject’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_success_user_email_content’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_success_admin_email_content’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_error_user_email_content’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_error_admin_email_content’
    1.$token, 2.$amount, 3.$currency, 4.$email_address, 5.$description, 6.$user_id, 7.$button_id
  • ‘direct_stripe_donation_amount’
    1.$amount
  • ‘direct_stripe_should_load_gutenberg_block’ => Allows to disable Direct Stripe Gutenberg Block (Fixes issue with Cornerstone page builder) Example Gist
    1.$return

26 thoughts on “Direct Stripe Actions and Filters hooks

  1. Hi Nico,

    A job well-done man. Really great plugin.
    But there is an issue with decimal amounts when someone puts a decimal figure like “90.87” it rounds it into “90” on the time of “Confirm Payment”.
    Is there something I’m doing wrong with configuration or it’s known bug?

    Thanks & Regards,
    Hammad

    1. Hello Hammad,

      Thank you for your kind words.

      This issue has been reported a week ago, I’m sorry about that. The display value on the modal form button don’t take cents into account, but the value passed to stripe is correct.
      It is fixed on the develop branch of the repo at https://github.com/New0/direct-stripe/tree/develop in case you want to install that version.

      I’ll try my best to push the update to .org library this week.

      Best regards,
      Nicolas

    1. Hello Pete,

      Direct Stripe buttons can be inserted in a page or post from the editor using a Gutenberg block ( or the Direct Stripe button inserter in old editor ).
      In the case you want to add a button from a widgets area or a template file, you can also insert direct stripe buttons using a shortcode [direct-stripe value="ds-154185704588"] ( ds-1541857045880 being the unique ID of the button created at Direct Stripe settings under the Buttons Settings tab ).

      I hoe this will help !

      1. Hi Nico, thanks for the quick reply, that worked great! Now I am not able to add a 6th button – is there a limit?

        thanks
        Pete

        1. Hello Pete, are you talking about total number of buttons or number of buttons in the same page ?

          Total number of buttons is not limited, but as far as per page buttons are concerned :

          – Only one donation button is supported per page
          – For other button types, I’ve never tested more than six buttons in a page, that worked for me

          Could you describe what happens when you can’t add a button ?

          1. Hi Nico, I was not able to add another button here: https://prnt.sc/mt4ei0
            When I add the 6th button and click “Create button” it says “Saved” but no new button is created.

            I’ve added 3 buttons to the same WP page ok.

            thanks

          2. I wonder if it could be a UI issue, the select field holds six button and then you need to scroll down to see others (see picture).
            Could you let me know what browser are you using and the size of your screen ?
            Select direct stripe button field

  2. Thanks Nico for your plugin!
    I cannot find a way to properly enable decimals, though.
    In Settings > Options for donations > Zero-decimal currencies, no matter how I trigger the switch, and no matter if I use a dot [.] or a comma [,] in the amount input field, decimals do not appear to work.
    Perhaps there is some other setting in WordPress to be enabled, please?

    1. Thank you for using Direct Stripe Kirpi.

      Decimals are enabled by default on the donation button, it works with both . and ,

      The Zero decimals currencies option concerns currencies like JPY which don’t have cents, so this option should remain disabled if you want to use donations with decimals.

      Could you test again ?

      Best wishes,

      Nicolas

    1. Hello Jerilynn,

      Thank for using Direct Stripe.

      The Direct Stripe button allows WordPress users to easily and quickly receive payments or subscriptions, it is not full e-commerce featured. It was developed with the idea that all other processes are to be managed/customized/developed separately depending on the needs.

      Depending what you’re selling I highly recommend full e-commerce solutions like :

      Best wishes

  3. Hello Nicolas,

    First of all you did a great job with this plugins, thank you very much !!

    I’m trying to enable the simple sending of the receipt through Stripe, using your method here : https://newo.me/add-receipt_email-to-charge-via-action-hook-in-direct-stripe/

    I’ve looked for the method direct_stripe_before_success_redirection and found it in /process/ds_process_functions.php but i’m not sure it’s where your code is supposed to go.

    Should I just create a new php file and put your code ? i’m a bit lost in php and wordpress plugins way of working.

    Thanks for your insight.

    Regards,
    Kevin

    1. Thank you for using Direct Stripe.

      The example code from https://newo.me/add-receipt_email-to-charge-via-action-hook-in-direct-stripe/ can be used in the functions.php file of your (child-)theme or as a custom plugin.

      I recommend a custom plugin and made an example code to be used as a plugin at https://gist.github.com/New0/3c80baa0e0ebed7db40667e4bdcbea2e

      You will need to :
      – Download the Gist as a zip file using the Download ZIP button (top right area of the code)
      – Unzip te file and edit the button ID line 14
      – Re-zip the file
      – Install it as a plugin from your WordPress admin ( Plugins -> Add new and Upload plugin button )
      – Activate the plugin

      That should do it!

      Let me know how it went.

      Best wishes

  4. I am using Easy Digital Downloads to sell ebooks.

    How do I direct the buyer to the ebook download page after payment? The plugin Stripe Payments has an input box for the downloadable url but yours does not.

    Thank you.

    1. Hello Julian,

      Sorry for the late reply and thank you for using Direct Stripe.

      Direct Stripe is totally independent from EDD but you could set a redirection to your downloads page after a successful payment. The shortcode takes the success_url argument to set use a redirection after a successfull transaction. ( I will soon update Direct Stripe in order to have a proper settings page to add and manage buttons, that will make it much easier to set ).

      Best regards,

  5. Hello great plugin, I am trying to add a TEXT FIELD mobile, so i can push a SMS TEXT MESSAGE on complete, is this possible? or any ideas how i can do this

    Many thnaks Chris

Leave a Reply

Your email address will not be published. Required fields are marked *