How to do installment or payment plans with Gravity Forms and Stripe

May 14, 2023

6 Min. Read

Share URL

This page may contain affiliate links. Please read my disclaimer for more information.

In this tutorial, I’m going to show you how you can use Gravity Forms and the Stripe Add-On to offer your customers payment plans when purchasing your products and services. You can use this same method to stop subscription payments after a specific number of transactions automatically.

This tutorial was inspired by the following question:

Let’s say I have a product that’s $400 but I want to give an option for 2 payments of $200, but I don’t want the customer to be charged for a third time, can I set up the recurring payment only to run for two payments or months?

What You’ll Need

This tutorial uses the 4.0 version of the Stripe Add-On, not the latest 5.0 version released in June 2023. However, the only difference is the Stripe field display, all other settings are the same.

Optional:

This add-on is not required to offer payment options, but if you would rather avoid modifying and adding code to your site, this add-on will be a huge benefit, and it’s only $27.

I will also be demonstrating how to use this plugin at the end of this tutorial.

What’s not covered here…

I am going to assume you already have Gravity Forms installed and set up on your site, but if you do not, please use this doc to help walk you through that process.

I am also going to assume that you have the Stripe Add-On installed and set up, but if you do not, I have a tutorial you can follow to help you get that done.

What is covered in this tutorial:

These are the required steps to create a form that supports installment payments.

  1. Building the Form
  2. Create the Stripe Feed(s)
  3. Modify and Implement Code
  4. Test, Test, Test

I have made my form templates available to you below under Step 1 to help simplify the process. You can implement these templates into your own site using the institutions here.

Step 1: Building the Form

In this step, I will walk you through building a form to make sure you have the necessary fields in order for this to work.

These are the necessary fields, you can have any other fields that fit your needs, but these are a must-have:

  • Email field
  • Choice field (i.e checkbox, radio, dropdown)
  • Product field(s)
  • Stripe Card field

In the video, I show you a basic approach to setting this up. But I have included the form template below which you can download to help you get started fast.

Download the Form Template

It’s 100% FREE!

Name*(Required)
Download Form Templates

Step 2: Create Stripe Feeds

You will need to have a feed for the one-time payment and one for each of the different installment plans you intend to offer.

The one-time payment feed will be configured as a Product and Services transaction type and the installment plan feeds will need to be Subscription transaction types.

Pro Tip

Feeds are not included in the template files you may have downloaded above and will require that you set them up manually.

Step 3: Modify and Implement Code

Don’t get scared by the word code in this step. With the code snippet provided below, complements of the Gravity Forms docs, all you need to do is make the changes I walk you through in the video below.

Or you can just follow the instructions included in the code snippet.

add_action( 'gform_post_add_subscription_payment', function ( $entry ) {
    gf_stripe()->log_debug( 'gform_post_add_subscription_payment: Running...' );
 
    if ( rgar( $entry, 'payment_status' ) !== 'Active' ) {
        // Abort if this event isn't for an active subscription.
        return;
    }
 
    // Get the feed that processed the entry.
    $feed      = gf_stripe()->get_payment_feed( $entry );
    $feed_name = rgars( $feed, 'meta/feedName' );
 
    gf_stripe()->log_debug( 'gform_post_add_subscription_payment: Feed: ' . $feed_name . '; Entry: ' . $entry['id'] );
 
    // Define the names of the feeds you want this code to cancel subscriptions for.
    $feed_names = array( 'feed name one', 'feed name two' );
 
    if ( ! in_array( $feed_name, $feed_names ) ) {
        // Abort if the entry was processed by a different feed.
        return;
    }
 
    // Get the payment count from the database.
    global $wpdb;
    $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$wpdb->prefix}gf_addon_payment_transaction WHERE lead_id=%d", $entry['id'] ) );
    gf_stripe()->log_debug( 'gform_post_add_subscription_payment: $count = ' . print_r( $count, true ) );
 
    if ( $count >= 3 ) { // Update this line to the Total number of payments including the first one.
        $result = gf_stripe()->cancel( $entry, $feed );
        gf_stripe()->log_debug( "gform_post_add_subscription_payment: Cancelling subscription (feed #{$feed['id']} - {$feed_name}) for entry #{$entry['id']}. Result: " . print_r( $result, 1 ) );
    }
} );

Where to put this code?

I recommend that you use a functionality plugin like WPCodeBox (demonstrated in the video), however, you can also add the code snippet to your active theme’s functions.php file.

Step 4: Test, Test, Test

This part is critical. You want to make sure that your form is going to actually collect money before you start sending people there.

Testing consists of embedding the form on a page of your website, filling out the form fields, and clicking submit.

Once that is done you can check the form entries to make sure everything was processed successfully.

Bonus: Using the StartEnd Add-On

If you’ve decided that you don’t want to mess with the code in step three and want an easier option, I’ll show you how the StartEnd Add-On works in this tutorial.

You can download the add-on here.

This is really a slick add-on that is easy to use and extremely affordable.

The Wrap Up

When it comes to customizing your payment options, Gravity Forms and Stripe offer some advanced solutions.

Remember this tutorial shows a very basic solution and is not the limits of what is possible.

Hopefully, this tutorial helps you get where you need to go, but if you still need help, feel free to use the comments below.

FAQs

Can you do this with any other Gravity Forms payment add-ons?

Yes. Both the Authorize.net and Square Add-ons offer this functionality built into the feed settings.

Photo of author
About the Author
Chris Eggleston
Husband. Father of 4. Grandpa of 2. Chief Problem Solver exploring business systems, technology, AI & faith — helping people solve real problems. @mantiswp @chrisegg

Support Chris - Donate $5

Gravity Wiz Add-Ons

Advertisement

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Post

How to Secure a Digital Broadcast Page with Gravity Forms Submit to Access Add-On

Live events and webinars are powerful ways to connect with your audience, but hosting them directly on your WordPress site...

Oct 3, 2025

4 min. read

Step-by-Step Guide: Sending a Gravity Forms Notification to the User

Gravity Forms notification feature allows you to send emails to users automatically when they submit a form. This is useful...

Mar 20, 2025

5 min. read

Gravity Forms Multi-Date Picker

Gravity Forms is a powerful form builder, but you might occasionally find some limitations. For example, the date picker field...

Nov 13, 2024

4 min. read

How to Migrate From WS Forms to Gravity Forms: A Step-by-Step Guide

Migrating from WS Forms to Gravity Forms can seem daunting, but with the right approach, it can be a smooth...

Oct 26, 2024

4 min. read

How to Connect Gravity Forms to SendFox: A Step-by-Step Tutorial

This tutorial will walk you through connecting Gravity Forms to SendFox and ensuring your contacts are added to your email marketing...

Oct 16, 2024

5 min. read

How to: Gravity Forms BMI Calculator

Many people don’t realize that the calculation feature is built into the Gravity Forms core plugin and is available for...

Oct 10, 2024

4 min. read