• Resolved jwagstaff

    (@jwagstaff)


    I am calculating a custom price for each purchase and need to be able to pass that price into the payment popup. Right now it is set to “Donation” mode and the price field is empty. I can’t set the price directly in the popup as it is in an iframe, however the calcuations are all done client-side, so I so should be able to set it on the global Stripe object. Can you tell me the best way to do this? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi,

    I am calculating a custom price for each purchase and need to be able to pass that price into the payment popup.

    Can you provide an example of what you are trying to achieve. I want to make sure I understand your question correctly.

    Thank you.

    Thread Starter jwagstaff

    (@jwagstaff)

    Thanks for responding – I’ve figured out a solution. Just for anyone else who is trying to pass in specific prices, you can create a copy of the plugins/stripe-payments/public/assets/js/stripe-handler-ng.js and put it in your theme file and load it after the one loaded by the plugin, like this:

    wp_enqueue_script(‘stripe-handler-js’, get_stylesheet_directory_uri() . ‘/js/stripe-handler-ng.js’ . $nocache, array(‘stripe-handler-ng’));

    This will override the plugin file and means you can modify the way the popup is initialised without breaking the plugin. Inside that file is a variable called pass_amount that passes the amount to be charged into the popup – you can use that to set custom amounts.

    Hope that helps someone.

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I am glad to know that you found a solution to your issue. Also thank you for sharing your solution for others to use ??

    Kind regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom price’ is closed to new replies.