【发布时间】:2017-10-18 17:46:11
【问题描述】:
我有 8 个条纹计划。 4 个月 + 4 年。喜欢
plan_one.monthly
plan_one.yearly
plan_two.monthly
plan_two.yearly
plan_three.monthly
plan_three.yearly
plan_four.monthly
plan_four.yearly
这里是用户订阅行
id -> 1
user_id -> 1
name -> Plan-One Monthly
stripe_id -> sub_xxxxxxxxxx
stripe_plan -> plan_one.monthly
quantity -> 1
trial_ends_at - null
ends_at - null
created_at - datetime()
updated_at - datetime()
在这种情况下,我如何获取用户活动/当前订阅计划名称?
【问题讨论】:
-
您可以使用stripe.com/docs/api#retrieve_customer(如果您只有一个订阅)或stripe.com/docs/api#list_subscriptions(如果您有多个订阅)来执行此操作。
-
奇怪的是,如果不遍历所有计划并检查
$user->subscription($plan_name)是否为真,就无法在收银员中执行此操作。我知道它很愚蠢,但它就是这样建造的。昨天我自己也遇到了。
标签: php laravel-5 stripe-payments billing