Skip to content

Instantly share code, notes, and snippets.

@LarryUllman
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarryUllman/b3cf527b0a864d6921aa to your computer and use it in GitHub Desktop.
Save LarryUllman/b3cf527b0a864d6921aa to your computer and use it in GitHub Desktop.
Stripe - PHP - Upgrade Subscription Plan, Invoice Now
// Retrieve the customer:
$customer = Stripe_Customer::retrieve($customer_id);
// Retrieve the subscription being updated:
$subscription = $customer->subscriptions->retrieve($subscription_id);
// Change the plan:
$subscription->plan = '25_monthly'; // Was 10_monthly
// Use proration (default; not required):
$subscription->prorate = true;
// Save the changes:
$subscription->save();
// Invoice now:
Stripe_Invoice::create(array(
'customer' => $customer_id
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment