Home › Forums › Quform WordPress › Using Stripe and Paypal Integration in one Form
- This topic has 6 replies, 2 voices, and was last updated 4 years, 1 month ago by sven.
- AuthorPosts
- September 30, 2020 at 10:32 am #32008svenParticipant
Hey there,
I want to use the stripe and paypal intergration in one form. I added a option field so customers can choose between stripe and paypal payment. If stripe is selected the credit card form shows up through the defined logic rule and hides the other way. But when the paypal option is selected the credit card form still gets validated so that the form don’t fires up the confirmation method with the custom url linking to paypal.
How can I disable the validation for the credit card form, when the paypal option is selected.
Thanks for your help.
Best SvenOctober 1, 2020 at 9:18 am #32016AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 2, 2020 at 4:42 pm #32019svenParticipantHi Ally,
thanks for your reply. I tried your solution but the stripe card form still gets validated and stops the confirmation for the paypal payment.
The code looks like this:
add_filter('quform_post_validate_8', function (array $result, Quform_Form $form) { if($form->getValue('quform_8_133') == 'PayPal') { return $result; } require_once 'vendor/autoload.php'; if (!isset($_POST['stripeToken']) || ! Quform::isNonEmptyString($_POST['stripeToken'])) { $result = array( 'type' => 'error', 'error' => array( 'enabled' => true, 'title' => '', 'content' => 'Bitte trage Deine Kreditkarteninformationen ein.' ) ); // No JS response $form->setConfig(array( 'errorEnabled' => true, 'errorTitle' => '', 'errorContent' => 'Bitte aktiviere JavaScript und trage Deine Kreditkarteninformationen ein.' )); return $result; } \Stripe\Stripe::setApiKey('sk_test_xxxx'); try { \Stripe\Charge::create([ 'amount' => 14964, 'currency' => 'eur', 'description' => 'wertvoll. Marken-Toolkit', 'source' => $_POST['stripeToken'], 'metadata' => [ 'customer_email' => $form->getValueText('quform_8_124') ] ]); } catch (Exception $e) { $result = array( 'type' => 'error', 'error' => array( 'enabled' => true, 'title' => '', 'content' => $e->getMessage() ) ); } return $result; }, 10, 2);
Did I something wrong.
Thanks for your help. Best, Sven- This reply was modified 4 years, 1 month ago by sven.
October 5, 2020 at 10:31 am #32026AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 6, 2020 at 9:01 am #32033svenParticipantHi Ally,
I’ve sended you the link via mail. Did you get it?
Best, Sven
October 6, 2020 at 9:52 am #32035AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 6, 2020 at 10:21 am #32037svenParticipantThis solutions works.
Thanks for your great support. - AuthorPosts
- You must be logged in to reply to this topic.