Skip to content

Commit

Permalink
Add custom id for invoice id (#603)
Browse files Browse the repository at this point in the history
* Add custom id for invoice id
  • Loading branch information
buzzclue authored Feb 19, 2024
1 parent b3ac557 commit dc680c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/Traits/PayPalAPI/Subscriptions/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ trait Helpers
*/
protected $taxes;

/**
* @var string
*/
protected $custom_id;

/**
* Setup a subscription.
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/Traits/PayPalVerifyIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit dc680c6

Please sign in to comment.