diff --git a/src/Services/PayPal.php b/src/Services/PayPal.php index 92559786..ddc72c03 100644 --- a/src/Services/PayPal.php +++ b/src/Services/PayPal.php @@ -38,17 +38,11 @@ public function __construct(array $config = []) protected function setOptions(array $credentials): void { // Setting API Endpoints - $this->config['api_url'] = 'https://api-m.paypal.com'; + $sandbox = ($this->mode === 'sandbox') ? '.sandbox' : ''; + $this->config['api_url'] = "https://api-m{$sandbox}.paypal.com"; - $this->config['gateway_url'] = 'https://www.paypal.com'; - $this->config['ipn_url'] = 'https://ipnpb.paypal.com/cgi-bin/webscr'; - - if ($this->mode === 'sandbox') { - $this->config['api_url'] = 'https://api-m.sandbox.paypal.com'; - - $this->config['gateway_url'] = 'https://www.sandbox.paypal.com'; - $this->config['ipn_url'] = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'; - } + $this->config['gateway_url'] = "https://www{$sandbox}.paypal.com"; + $this->config['ipn_url'] = "https://ipnpb{$sandbox}.paypal.com/cgi-bin/webscr"; // Adding params outside sandbox / live array $this->config['payment_action'] = $credentials['payment_action']; diff --git a/src/Traits/PayPalAPI.php b/src/Traits/PayPalAPI.php index 9de4d958..a1c40429 100644 --- a/src/Traits/PayPalAPI.php +++ b/src/Traits/PayPalAPI.php @@ -129,7 +129,7 @@ public function setCurrentPage(int $page): PayPalClient */ public function showTotals(bool $totals): PayPalClient { - $this->show_totals = $totals ? "true" : "false"; + $this->show_totals = $totals ? 'true' : 'false'; return $this; }