title: Stripe create a customer and recurring charge in PHP
body: <p>I have a website where I want to integrate the Stripe payment gateway, when a user registers I want to create a customer on Stripe and charge them the first month fee for example $100 and from the next month I want to charge them $50.</p>
  
  <p>How do I create the customer and then charge them simultaneously and setup recurring payment, so far I could only reach find out about one time payment system:</p>
  
  <pre><code>$charge = \Stripe\Charge::create(
      array(
          "amount" =&gt; $amount,
          "currency" =&gt; "usd",
          "source" =&gt; $token,
          "description" =&gt; $email
      )
  );
  </code></pre>
  
  <p>For recurring payments, will I have to run this code in a cron or is there any better way ?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I used the following code to create a customer first and then charge that customer with their charge id:</p>
  
  <pre><code>//Create Customer:
  $customer = \Stripe\Customer::create(array(
      'source'   =&gt; $token,
      'email'    =&gt; $_POST['email'],
      'plan'     =&gt; "monthly_recurring_setupfee",
  ));
  
  // Charge the order:
  $charge = \Stripe\Charge::create(array(
      'customer'    =&gt; $customer-&gt;id,
      "amount" =&gt; $amount,
      "currency" =&gt; "usd",
      "description" =&gt; "monthly payment",
      )
  );
  </code></pre>
  
  <p>this seems to be working.</p>
  
  <p>Another question: I have created two plans <code>monthly_recurring_setupfee</code> and <code>monthly_recurring</code>, the previous plan contains the amount that I want to charge plus the one time setup fee and the later plan contains the regular amount that I will be charging from the second month, I was thinking of assigning the user the <code>monthly_recurring_setupfee</code> plan at the time of registration and if the payment is successful change the plan of the user to <code>monthly_recurring</code>, is this possible ?</p>