目前,我可以检索具有有效订阅的Stripe客户,但我还想检索其他订阅状态,例如unpaid,past_due和cancelled。
$customer = \Stripe\Customer::retrieve( $customer_id );
$customer_subscriptions_list = $customer->subscriptions->all(array())['data'];
$customer_subscriptions = array ();
foreach ($customer_subscriptions_list as $customer_subscription) {
$customer_subscriptions[] = $customer->subscriptions->retrieve( $customer_subscription['id'] );
}
return $customer_subscriptions;
有什么方法可以解决这个问题吗?
答案 0 :(得分:0)
foreach ($customer_subscriptions as $customer_subscription){
if($customer_subscription->status == "past_due" || $customer_subscription->status == "unpaid"){
existing code
}
我的错误我认为/ stripe / customer只检索Active订阅。我已将订阅从“Active”更改为“un_paid”,然后代码工作正常。