Stripe Token – Caldera Forms

Stripe For Caldera Forms Banner

This filter allows you to use the Stripe token that is generated by Caldera Forms Stripe with your own custom code. This allows for more complex Stripe API integrations that are not possible via the UI of the processor.

Please note that Stripe tokens are one time use only. If you need to make multiple API requests, for example to make a one time charge and to add a subscription plan, it is recommended to use the token to create a Stripe customer object. Then in future requests, you can use the customer ID instead of the token in the “source” argument.

This filter exposes 4 parameters:

  • $early_return Return this as null to allow Caldera Forms default behavior, return as true to prevent Caldera Forms default behavior. Return an error array to trigger a validation error.
  • $token This is the Stripe API token.
  • $config This is the processor configuration
  • $form This is the form configuration

This filter was added in Stripe 1.4.6

Capture Charge Authorization

Use Stripe token to capture charge authorization without collecting on charge.

Create Stripe Customer Before Charging Customer

In this example, the charge configured as a one time payment is made, after creating a Stripe customer. Because a Stripe customer exists you can issue additional invoices or charges later.

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