Fix subscription retrieval and handle missing subscriptions
This commit is contained in:
parent
e1468da36a
commit
fed01fa9d2
1 changed files with 5 additions and 1 deletions
|
|
@ -861,7 +861,11 @@
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
if (!$subscription) {
|
if (!$subscription) {
|
||||||
Sleep::for(5)->seconds();
|
Sleep::for(5)->seconds();
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
|
}
|
||||||
|
if (!$subscription) {
|
||||||
|
send_internal_notification('No subscription found for: ' . $customerId);
|
||||||
|
return response("No subscription found", 400);
|
||||||
}
|
}
|
||||||
$trialEndedAlready = data_get($subscription, 'stripe_trial_already_ended');
|
$trialEndedAlready = data_get($subscription, 'stripe_trial_already_ended');
|
||||||
$cancelAtPeriodEnd = data_get($data, 'cancel_at_period_end');
|
$cancelAtPeriodEnd = data_get($data, 'cancel_at_period_end');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue