We hope to have a PayPal addon available in the future, for now you can redirect the user to make a PayPal payment after submitting the form using some custom code.
Step 1
Go to Edit Form → Settings → Confirmations, and go to the settings for the Default confirmation, then set the Type to Redirect to custom URL, and enter the URL:
https://www.paypal.com/cgi-bin/webscr
Step 2
Add the following code to the WP theme functions.php file (or create a plugin for it).
12 3 4 5 6 7 8910 11 12131415161718192021 22 23242526 27 2829 30 31 32 | add_filter('quform_confirmation_redirect_url_1_1', function ($url, Quform_Confirmation $confirmation, Quform_Form $form) { $url = add_query_arg(array( 'cmd' => '_cart', 'upload' => '1', 'charset' => 'utf-8', // Set business info 'currency_code' => 'USD', 'business' => 'sales@example.com', // Set customer info 'first_name' => $form->getValue('quform_1_3')[2], 'last_name' => $form->getValue('quform_1_3')[4], 'email' => $form->getValue('quform_1_4'), 'address1' => $form->getValue('quform_1_5'), 'address2' => $form->getValue('quform_1_6'), 'city' => $form->getValue('quform_1_7'), 'state' => $form->getValue('quform_1_8'), 'zip' => $form->getValue('quform_1_9'), 'country' => $form->getValue('quform_1_10'), // Add a product 'item_name_1' => 'My Product', 'amount_1' => '50.00', 'quantity_1' => '1', // Shipping 'shipping_1' => '3.99' ), 'https://www.paypal.com/cgi-bin/webscr'); return $url; }, 10, 3); |
add_filter('quform_confirmation_redirect_url_1_1', function ($url, Quform_Confirmation $confirmation, Quform_Form $form) { $url = add_query_arg(array( 'cmd' => '_cart', 'upload' => '1', 'charset' => 'utf-8', // Set business info 'currency_code' => 'USD', 'business' => 'sales@example.com', // Set customer info 'first_name' => $form->getValue('quform_1_3')[2], 'last_name' => $form->getValue('quform_1_3')[4], 'email' => $form->getValue('quform_1_4'), 'address1' => $form->getValue('quform_1_5'), 'address2' => $form->getValue('quform_1_6'), 'city' => $form->getValue('quform_1_7'), 'state' => $form->getValue('quform_1_8'), 'zip' => $form->getValue('quform_1_9'), 'country' => $form->getValue('quform_1_10'), // Add a product 'item_name_1' => 'My Product', 'amount_1' => '50.00', 'quantity_1' => '1', // Shipping 'shipping_1' => '3.99' ), 'https://www.paypal.com/cgi-bin/webscr'); return $url; }, 10, 3);
- On line 1, replace
1_1
with the confirmation unique ID - On line 8, replace
USD
with the PayPal currency code (if not United States dollar) - On line 9, replace
sales@example.com
with the PayPal email address to receive the payment - On lines 12-20, replace
1_3
,1_4
,1_5
etc with relevant the element unique IDs of the fields in your form - On lines 23-25, set the product name, amount and quantity
- On line 28, replace
3.99
with the shipping amount
1 2 3 4 5 6 7 8 91011 12 13141516171819202122 23 24252627 28 2930 31 32 33 34 | function my_quform_paypal_integration($url, Quform_Confirmation $confirmation, Quform_Form $form) { $url = add_query_arg(array( 'cmd' => '_cart', 'upload' => '1', 'charset' => 'utf-8', // Set business info 'currency_code' => 'USD', 'business' => 'sales@example.com', // Set customer info 'first_name' => $form->getValue('quform_1_3')[2], 'last_name' => $form->getValue('quform_1_3')[4], 'email' => $form->getValue('quform_1_4'), 'address1' => $form->getValue('quform_1_5'), 'address2' => $form->getValue('quform_1_6'), 'city' => $form->getValue('quform_1_7'), 'state' => $form->getValue('quform_1_8'), 'zip' => $form->getValue('quform_1_9'), 'country' => $form->getValue('quform_1_10'), // Add a product 'item_name_1' => 'My Product', 'amount_1' => '50.00', 'quantity_1' => '1', // Shipping 'shipping_1' => '3.99' ), 'https://www.paypal.com/cgi-bin/webscr'); return $url; } add_filter('quform_confirmation_redirect_url_1_1', 'my_quform_paypal_integration', 10, 3); |
function my_quform_paypal_integration($url, Quform_Confirmation $confirmation, Quform_Form $form) { $url = add_query_arg(array( 'cmd' => '_cart', 'upload' => '1', 'charset' => 'utf-8', // Set business info 'currency_code' => 'USD', 'business' => 'sales@example.com', // Set customer info 'first_name' => $form->getValue('quform_1_3')[2], 'last_name' => $form->getValue('quform_1_3')[4], 'email' => $form->getValue('quform_1_4'), 'address1' => $form->getValue('quform_1_5'), 'address2' => $form->getValue('quform_1_6'), 'city' => $form->getValue('quform_1_7'), 'state' => $form->getValue('quform_1_8'), 'zip' => $form->getValue('quform_1_9'), 'country' => $form->getValue('quform_1_10'), // Add a product 'item_name_1' => 'My Product', 'amount_1' => '50.00', 'quantity_1' => '1', // Shipping 'shipping_1' => '3.99' ), 'https://www.paypal.com/cgi-bin/webscr'); return $url; } add_filter('quform_confirmation_redirect_url_1_1', 'my_quform_paypal_integration', 10, 3);
- On line 9, replace
USD
with the PayPal currency code (if not United States dollar) - On line 10, replace
sales@example.com
with the PayPal email address to receive the payment - On lines 13-21, replace
1_3
,1_4
,1_5
etc with relevant the element unique IDs of the fields in your form - On lines 24-26, set the product name, amount and quantity
- On line 29, replace
3.99
with the shipping amount - On line 34, replace
1_1
with the confirmation unique ID