Skip to content

Instantly share code, notes, and snippets.

@New0
Created December 16, 2019 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/cabd1c334410150a129cb1b9ad5aabeb to your computer and use it in GitHub Desktop.
Save New0/cabd1c334410150a129cb1b9ad5aabeb to your computer and use it in GitHub Desktop.
<?php
//this applies change when creating plans
add_filter( 'cf_stripe_recurring_args', 'my_cf_stripe_recurring_filter', 10, 2 );
//this applies change when creating one time payments
add_filter( 'cf_stripe_charge_args', 'my_cf_stripe_single_filter', 10, 2 );
//this is the callback to change arguments sent to API
//Be careful not to set a field that isn't supported or the API will reject the charge.
//Description for single payments
function my_cf_stripe_single_filter( $args, $form ){
/* Change this to the right field ID */
$field_id = 'fld_13345';
$args['line_items'][0][ 'description' ] = Caldera_Forms::get_field_data( $field_id, $form );
return $args;
}
//Description for plans
function my_cf_stripe_recurring_filter( $args, $form ){
/* Change this to the right field ID */
$field_id = 'fld_13345';
$args['subscription_data']['metadata'][ 'description' ] = Caldera_Forms::get_field_data( $field_id, $form );
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment