src/PaymentGateway.php
public function create($orderId, $price, $description = '', $currency = 'IRR', $merchantCur = 'IRR')
    {

        // Clear the error variable
        $this->error = '';

        $orderId = (string)$orderId;

        /**
         * Check value is string
         * If validation functions return false, it will be set error message on error variable
         */
        if (
            !self::__validateString($orderId, 1, 50) ||
            !self::__validateNumeric($price, 1, 20) ||
            !self::__validateString($description, 0, 255)
        )
            return false;

        $param = array(
            "apikey" => $this->apiKey,
            "mobile" => $this->mobile,
            "description" => $description,
            "orderId" => $orderId,
            "merchantCur" => $merchantCur,
            "currency" => $currency,
            "price" => (string)$price
        );

        $result = self::__sendRequest('invoice', 'POST', $param);


        // if response code is 200 return the response value
        if ($result->code === 200) {
            if (isset($result->response->qr))
                unset($result->response->qr);

            return $result->response;

        } else if ($result->code == 0) { // if response code is 0 return false and set error message
            $this->error = $result->response;
            return false;
        } else { //Get error massage and return false
            if (isset($result->response->description) && !is_null($result->response->description))
                $this->error = $result->response->description;
            else if (isset($result->response->message) && !is_null($result->response->message))
                $this->error = $result->response->message;

            return false;
        }
    }
public function create($orderId, $price, $description = '', $currency = 'IRR', $merchantCur = 'IRR')
    {

        // Clear the error variable
        $this->error = '';

        $orderId = (string)$orderId;

        /**
         * Check value is string
         * If validation functions return false, it will be set error message on error variable
         */
        if (
            !self::__validateString($orderId, 1, 50) ||
            !self::__validateNumeric($price, 1, 20) ||
            !self::__validateString($description, 0, 255)
        )
            return false;

        $param = array(
            "apikey" => $this->apiKey,
            "mobile" => $this->mobile,
            "description" => $description,
            "orderId" => $orderId,
            "merchantCur" => $merchantCur,
            "currency" => $currency,
            "price" => (string)$price
        );

        $result = self::__sendRequest('invoice', 'POST', $param);


        // if response code is 200 return the response value
        if ($result->code === 200) {
            if (isset($result->response->qr))
                unset($result->response->qr);

            return $result->response;

        } else if ($result->code == 0) { // if response code is 0 return false and set error message
            $this->error = $result->response;
            return false;
        } else { //Get error massage and return false
            if (isset($result->response->description) && !is_null($result->response->description))
                $this->error = $result->response->description;
            else if (isset($result->response->message) && !is_null($result->response->message))
                $this->error = $result->response->message;

            return false;
        }
    }
public function create ( $ orderId , $ price , $ description = '' , $ currency = 'IRR' , $ merchantCur = 'IRR' ) { // Clear the error variable $ this -> error = '' ; $ orderId = ( string ) $ orderId ; /**
         * Check value is string
         * If validation functions return false, it will be set error message on error variable
         */ if ( ! self :: __validateString ( $ orderId , 1 , 50 ) || ! self :: __validateNumeric ( $ price , 1 , 20 ) || ! self :: __validateString ( $ description , 0 , 255 ) ) return false ; $ param = array ( "apikey" => $ this -> apiKey , "mobile" => $ this -> mobile , "description" => $ description , "orderId" => $ orderId , "merchantCur" => $ merchantCur , "currency" => $ currency , "price" => ( string ) $ price ) ; $ result = self :: __sendRequest ( 'invoice' , 'POST' , $ param ) ; // if response code is 200 return the response value if ( $ result -> code === 200 ) { if ( isset ( $ result -> response -> qr ) ) unset ( $ result -> response -> qr ) ; return $ result -> response ; } else if ( $ result -> code == 0 ) { // if response code is 0 return false and set error message $ this -> error = $ result -> response ; return false ; } else { //Get error massage and return false if ( isset ( $ result -> response -> description ) && ! is_null ( $ result -> response -> description ) ) $ this -> error = $ result -> response -> description ; else if ( isset ( $ result -> response -> message ) && ! is_null ( $ result -> response -> message ) ) $ this -> error = $ result -> response -> message ; return false ; } }
Create the payment invoice and return the gateway url

@param  string | integer $orderId
@param integer           $price
@param string            $description
@param string            $currency payer currency
@param string            $merchantCur merchant currency

@return mixed  false|response object
@throws \Exception
Create the payment invoice and return the gateway url