bookmark_bordergform_stripe_charge_pre_create

Description

The gform_stripe_charge_pre_create filter allows the charge properties to be overridden before the charge is created by the Stripe API.

Usage

The hook which would run for all Stripe product and service feeds can be used like so:

add_filter( 'gform_stripe_charge_pre_create', 'your_function_name', 10, 5 );

Parameters

  • $charge_meta array

    The properties for the charge to be created.

  • $feed Feed Object

    The feed object currently being processed.

  • $submission_data Submission Data

    Contains the form title, payment amount, setup fee amount, trial amount, line items created using the submitted pricing field values and any discounts from coupons.

  • $form

    The Form which is currently being processed.

  • $entry Entry Object

    The entry from which the subscription was created.

Examples

1. Add the statement_descriptor property

The following example shows how you can add the statement_descriptor property to the charge meta.

add_filter( 'gform_stripe_charge_pre_create', 'stripe_charge_pre_create', 10, 5 );
function stripe_charge_pre_create( $charge_meta, $feed, $submission_data, $form, $entry ) {
	$charge_meta['statement_descriptor'] = 'STATEMENTDESC';

	return $charge_meta;
}

Placement

Your code snippet should be placed in the functions.php file of your active theme.

Source Code

$charge_meta = apply_filters( 'gform_stripe_charge_pre_create', $charge_meta, $feed, $submission_data, $form, $entry );

This hook is located in GFStripe::authorize_product() in class-gf-stripe.php

Since

This hook was added in Stripe version 2.2.2