zzMzz
zzMzz

Reputation: 467

Stripe API PHP - Retreive Subscription (Without Knowing Subscription ID)

How does one retrieve a customer's subscription(s) using the Stripe PHP library when the subscription IDs are not already known?

Is there a way to do something like:

$customer = \Stripe\Customer::retrieve($customerId);

$subscription = $customer->subscription;

And the value in $subscription will hold the customer's subscription information.

Thanks,

Mike

Upvotes: 2

Views: 913

Answers (1)

duck
duck

Reputation: 5470

You'll want to list the subscriptions, passing a customer id.

\Stripe\Subscription::all(array('customer'=>$customerId,'limit'=>10));

https://stripe.com/docs/api/php#list_subscriptions

Upvotes: 3

Related Questions