Reputation: 1397
I have set up a product and subscription plan on stripe and have a matching plan on Laravel Spark. I was able to charge the subscription through a test card number and everything seems to be working fine. However, the "name" field for the subscription is "default" and should be "Enterprise - Monthly" or the name of the plan. The plan name isn't in the data anywhere else.
In spark, my JSON object at Spark->State->Teams->[0]->subscriptions->[0] was as follows
....
name:"default"
provider_plan:"my-id-#"
quantity:2
stripe_id:"XXXXXXXXX"
stripe_plan:"my-id-#"
team_id:4
....
I didn't see anywhere to set a name, other than where I set it to the aforementioned "Enterprise - Monthly". Did I miss something?
Upvotes: 2
Views: 881
Reputation: 7515
This may have been done intentionally given that plan names can change in many different places. The 'default' name value in the database can probably be easily updated as it's inserted or updated, but I did figure out how to resolve that user's subscription back to the name of the plan as defined in SparkServiceProvider.php
:
$subscription = $someUser->subscription();
$plan = Spark::plans()->where('id', $subscription->stripe_plan)->first();
Upvotes: 1