как я могу решить эту ошибку или сделать обработку ошибок ??
Laravel \ Cashier \ Exceptions \ SubscriptionCreationFailed с сообщением "Попытка создать подписку на план" ежемесячный usd "для клиента" cus_GbBylIPFPeeM97 "не удалось, так как подписка была неполной. Для получения дополнительной информации о неполных подписках см. https://stripe.com/docs/billing/lifecycle#incomplete"
public function subsrcribeCustomer(Request $request){
$nok = env('PLAN_NOK');
$usd = env('PLAN_USD');
$customer = Customer::find(session('id'));
if($customer->subscribed('main')==false){
// $response = $customer
// ->newSubscription('main', 'plan_FQCahjLGqmbldS')
// ->create($request->stripeToken, [], ['price' => $request->pkg_price]);
if($request->currency == "NOK"){
$unit = 'nok';
try{
$response = $customer
// ->newSubscription('main', 'plan_FTu5ehz6fiXbKt') //live NOK
->newSubscription('main', $nok) //test nok
->create($request->stripeToken, [], ['price' => $request->pkg_price]);
} catch (IncompletePayment $exception) {
return view('customer-billing.plan_payment_cancel_card');
}
}else{
$unit = 'usd';
try {
$response = $customer
// ->newSubscription('main', 'plan_Fg0gT5OZziwo5P') //live USD
->newSubscription('main', $usd) //test nok
->create($request->stripeToken, [], ['price' => $request->pkg_price]);
}
catch (IncompletePayment $exception) {
return view('customer-billing.plan_payment_cancel_card');
}
}
CustomerPayments::customerLicenseUpdate(session('id'));
$braintree_id = $response["stripe_id"];
$pkg_price = $request->pkg_price;
$plan_name = $request->plan_name;
CustomerPayments::saveCustomerPayment(session('id'),$pkg_price, $braintree_id, "Subscription of Basic Plan", $unit);
return view('customer-billing.plan_payment_success', compact('braintree_id','pkg_price','plan_name'));
}else if($customer->subscribed('main')==true){
return view('customer-billing.plan_payment_cancel');
}
}