title: How to get the charge ID from Stripe using PHP?
body: <p>First of all, I am aware that this question has been asked but they didn't explain how to get the information using </p>
  
  <pre><code> charge.succeeded
  </code></pre>
  
  <p>I am creating an auth and capture charge using Stripe. I need the charge ID to confirm/capture the charge. </p>
  
  <p>The following code creates the charge but doesn't charge until it's been approved.</p>
  
  <pre><code>\Stripe\Charge::create(array(
      "amount" =&gt; $price,
      "currency" =&gt; "usd",
      "customer" =&gt; $custID, // obtained with Stripe.js
      "description" =&gt; "Charge for test@example.com",         
      "capture" =&gt; false
  ));
  </code></pre>
  
  <p>I assumed that I could get the charge ID by doing: </p>
  
  <pre><code>$chargeID = $charge-&gt;id;
  </code></pre>
  
  <p>because that's how I get the customer ID when I create a customer. But I get nothing when I echo out the variable, which doesn't help since I want to save it in a database. I've looked everywhere but can't find anything concrete or recent. </p>
  
  <p>Then to complete the charge. I have to capture it this way:</p>
  
  <pre><code>$ch = \Stripe\Charge::retrieve("$chargeID");
  $ch-&gt;capture();
  </code></pre>
  
  <p>This is all from the Stripe API Reference but it doesn't explain how to get the charge ID. It doesn't even tell you how to get the customer ID, luckily Stack Overflow came through with that one.</p>
  
  <p>This is all done using PHP.</p>