Controlling Stripe Charge Data

Stripe For Caldera Forms Banner

The Caldera Forms Stripe add-on can be used to create both recurring and one time charges. The add-on provides multiple hooks to allow you to customize the Stripe API requests.

Code Examples For The Caldera Forms Stripe Hooks

Modify Caldera Forms Stripe One Time Payment API Request

The filter cf_stripe_charge_args can be used to modify a one-time payment. It changes the values passed to \Stripe\Session::create().

This filter exposes the following parameters:

  • $args An array of arguments to use to create the charge
  • $config The form processor configuration
  • $form The form configuration

You can use this filter to change the amount being charged:

You can use this filter to change the address the receipt is sent to:

See the relevant Stripe API docs for the allowed parameters.

Using Caldera Forms Stripe One Time Payment API Response Data

After the charge is sent to the Stripe API, the response from the API is exposed via the cf_stripe_post_payment action.

This action exposes the following parameters:

  • $session An object of the Stripe\Session class that represents the newly created session for this charge.
  • $args An array of arguments that were used to create the charge
  • $config The form processor configuration
  • $form The form configuration

Modify Caldera Forms Stripe Subscription API Requests

Before a subscription is created, the cf_stripe_recurring_args filter can be used to modify the request. The arguments modified by this filter are passed to \Stripe\Session::create().

  • $args An array of arguments to use to create the charge
  • $config The form processor configuration
  • $form The form configuration

You can change the subscription plan with this filter:

See the relevant Stripe API docs for the allowed parameters.

Using Caldera Forms Stripe Subscription API Response Data

After the charge is sent to the Stripe API, the response from the API is exposed via the cf_stripe_post_plan_create  action.

This action exposes the following parameters:

  • $session An object of the Stripe\Session class that represents the newly created session to set the subscription to the plan.
  • $args An array of arguments that were used to create the charge
  • $config The form processor configuration
  • $form The form configuration

Change Charge Description

This code example shows how to change charge description for single or recurring payments:

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More