public function setCurrency($currency = 'USD')
    {
        $allowedCurrencies = ['AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'INR', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'USD', 'RUB'];

        // Check if provided currency is valid.
        if (!in_array($currency, $allowedCurrencies)) {
            throw new \Exception('Currency is not supported by PayPal.');
        }

        $this->currency = $currency;

        return $this;
    }
public function setCurrency($currency = 'USD')
    {
        $allowedCurrencies = ['AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'INR', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'USD', 'RUB'];

        // Check if provided currency is valid.
        if (!in_array($currency, $allowedCurrencies)) {
            throw new \Exception('Currency is not supported by PayPal.');
        }

        $this->currency = $currency;

        return $this;
    }
public function setCurrency ( $ currency = 'USD' ) { $ allowedCurrencies = [ 'AUD' , 'BRL' , 'CAD' , 'CZK' , 'DKK' , 'EUR' , 'HKD' , 'HUF' , 'ILS' , 'INR' , 'JPY' , 'MYR' , 'MXN' , 'NOK' , 'NZD' , 'PHP' , 'PLN' , 'GBP' , 'SGD' , 'SEK' , 'CHF' , 'TWD' , 'THB' , 'USD' , 'RUB' ] ; // Check if provided currency is valid. if ( ! in_array ( $ currency , $ allowedCurrencies ) ) { throw new \ Exception ( 'Currency is not supported by PayPal.' ) ; } $ this -> currency = $ currency ; return $ this ; }
Function to set currency.

@param string $currency

@throws \Exception

@return $this
Function to set currency .