Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.