title: Cancel Subscription At Period End
body: <p><strong>QUESTION:</strong></p>
  
  <p>How does one append the "at_period_end" argument to the following PHP function in accordance with the relevant Stripe documentation ?</p>
  
  <p><strong>DOCUMENTATION:</strong> </p>
  
  <p><a href="https://stripe.com/docs/api/php#cancel_subscription" rel="noreferrer">STRIPE: cancel subscription</a></p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>&lt;?php
  
  require_once('./lib/Stripe.php');
  Stripe::setApiKey("$APIKEY");
  
  $cu = Stripe_Customer::retrieve("$CUSTOMER_ID");
  $cu-&gt;subscriptions-&gt;retrieve("$SUBSCRIPTION_ID")-&gt;cancel();
  
  ?&gt;
  </code></pre>