Subscriptions

Create a subscription

The createSubscription() method takes a CreateSubscriptionRequest object as its second parameter.

$request = $stripe->subscriptions->createSubscriptionRequest("plan_id");
$stripe->subscriptions->createSubscription("customer_id", $request);

Retrieve a subscription

$subscription = $stripe->subscriptions->getSubscription("customer_id", "subscription_id");

Update a subscription

The updateSubscription() method takes an UpdateSubscriptionRequest object as its third parameter.

$request = $stripe->subscriptions->updateSubscriptionRequest()->setQuantity(2);
$stripe->subscriptions->updateSubscription("customer_id", "subscription_id", $request);

Cancel a subscription

$stripe->subscriptions->cancelSubscription("customer_id", "subscription_id");

List a customer's subscriptions

$subscriptions = $stripe->subscriptions->listSubscriptions("customer_id");