Last active
August 29, 2015 14:04
-
-
Save LarryUllman/b3cf527b0a864d6921aa to your computer and use it in GitHub Desktop.
Stripe - PHP - Upgrade Subscription Plan, Invoice Now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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