Title: Custom metadata
Last modified: November 10, 2017

---

# Custom metadata

 *  Resolved [rfortin](https://wordpress.org/support/users/rfortin/)
 * (@rfortin)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/custom-metadata/)
 * What’s the best way to add custom metadata to class-stripe-api.php without editing
   the original file?
 * In particular, I want to add shipping information to the $charge(metadata) array
   within the function get_charge_details().
 * Thank you,
 * Raymond

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

 *  [mujeebur](https://wordpress.org/support/users/mujeebur/)
 * (@mujeebur)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/custom-metadata/#post-9684521)
 * Hi Raymond( [@rfortin](https://wordpress.org/support/users/rfortin/) ): Please
   try with the latest version(3.0.4) of the plugin. We have added hook for altering
   charge params.
 *  Thread Starter [rfortin](https://wordpress.org/support/users/rfortin/)
 * (@rfortin)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/custom-metadata/#post-9686314)
 * I added the following code to my functions.php. I’m trying to add a test postal
   billing code to the metadata array.
 *     ```
       /*** Woocommerce Stripe Alter Charge Parameters ***/
       add_filter('xa_alter_stripe_charge_params','my_stripe_meta_parameters');
       function my_stripe_meta_parameters($charge) {
           $extra_params = array(
       		'test_postal_code' => (WC()->version < '2.7.0') ? $wc_order->billing_postcode : $wc_order->get_billing_postcode()
       	);
   
       	// combine the two arrays
       	$charge['metadata'] = array_merge($extra_params, $charge['metadata']);
           return $charge;
       }
       ```
   
 * However, this causes an internal error. When I write instead
    `'test_postal_code'
   => '999999'` the code works and I see the order’s test postal code on my Stripe
   dashboard. For some reason `(WC()->version < '2.7.0') ? $wc_order->billing_postcode:
   $wc_order->get_billing_postcode()` is giving me a hard time. Any ideas?

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

The topic ‘Custom metadata’ is closed to new replies.

 * ![](https://ps.w.org/payment-gateway-stripe-and-woocommerce-integration/assets/
   icon-256x256.gif?rev=3361775)
 * [Payment Gateway of Stripe for WooCommerce](https://wordpress.org/plugins/payment-gateway-stripe-and-woocommerce-integration/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/payment-gateway-stripe-and-woocommerce-integration/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/payment-gateway-stripe-and-woocommerce-integration/)
 * [Active Topics](https://wordpress.org/support/plugin/payment-gateway-stripe-and-woocommerce-integration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/payment-gateway-stripe-and-woocommerce-integration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/payment-gateway-stripe-and-woocommerce-integration/reviews/)

## Tags

 * [metadata](https://wordpress.org/support/topic-tag/metadata/)

 * 2 replies
 * 2 participants
 * Last reply from: [rfortin](https://wordpress.org/support/users/rfortin/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/custom-metadata/#post-9686314)
 * Status: resolved