diff --git a/src/Traits/PayPalAPI/Subscriptions/Helpers.php b/src/Traits/PayPalAPI/Subscriptions/Helpers.php index ecba57c1..3bc60833 100644 --- a/src/Traits/PayPalAPI/Subscriptions/Helpers.php +++ b/src/Traits/PayPalAPI/Subscriptions/Helpers.php @@ -66,11 +66,8 @@ trait Helpers */ public function setupSubscription(string $customer_name, string $customer_email, string $start_date = '') { - $start_date = !empty($start_date) ? Carbon::parse($start_date)->toIso8601String() : Carbon::now()->toIso8601String(); - $body = [ 'plan_id' => $this->billing_plan['id'], - 'start_time' => $start_date, 'quantity' => 1, 'subscriber' => [ 'name' => [ @@ -80,6 +77,10 @@ public function setupSubscription(string $customer_name, string $customer_email, ], ]; + if (!empty($start_date)) { + $body['start_time'] = Carbon::parse($start_date)->toIso8601String(); + } + if ($this->has_setup_fee) { $body['plan'] = [ 'payment_preferences' => $this->payment_preferences,