diff --git a/src/Traits/PayPalAPI/Subscriptions/Helpers.php b/src/Traits/PayPalAPI/Subscriptions/Helpers.php index 8b65faa2..cb3a7a9e 100644 --- a/src/Traits/PayPalAPI/Subscriptions/Helpers.php +++ b/src/Traits/PayPalAPI/Subscriptions/Helpers.php @@ -48,6 +48,11 @@ trait Helpers */ protected $taxes; + /** + * @var string + */ + protected $custom_id; + /** * Setup a subscription. * @@ -93,6 +98,10 @@ public function setupSubscription(string $customer_name, string $customer_email, $body['taxes'] = $this->taxes; } + if (isset($this->custom_id)) { + $body['custom_id'] = $this->custom_id; + } + $subscription = $this->createSubscription($body); unset($this->product); @@ -475,4 +484,18 @@ public function addTaxes(float $percentage) return $this; } + + /** + * Add custom id. + * + * @param string $custom_id + * + * @return \Srmklive\PayPal\Services\PayPal + */ + public function addCustomId(string $custom_id) + { + $this->custom_id = $custom_id; + + return $this; + } } diff --git a/src/Traits/PayPalVerifyIPN.php b/src/Traits/PayPalVerifyIPN.php index cff1437d..63478683 100644 --- a/src/Traits/PayPalVerifyIPN.php +++ b/src/Traits/PayPalVerifyIPN.php @@ -36,7 +36,7 @@ public function verifyIPN(\Illuminate\Http\Request $request) return ['error' => 'Invalid headers or webhook id provided']; } - $params = $request->all(); + $params = json_decode($request->getContent()); $payload = [ 'auth_algo' => $headers['PAYPAL-AUTH-ALGO'][0],