title: Charging card with Stripe
body: <p>Everything is working fine in Stripe - the token is generated, written in the "log" part in my dashboard, etc. However there is no charge done. I got no error from Stripe or my code even if I did all the error handling given by the stripe documentation. How can I correct this?</p>
  
  <pre><code>require_once ("vendor/autoload.php");
  
  if ($_POST) {
   echo "catch if";
  
   // Set your secret key: remember to change this to your live secret key in production
   // See your keys here: https://dashboard.stripe.com/account/apikeys
  
   StripeStripe::setApiKey("myApyKey");
  
   // Get the credit card details submitted by the form
  
   $token = $_POST['stripeToken'];
  
   // Create a charge: this will charge the user's card
  
   try {
    echo "charging";
    $charge = StripeCharge::create(array(
     "amount" =&gt; 1000, // Amount in cents
     "currency" =&gt; "eur",
     "source" =&gt; $token,
     "description" =&gt; "Example charge"
    ));
   }
  
   catch(StripeErrorCard $e) {
  
    // Since it's a decline, \Stripe\Error\Card will be caught
  
    $body = $e-&gt;getJsonBody();
    $err = $body['error'];
    print ('Status is:' . $e-&gt;getHttpStatus() . "\n");
    print ('Type is:' . $err['type'] . "\n");
    print ('Code is:' . $err['code'] . "\n");
  
    // param is '' in this case
  
    print ('Param is:' . $err['param'] . "\n");
    print ('Message is:' . $err['message'] . "\n");
   }
  
   catch(StripeErrorRateLimit $e) {
  
    // Too many requests made to the API too quickly
  
   }
  
   catch(StripeErrorInvalidRequest $e) {
  
    // Invalid parameters were supplied to Stripe's API
  
   }
  
   catch(StripeErrorAuthentication $e) {
  
    // Authentication with Stripe's API failed
    // (maybe you changed API keys recently)
  
   }
  
   catch(StripeErrorApiConnection $e) {
  
    // Network communication with Stripe failed
  
   }
  
   catch(StripeErrorBase $e) {
  
    // Display a very generic error to the user, and maybe send
    // yourself an email
  
   }
  
   catch(Exception $e) {
  
    // Something else happened, completely unrelated to Stripe
  
   }
  </code></pre>