Adding a reference to a Stripe payment

By: Phil Cox | Asked: 10/13/2022
ForumsCategory: General questionsAdding a reference to a Stripe payment
Phil Cox asked 2 years ago
Hey all, The transaction that goes through to Stripe from a Formidable Form doesn't contain sufficient information to identify the payment on the resulting bank statement.  Is there away to add (for example) a booking reference, so that the accountants can track the payment through? Many thanks, Phil.
2 Answers
Phil Cox answered 2 years ago
With the help of Jonathan at FF, I've found some further information on Stripe.  The attached screeenshot is taken from https://stripe.com/docs/account/statement-descriptors#static.

So, does anyone know how we modify FFPro to send this information to Stripe with the transaction? Thanks, Phil.
Attachments
Jonathan O\'Neill answered 1 year ago
Hi Phil - Assuming this is a one-time payment, you can try the following example code snippet, and customize as needed.  Let me know if this helps! -  Jon
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;
}

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right