Title: Stripe extra info
Last modified: August 22, 2016

---

# Stripe extra info

 *  Resolved [JWMutant](https://wordpress.org/support/users/jwmutant/)
 * (@jwmutant)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/stripe-extra-info/)
 * Sorry for the extra post about the same problem.
 * I have looked at the info you gave me on adding metadata to the plugin, I cant
   make heads or tails of it so went to freelancer and payed someone to do it for
   me.
 * The guys was dumber than me so after wasting $50 at freelancer here I am again
 * The info I need added to the metadata look alot like this :
 * > <modification>
   > <file name=”catalog/controller/payment/stripe.php” error=”skip”>
   >  <operation
   > error=”skip”> <search position=”before”><![CDATA[ $charge_response = $this-
   > >curlRequest(‘charges’, $data, ‘POST’); ]]></search> <add trim=”true”><![CDATA[
   > $data[‘metadata’] = array();
   > $data[‘metadata’][‘shipping_address’] = ‘{“name”: “‘ . $order_info[‘firstname’].‘‘.
   > $order_info[‘lastname’] . ‘”, ‘;
   >  $data[‘metadata’][‘shipping_address’] .= ‘”
   > city”: “‘ . $order_info[‘shipping_city’] . ‘”, ‘; $data[‘metadata’][‘shipping_address’].
   > = ‘”line1″: “‘ . $order_info[‘shipping_address_1’] . ‘”, ‘; $data[‘metadata’][‘
   > shipping_address’] .= ‘”line2″: “‘ . $order_info[‘shipping_address_2’] . ‘”,‘;
   > $data[‘metadata’][‘shipping_address’] .= ‘”phone”: “‘ . $order_info[‘telephone’].‘”,‘;
   > $data[‘metadata’][‘shipping_address’] .= ‘”zip”: “‘ . $order_info[‘shipping_postcode’].‘”,‘;
   > $data[‘metadata’][‘shipping_address’] .= ‘”state”: “‘ . $order_info[‘shipping_zone_code’].‘”,‘;
   > $data[‘metadata’][‘shipping_address’] .= ‘”country”: “‘ . $order_info[‘shipping_iso_code_2’].‘”,‘;
   > $data[‘metadata’][‘shipping_address’] .= ‘”company”: “‘ . $order_info[‘shipping_company’].‘”}’;
   > $data[‘metadata’][‘billing_company’] = $order_info[‘payment_company’];
   >  $data[‘
   > metadata’][‘billing_phone’] = $order_info[‘telephone’]; $data[‘metadata’][’
   > email’] = $order_info[’email’]; $data[‘metadata’][‘browser_ip’] = $order_info[‘
   > ip’]; ]]></add> </operation> </file>
   > </modification>
 * However this code was written for opencart so will not suit wp but gives you 
   a idea on the fields that are needed.
 * Please please help me get this resolved.
 * If you need to discuss this with me more you can contact me on [administrator@caraudioaustralia.net.au](https://wordpress.org/support/topic/stripe-extra-info/administrator@caraudioaustralia.net.au?output_format=md)
 * [https://wordpress.org/plugins/stripe-for-woocommerce/](https://wordpress.org/plugins/stripe-for-woocommerce/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Stephen Zuniga](https://wordpress.org/support/users/stephenzuniga001/)
 * (@stephenzuniga001)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5682812)
 *     ```
       /**
        * Function for adding product metadata to the Stripe charge
        *
        * @param        array $charge_data
        * @param        array $form_data Data that's pulled from the customer, contains customer name, email, charge amount, etc.
        * @param        WC_Order $order The order object
        * @return       array $charge_data
        */
       function my_add_s4wc_charge_data( $charge_data, $form_data, $order ) {
   
           // Don't override the metadata if it already exists
           if ( ! isset( $charge_data['metadata'] ) ) {
               $charge_data['metadata'] = array();
           }
   
       	// Add stuff for riskified
       	$charge_data['metadata']['shipping_address'] = '{"name": "' . $order->billing_first_name . ' ' . $order->billing_last_name . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"city": "' . $order->shipping_city . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"line1": "' . $order->shipping_address_1 . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"line2": "' . $order->shipping_address_2 . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"phone": "' . $order->billing_phone . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"zip": "' . $order->shipping_postcode . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"state": "' . $order->shipping_state . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"country": "' . $order->shipping_country . '", ';
       	$charge_data['metadata']['shipping_address'] .= '"company": "' . $order->shipping_company . '"}';
       	$charge_data['metadata']['billing_company']  = $order->billing_company;
       	$charge_data['metadata']['billing_phone']    = $order->billing_phone;
       	$charge_data['metadata']['email']            = $order->billing_email;
       	$charge_data['metadata']['browser_ip']       = $_SERVER['REMOTE_ADDR'];
   
           // Return the array so it can be added to the Stripe charge
           return $charge_data;
       }
       add_filter( 's4wc_charge_data', 'my_add_s4wc_charge_data', 10, 3 );
       ```
   
 *  Thread Starter [JWMutant](https://wordpress.org/support/users/jwmutant/)
 * (@jwmutant)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5682814)
 * Can I assume this goes in class-s4wc_gateway.php?
 * Thanks for the reply btw.
 *  Plugin Author [Stephen Zuniga](https://wordpress.org/support/users/stephenzuniga001/)
 * (@stephenzuniga001)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5682815)
 * No, if you modify the plugin you’ll lose the changes with the next update. You
   should add it to your theme’s functions.php
 *  Thread Starter [JWMutant](https://wordpress.org/support/users/jwmutant/)
 * (@jwmutant)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5682823)
 * You sir a the master.
 * If you have a btc address please let me know what it is Ill send some coin your
   way at the end of the week.
 *  Plugin Author [Stephen Zuniga](https://wordpress.org/support/users/stephenzuniga001/)
 * (@stephenzuniga001)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5683139)
 * I don’t have a btc address, but there’s a donate link on the home page of this
   plugin that you could use.
 * Thank you!
 *  [scH](https://wordpress.org/support/users/sch/)
 * (@sch)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5683221)
 * Does this function not fire when the store is on test mode? Trying to implement
   this hook and am using very similar code that I found elsewhere, but it doesn’t
   seem to actually get to this function call, I know because I have an email fired
   off within the function and it’s not being sent.
 *  Plugin Author [Stephen Zuniga](https://wordpress.org/support/users/stephenzuniga001/)
 * (@stephenzuniga001)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5683222)
 * If you have WooCommerce subscriptions, it will use s4wc_subscription_charge_data.
   This plugin doesn’t care if the store is in live or test mode for 99% of the 
   functionality. It simply uses the different API keys you provide. The only difference
   is that the plugin requires SSL when using live keys. If the checkout page is
   loaded without SSL, the stripe gateway will not appear.
 *  [scH](https://wordpress.org/support/users/sch/)
 * (@sch)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5683223)
 * Yeah, I’m an idiot and didn’t realize this wasn’t the woo stripe implementation
   until after I posted. My bad.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Stripe extra info’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/stripe-for-woocommerce.svg)
 * [Stripe for WooCommerce](https://wordpress.org/plugins/stripe-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stripe-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stripe-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/stripe-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stripe-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stripe-for-woocommerce/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [scH](https://wordpress.org/support/users/sch/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/stripe-extra-info/#post-5683223)
 * Status: resolved