diff --git a/src/Traits/PayPalAPI/Subscriptions/Helpers.php b/src/Traits/PayPalAPI/Subscriptions/Helpers.php index 0b5333f9..4cd49eb0 100644 --- a/src/Traits/PayPalAPI/Subscriptions/Helpers.php +++ b/src/Traits/PayPalAPI/Subscriptions/Helpers.php @@ -398,7 +398,11 @@ protected function addBillingPlan(string $name, string $description, array $bill ], ]; - $this->billing_plan = $this->createPlan($plan_params, $request_id); + $billingPlan = $this->createPlan($plan_params, $request_id); + if ($error = data_get($billingPlan, 'error', false)) { + throw new \RuntimeException(data_get($error, 'details.0.description', 'Failed to add billing plan')); + } + $this->billing_plan = $billingPlan; } /**