Skip to content

Set Subscription Start Date to the 1st of the Month in Gravity Forms

How to set Gravity Forms subscription start dates to the 1st of the month using the gform_authorizenet_subscription_pre_create and gform_stripe_subscription_pre_create filters, or the STARTEND paid add-on.

Chris Eggleston 3 min read

By default, when someone signs up for a subscription through a Gravity Forms form, billing starts right away. A customer who signs up on March 27 is charged on March 27, and renews on the 27th of every month.

For membership sites, coaching programs, or any business that bills on a calendar cycle, that’s a headache. You want every subscriber on the same date, ideally the 1st of the month, so your reporting, fulfillment and cash flow line up.

The feed settings don’t have a start date option for Authorize.net or Stripe. The fix is a small filter that changes the subscription right before it’s created.

Option 1: Code Snippet (Free)

Add the code for your gateway with a code snippet plugin like WPCodeBox or in a custom plugin.

For Authorize.net

/**
 * Start Authorize.net subscriptions on the 1st of next month.
 */
add_filter( 'gform_authorizenet_subscription_pre_create', function ( $subscription, $form_data, $config, $form, $entry ) {
	if ( (int) $form['id'] !== 5 ) { // Replace 5 with your form ID.
		return $subscription;
	}

	// Authorize.net expects the start date as YYYY-MM-DD.
	$subscription->startDate = wp_date( 'Y-m-d', strtotime( 'first day of next month' ) );

	return $subscription;
}, 10, 5 );

To let the customer choose their own start date with a Date field, replace the start date line with:

	// Use the date the customer picked (field 22) instead.
	$picked = rgar( $entry, '22' );
	if ( $picked ) {
		$subscription->startDate = gmdate( 'Y-m-d', strtotime( $picked ) );
	}

For Stripe

Stripe doesn’t take a start date. Instead, you delay the first charge with trial_end, a Unix timestamp. The customer’s card is saved at signup, the subscription shows as trialing until the 1st, and then it bills on the 1st every month.

/**
 * Start Stripe subscriptions on the 1st of next month (Stripe Add-On 6.0+).
 */
add_filter( 'gform_stripe_elements_subscription_args', function ( $sub_args, $subscription_data, $entry, $feed, $customer_id, $product ) {
	if ( (int) $entry['form_id'] !== 5 ) { // Replace 5 with your form ID.
		return $sub_args;
	}

	// Delay the first charge until midnight on the 1st of next month (site timezone).
	$first = new DateTime( 'first day of next month midnight', wp_timezone() );
	$sub_args['trial_end'] = $first->getTimestamp();
	unset( $sub_args['trial_period_days'] ); // Don't send both.

	return $sub_args;
}, 10, 6 );

This uses gform_stripe_elements_subscription_args, the filter for Stripe Add-On 6.0 and newer. If you’re on an older version, the equivalent filter is gform_stripe_subscription_params_pre_update_customer.

Configuration Notes

ValueReplace it with
5Your form ID
22Your Date field ID (only for the Date field version)

Limitations & Caveats

  • Subscriptions only. One-time payments use different hooks.
  • Authorize.net timing: Authorize.net processes subscriptions in a batch around 2:00 AM Pacific. Depending on your site’s timezone, the entry may show the day before. The billing date in Authorize.net is still correct.
  • Signups on the 1st: “first day of next month” moves someone who signs up on the 1st to the next month. Add a check if you want them to start the same day.
  • Stripe trials: if your feed already has a trial, this code replaces it. Remove the trial from the feed so the two don’t conflict.

Option 2: STARTEND Add-On (Paid, No Code)

If you use Stripe and want a point-and-click option, STARTEND adds start and end date settings to the Stripe feed. It also handles fixed numbers of payments and term limits.

Need More Help?

If you still need help, use the chat or leave a comment below and we’ll get back to you.

Comments

Ask a question or leave a comment

Your email is never shown. For help with a specific form, share what you expected and what happened instead.