Edit Stripe transaction description and metadata
-
I use this plugin with Stripe and overall I’m happy with it, but I’ve had to apply some changes so that the manual payments have all of the same transaction metadata in Stripe as those that are processed through self-service checkout in my store.
I have to modify the following transaction metadata labels:
‘Customer Name’ => ‘customer_name’
‘Customer Email’ => ‘customer_email’I have to add the following transaction metadata labels:
‘order_id’
‘invoice_id’The code I use looks like this:
$charge_info[‘metadata’][‘customer_name’] = $name;
$charge_info[‘metadata’][‘customer_email’] = $email;
$charge_info[‘metadata’][‘order_id’] = $order_id;
$charge_info[‘metadata’][‘invoice_id’] = $order_id;I also need to update the transaction description string so that it reads:
[‘blogname’] – Invoice [$order_id]I used the Manual Payment “Settings” tab to enter the following transaction description, but it doesn’t flow through to the stripe metadata and it wouldn’t include the $order_id.
“SkillWorks, Inc. – Invoice ”Here is the transaction description code from the Stripe plugin (I replaced “Order” with “Invoice”):
$post_data[‘description’] = sprintf( __( ‘%1$s – Invoice %2$s’, ‘woocommerce-gateway-stripe’ ), wp_specialchars_decode( get_bloginfo( ‘name’ ), ENT_QUOTES ), $order->get_order_number() );
It’s a pain to manually reapply these corrections each time there is a new version of woo mp released.
Is there a way that I could add a code snippet that:
1. overrides the transaction metadata labels for Customer Name and Customer Email
2. adds order_id and invoice_id to the transaction metadata
3. overrides the default transaction description to use my preferred formatWould this allow me to just update the woo mp plugin when a new version is available without changing code each time?
- The topic ‘Edit Stripe transaction description and metadata’ is closed to new replies.