I am creating a Stripe subscription with Laravel cashier. I have successfully created a subscription in Stripe with metadata. How to retrieve all subscriptions (with metadata) of a customer.?
Below is the code that creates the subscription
$request->user()->newSubscription('main', $plan->stripe_plan)->withMetadata(['wcda_reference' => $reference])->create($request->stripeToken);
Tried below code to retrieve but its listing from my database - not from Stripe API
$request->user()->subscriptions();
You can try this:
$request->user()->asStripeCustomer()->subscriptions;
It returns a list of user's subscriptions.
Here is the Stripe API doc of the response: https://stripe.com/docs/api/customers/retrieve