mbo123
Forum Replies Created
-
Thank you @spencerfinnell it works like a charm. It’s a bit risky because any good developer can change the amount in the DOM and submit the payment. But I can check in stripe console the amount that have been paid and send the product only if the amount is correct.
Thank you for your update @spencerfinnell I am going to try this and keep you in touch
Hi @spencerfinnell,
Thank you for your answer and sorry for not opening a new topic for my issue. I didn’t want to open a new topic in order to avoid to overload topic list.
Like I said “The logs display the good amount” so the value I get from Ninja form is good I am 100% sure on this point. My issue is nearly exactly the same than the one of @wwwilson => with “manual data” it works fine, but it doesn’t work well when I use data that come from the database (Ninja Form).
I forgot to specify that I am using the Lite version of the plugin.I am using WP Simple Pay plugin to handle payment in my wordpress website. According to this post I can dynamically change amount with this kind of code
add_filter( 'simpay_form_4021_amount', 'simpay_custom_amount' ); function simpay_custom_amount() { return 4000; }
And it work fine like this. But I want to change the amount according to some data that is in my database that come from a Ninja Form. Here is my code that doesn’t work, the amount value is always 1.
add_filter( 'simpay_form_4021_amount', 'simpay_custom_amount' ); function simpay_custom_amount() { $price = 1; $submissions = Ninja_Forms()->form( 10 )->get_subs(); error_log("filter_simpay"); if ( is_array( $submissions ) && count( $submissions ) > 0 ) { foreach($submissions as $submission) { $sub_values = $submission->get_field_values(); if ($sub_values['_seq_num'] == 100) { $price = $sub_values['price']; error_log("-----------> price 1 is ".$price); } } } error_log("-----------> price 2 is ". ((int) $price)); return (int) $price; }
Can you help me fix this please? The logs display the good amount, but the amount in Stripe is always 1.