Add More Information for Stripe Transaction List

By default when you pay using the stripe payment gateway you can see something similar to this description “Backer Order 12321” on your Stripe account dashboard.

This does not provide full information for consistent tracking. To keep track of donor information and which product someone donated for, you need to have the information presented properly.

If as the admin you want to view this information in this format

Product name | Donor name | Order ID.

Add this code snippet at the end of your active theme’s functions.php file:

add_filter( 'wc_stripe_generate_payment_request', 'change_stripe_payment_description', 10, 2 );
function change_stripe_payment_description( $post_data, $order ) {
   // Get the order number
   $order = wc_get_order( $order->get_order_number() );
   // Get the order items
   $items = $order->get_items();
   // Check if it's crowdfunding product
   $is_crowdfunding = get_post_meta( $order->get_order_number(), 'is_crowdfunding_order', true );
   // If it's crowdfunding product
   if( $is_crowdfunding ) {
       $product_name = '';
       $customer_name = ucwords( $post_data['metadata']['customer_name'] );
       foreach ( $items as $item ) {
           $product_name .= $item->get_name();
       }
       // Change the description
       $post_data['description'] = $product_name . ' | ' . $customer_name . ' | ' . 'Order ' . $order->get_order_number();
       return $post_data;
   }
   return $post_data; 
}

Was this helpful?