title: Is there a way to pass the metadata from Subscription API to Charge API?
body: <p>I have two functions namely charge and subscription, when a successful charge
  happens I insert some metadata there look below:</p>
  
  <p><a href="https://i.stack.imgur.com/WEshw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WEshw.jpg" alt="enter image description here"></a></p>
  
  <p>Same for the subscription function:</p>
  
  <p><a href="https://i.stack.imgur.com/MYSTl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MYSTl.jpg" alt="enter image description here"></a></p>
  
  <p>Then I have a separate file which I will not post here because it only calls to the Charge list API to get all the successful charges to check all the metadatas in there, however I noticed that once I created a subscription via API it's only available there the metadata1 and metadata2.</p>
  
  <p>When I view on the charge created by the subscription nothing was attached to its metadata. How can I attach the metadatas from the subscription to the charge that corresponds to it?</p>
  
  <p><a href="https://i.stack.imgur.com/CYv0v.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CYv0v.jpg" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?php
    require_once('stripe-php-master/init.php');
    require 'apiKeys.php';
  
  $data = $_REQUEST['data'];
  
  if(isset($data['stripeToken'])){
      create_customer($data);
  }else{
      printResponse($data,"No Token");
  }
  
  //Create Customer
  function create_customer($data){
  
      try{
          \Stripe\Stripe::setApiKey(SK_TEST_KEY);
          $customer = \Stripe\Customer::create(array(
              "description" =&gt; 'Widget Create Customer',
              "source" =&gt; $data['stripeToken'],
              "email" =&gt; $data['stripeEmail']
          ));
  
          $data['customerID'] = $customer-&gt;id;
          //create_charge($data);
          create_subscription($data);
  
      }catch(Exception $e){
          echo $e-&gt;getMessage();
          exit;
      }
  
  }//create_customer
  
  //Create charge
  function create_charge($data){
  
      try{
          \Stripe\Stripe::setApiKey(SK_TEST_KEY);
  
          $settings = [
              'currency' =&gt; 'aud',
              'amount'=&gt;5500,
              'description' =&gt; 'Widget Payment for ' .$data['widget_name'],
              'customer' =&gt; $data['customerID'],
              'metadata'=&gt;["metadata1" =&gt; $data['metadata1'],"metadata2" =&gt; $data['metadata2']]
          ];
  
          // Get the payment token ID submitted by the form:
          $charge = \Stripe\Charge::create($settings);
  
          printResponse($data, $charge-&gt;status);
  
      }catch(Exception $e){
          printResponse($data,$e-&gt;getMessage());
          exit;
      }
  }//create_charge
  
  //Create subscription
  function create_subscription($data){
  
      try{
  
          \Stripe\Stripe::setApiKey(SK_TEST_KEY);
  
          $settings = [
              'customer' =&gt; $data['customerID'],
              'metadata'=&gt;["metadata1" =&gt; $data['metadata1'],"metadata2" =&gt; $data['metadata2']],
              'items' =&gt; [
                  [
                    'plan' =&gt; $data['widget_class']
                  ]
              ]
  
          ];
  
          $subscription = \Stripe\Subscription::create($settings);   
          printResponse($data,$subscription-&gt;status);
  
      }catch(Exception $e){
          printResponse($data,$e-&gt;getMessage());
          exit;
      }
  }
  
  function printResponse($data,$status){
       //CREATE Response JSON
      print_r(json_encode([
          'customer_name'=&gt; $data['customer_name'],
          'metadata1' =&gt; $data['metadata1'],
          'metadata2'=&gt; $data['metadata2'],
          'payment_status'=&gt;$status
      ]));
  
  }
  ?&gt;
  </code></pre>
  
  <p>I just want the when someone subscribes the charge from the subscription event has the metadata1 and metadata2 attached to it.</p>