TutorialiDEAL payments with Gravity Forms Stripe Add-On

Gravity Forms supports creditcard payments via their Stripe Add-On, but it doesn’t support Stripe iDEAL payments out of the box. The Mollie Add-On adds support for iDEAL payments via Gravity Forms, but Mollie rejects new applications more often due to recent policy changes. Did Mollie reject your application? With this tutorial you can implement iDEAL for Gravity Forms using Stripe as your payment provider.

It requires some coding, but actually it is not that hard. We will walk through it step by step.

Enable the Stripe Payment Form in Gravity Forms settings

First you need to ensure you are using the Stripe Payment Form in stead of the Stripe creditcard field as the payment collection method. Note this is a global Gravity Forms setting and it will apply to your whole site. Using the Stripe checkout form is currently the only option we know to support iDEAL within the Gravity Forms Stripe Add-On (version 4.2 at the time we wrote this). The Stripe Add-On is part of the Gravity Forms Pro / Elite licenses.

Screenshot of Stripe Payment Collection Method in Gravity Forms global settings
Enable the Stripe Payment Form in Gravity Forms settings

Modify the Stripe session data using a filter

The Gravity Forms Strip Add-On has a filter we can use: ‘gform_stripe_session_data‘. We can hook our own function by calling the WordPress add_filter() function. The filter passes up to 5 arguments to our function:

  • Session data for creating a Stripe session. See the Stripe documentation for supported.
  • Feed settings.
  • Submission data, containing information about the customer and transacion.
  • Form settings.
  • The submitted entry.

These information is at your disposal to determine how you want to modify the Stripe session data. Add the filter to your theme functions.php or to a separate plugin.

add_filter( 'gform_stripe_session_data', function( $session_data, $feed, $submission_data, $form, $entry ) {

    // do stuff, modify the session data array.
 
    return $session_data;
}, 10, 5 );

Support both iDEAL and creditcard payments

By default the Stripe Add-On passes ‘card’ as the only payment method type.

If you want to support both iDEAL and creditcard we have to add ‘ideal’ to the ‘payment_method_types’ array as an extra item, keeping the ‘card’ item.

Image of the Stripe session data response send by Gravity Forms Stripe Addon.
Fragment of the session data response

To achieve this we add this line to our function:

$session_data['payment_method_types'][] = 'ideal';

Only support iDEAL payments

There can be situations where you want to leave out creditcard payments as an option. If you only want to support iDEAL payments you should replace the ‘card’ item in the ‘payment_method_types’ array with ‘ideal’. This line replaces the current array of ‘payment_method_types’ with a new array containing ‘ideal’:

$session_data['payment_method_types'] = array ( 'ideal' );

Add iDEAL payments to specific forms

It is also possible to add iDEAL checkout for specific forms. For example, we can apply it only if the forms title contains ‘iDEAL’ (case-sensitive!). We can check this because the form settings are passed by the filter for use in our function. Therefore we can check if the form title contains the word ‘iDEAL’ and modify the available payment methods only if that is true. In code:

    if ( strpos( 'iDEAL', $form['title'] ) !== false ) {
       // modify the payment method types here.
    }

Snippet for adding iDEAL as the Stripe payment method

The snippet below can be added to your themes functions.php or a separate plugin. It adds iDEAL to your Stripe checkout form as the only payment option, but only when your form has the word ‘iDEAL’ in the form title. Of course you can adapt this snippet to your specific needs. It is also possible to unlock other Stripe payment methods for checkout from a Gravity Form. At the time of writing these options are available:

add_filter( 'gform_stripe_session_data', function( $session_data, $feed, $submission_data, $form, $entry ) {

    if ( strpos( 'iDEAL', $form['title'] ) !== false ) {
        $session_data['payment_method_types'] = array ( 'ideal' );
    }
 
    return $session_data;
}, 10, 5 );

Adding other payment methods to Gravity Forms Stripe Add-On

It is also possible to add other payment methods. Just replace ‘ideal’ with one of the options below in your custom snippet:

  • acss_debit
  • afterpay_clearpay
  • alipay
  • au_becs_debit
  • bacs_debit
  • bancontact
  • boleto
  • eps
  • fpx
  • giropay
  • grabpay
  • ideal
  • klarna
  • oxxo
  • p24
  • sepa_debit
  • sofort
  • wechat_pay

Check out the Stripe documentation for the most actual list of possible values. Good luck!

Read more tutorials about Rocketgenius, Inc.

Rocketgenius builds advanced software solutions. Rocketgenius is the team behind Gravity Forms. Visit GravityForms.com
All tutorials Rocketgenius, Inc.