diff --git a/src/Traits/PayPalAPI/Subscriptions/Helpers.php b/src/Traits/PayPalAPI/Subscriptions/Helpers.php index cb3a7a9e..0b5333f9 100644 --- a/src/Traits/PayPalAPI/Subscriptions/Helpers.php +++ b/src/Traits/PayPalAPI/Subscriptions/Helpers.php @@ -103,6 +103,8 @@ public function setupSubscription(string $customer_name, string $customer_email, } $subscription = $this->createSubscription($body); + $subscription['billing_plan_id'] = $this->billing_plan['id']; + $subscription['product_id'] = $this->product['id']; unset($this->product); unset($this->billing_plan); @@ -295,7 +297,7 @@ protected function addPlanBillingCycle(string $interval_unit, int $interval_coun } return [ - 'frequency' => [ + 'frequency' => [ 'interval_unit' => $interval_unit, 'interval_count' => $interval_count, ], @@ -327,10 +329,10 @@ public function addProduct(string $name, string $description, string $type, stri $request_id = Str::random(); $this->product = $this->createProduct([ - 'name' => $name, - 'description' => $description, - 'type' => $type, - 'category' => $category, + 'name' => $name, + 'description' => $description, + 'type' => $type, + 'category' => $category, ], $request_id); return $this; @@ -452,16 +454,16 @@ public function addSetupFee(float $price): \Srmklive\PayPal\Services\PayPal public function addShippingAddress(string $full_name, string $address_line_1, string $address_line_2, string $admin_area_2, string $admin_area_1, string $postal_code, string $country_code): \Srmklive\PayPal\Services\PayPal { $this->shipping_address = [ - 'name' => [ + 'name' => [ 'full_name' => $full_name, ], 'address' => [ - 'address_line_1' => $address_line_1, - 'address_line_2' => $address_line_2, - 'admin_area_2' => $admin_area_2, - 'admin_area_1' => $admin_area_1, - 'postal_code' => $postal_code, - 'country_code' => $country_code, + 'address_line_1' => $address_line_1, + 'address_line_2' => $address_line_2, + 'admin_area_2' => $admin_area_2, + 'admin_area_1' => $admin_area_1, + 'postal_code' => $postal_code, + 'country_code' => $country_code, ], ];