WordPress
				Gravity Forms QuickPay Integration
		With the Gravity Forms for QuickPay Integration plugin you can create forms that accepts payment for products and online services through QuickPay. Note that the look of the forms will be identical with your current forms and not as shown in the images. About Gravity Forms…

WordPress

Gravity Forms QuickPay Integration

With the Gravity Forms for QuickPay Integration plugin you can create forms that accepts payment for products and online services through QuickPay. Note that the look of the forms will be identical with your current forms and not as shown in the images. About Gravity Forms…

With the Gravity Forms for QuickPay Integration plugin you can create forms that accepts payment for products and online services through QuickPay.

Note that the look of the forms will be identical with your current forms and not as shown in the images.

About Gravity Forms QuickPay Integration Plugin

Gravity forms which is already a flexible plugin for handling different inputs can be extended to handle payments through QuickPay with this plugin. Create complex and variable forms to handle things like:

  • Signup Fee
  • Product sale
  • Tickets or courses
  • Collection of payment
  • Or something we haven’t thought about?

 

The Gravity Forms QuickPay plugin interacts smoothly with other language/translation plugins like WPML and Polylang.

This plugin also interacts directly with your current Gravity Forms layout and forms in your WordPress theme.

Installation / Setup

To get started you have to buy, install, and activate the plugin from your WordPress dashboard.

Sign in to your QuickPay.net account and setup your payment gateway (Custom Integration), make sure the following url are used as call-back url
“https://yourdomain.com/payment-callback/”.

Create a page with the slug/url “payment-success” and insert the following shortcode [gf_quickpay].

Create a page with the slug/url “payment-rejected” and write the message you wish to show the user if the payment doesn’t go through.

Both pages can be customized later to better match your payment forms.

Click Forms > Settings > QuickPay in WordPress dashboard to link your QuickPay account to Gravity Forms. The data for this action can be found on your QuickPay account. Contact QuickPay if you have problems finding these data.

Create a form in the WordPress dashboard that we can use for payment. If you already have a form for the purpose let us use that one. Edit your form and hover with your mouse on settings and select QuickPay.

Under the QuickPay feed settings you have to activate QuickPay and then write the slugs/urls of the two pages we just created.
In the field “Payment completed page” insert the slug/url “payment-success” (without “).
In the field “Payment canceled page” insert the slug/url “payment-rejected” (without “).
Save the settings and go back to where you edit the form.

Under the Price field you can now add the product field which can be customized to your wishes. Remember the value must be lager than 1 to get to QuickPay. Save the form and you’re now ready to receive payments directly on the website.

The last step requires us to make sure the callback URL have been registered by WordPress. You do this by going to “Settings > Permalinks” and press the “Save Changes” button. This should make WordPress flush existing rewrite/URL rules that it contains and generate them again.

Requirements

  • To use the Gravity Forms QuickPay Integration plugin you must have Gravity Forms Version 1.9 or higher installed and activated.
  • WordPress Version 3.8 or higer (required by Gravity Forms 1.9).
  • A QuickPay account (If you already have you can use that or you can create a new QuickPay account).

Support

Support for purchased plugins is handle through email to support@rommel.dk.

Auto-capture payments

Add this snippet to your functions.php file in the theme you are using on create a plugin and add this to the plugin.

/**
 * Adds the auto-capture feature to the Gravity Forms with quick-pay payments.
 **/
add_filter( 'gf_qp_pre_submit_formdata', function ( $qpformdata, $confirmation, $form, $entry, $is_ajax ) {
	$qpformdata['autocapture'] = 1;

	return $qpformdata;
}, 10, 5 );

/**
 * Adds the auto-capture feature to a specific form in Gravity Forms with quick-pay payments.
 **/
add_filter( 'gf_qp_pre_submit_formdata', function ( $qpformdata, $confirmation, $form, $entry, $is_ajax ) {
	// Only run on the form that has id 5.
	if ( $form['id'] === 5 ) {
		$qpformdata['autocapture'] = 1;
	}

	return $qpformdata;
}, 10, 5 );

Google Tag Manager Data-layer (Purchases)

/**
 * Adds custom datalayer for Google Tag Manager when the reciept is printed.
 * This adds the datalayer to the footer by passing the variables from one action to the other via use.
 */
add_action( 'gf_quickpay_reciept_data', function ( $output, $entry, $products, $_order_id ) {

	// WordPress footer hook.
	add_action( 'wp_footer', function () use ( $output, $entry, $products, $_order_id ) {
		if ( isset( $products['products'] ) && is_array( $products['products'] ) ) {
			$productsObjects = '';
			foreach ( $products['products'] as $key => $product ) {

				// Product options.
				if ( ! empty( $product['options'] ) ) {
					foreach ( $product['options'] as $option ) {

						$replace = [ "'", ' ', ':', '-' ];
						$replace_width = [ '', '_', '', '' ];

						$product_name = ! empty( $option['field_label'] ) ? $option['field_label'] : '';
						$product_sku = ! empty( $option['option_label'] ) ? str_replace( $replace, $replace_width, strtolower($option['option_label']) ) : '';
						$product_category = ! empty( $option['option_name'] ) ? str_replace( $replace, $replace_width, $option['option_name'] ) : 'Fag';
						$product_price = ! empty( $option['price'] ) ? $option['price'] : 0;

						$productsObjects .= "{
						'sku': '" . $product_sku . "',
						'name': '" . $product_name . "',
						'category': '" . $product_category . "',
						'price': " . $product_price . ",
						'quantity': '1'
					},";
					}
				}
			}

			$transactionTotal = $entry['payment_amount'];
			$transactionTax   = ! empty( $transactionTotal ) ? $transactionTotal * 0.2 : 0;
			?>
			
				window.dataLayer = window.dataLayer || [];
				dataLayer.push({
					'transactionId': '',
					'transactionAffiliation': '',
					'transactionTotal': ,
					'transactionTax': ,
					
					'transactionShipping': ,
					
					'transactionProducts': []
				});
			
			<?php
		}
	}, PHP_INT_MAX, 0 );

	return $output;
}, 10, 4 );

3.1.2:
– Ensured compatibility for Gravity Forms version 2.5.0 and above.

3.1.1:
– Fixed potential issue where default confirmation was set to be a redirect but we tried to append a string to an array.

3.1.0:
– Updated settings form descriptions and labels to give a better user experience when finding the right values in QuickPay.
– Added update system to easier get latest updates.

3.0.1:
– “gravityforms_qpform_send_to_quickpay” disables notification logic as well, so the plugin no longer blocks notifications if it is not being used.

3.0.0:
– Added functions to randomize and extract the form entry id to ensure live and test entries don’t hit the same numbers.

2.0.3:
– Added filter ‘gravityforms_qpform_send_to_quickpay’ to make it possible to disable the QuickPay redirect and apply custom logic.

2.0.2:
– Added filter ‘gf_quickpay_reciept_data’ for adding custom events when reciept is show or filter the reciept output.

2.0.1:
– Added filter ‘gf_qp_pre_submit_formdata’ to filter form data before it’s send to quick-pay. Also did a little cleaning in the plugin and added additional inline documentation.

Contact

  • This field is for validation purposes and should be left unchanged.