add_filter( 'frm_strp_new_charge', 'stripe_metadata', 10, 2 ); function stripe_metadata( $new_charge, $atts ) { // Supports multiple Payment Action IDs // Action ID 1234 - One Time Payment // Action ID 5678 - Recurring, Monthly $form_action_ids = [1234, 5678]; // Replace with your Payment Action IDs if ( in_array($atts['action']->ID, $form_action_ids) ) { $new_charge['metadata'] = []; $new_charge['metadata']['key'] = 'value'; // Replace 'key' and 'value' appropriately } // Supports single Payment Action ID // Passes form metadata and entry metadata to Stripe if ( $atts['action']->ID == 789 ) { // Replace 789 with your Payment Action ID $new_charge['metadata'] = []; $new_charge['metadata']['sourceName'] = $atts['form']->name; $new_charge['metadata']['sourceType'] = 'formidable'; $new_charge['metadata']['source_formId'] = $atts['form']->id; $new_charge['metadata']['source_formKey'] = $atts['form']->form_key; $new_charge['metadata']['source_formEntryId'] = $atts['entry']->id; $new_charge['metadata']['source_formEntryKey'] = $atts['entry']->item_key; } return $new_charge; }
Please login or Register to submit your answer