lib/mercadopago.php
public function get_access_token() {
        if (isset ($this->ll_access_token) && !is_null($this->ll_access_token)) {
            return $this->ll_access_token;
        }

        $app_client_values = array(
            'client_id' => $this->client_id,
            'client_secret' => $this->client_secret,
            'grant_type' => 'client_credentials'
        );

        $access_data = MPRestClient::post(array(
            "uri" => "/oauth/token",
            "data" => $app_client_values,
            "headers" => array(
                "content-type" => "application/x-www-form-urlencoded"
            )
        ));

        if ($access_data["status"] != 200) {
            throw new MercadoPagoException ($access_data['response']['message'], $access_data['status']);
        }

        $this->access_data = $access_data['response'];

        return $this->access_data['access_token'];
    }
public function get_access_token() {
        if (isset ($this->ll_access_token) && !is_null($this->ll_access_token)) {
            return $this->ll_access_token;
        }

        $app_client_values = array(
            'client_id' => $this->client_id,
            'client_secret' => $this->client_secret,
            'grant_type' => 'client_credentials'
        );

        $access_data = MPRestClient::post(array(
            "uri" => "/oauth/token",
            "data" => $app_client_values,
            "headers" => array(
                "content-type" => "application/x-www-form-urlencoded"
            )
        ));

        if ($access_data["status"] != 200) {
            throw new MercadoPagoException ($access_data['response']['message'], $access_data['status']);
        }

        $this->access_data = $access_data['response'];

        return $this->access_data['access_token'];
    }
public function get_access_token ( ) { if ( isset ( $ this -> ll_access_token ) && ! is_null ( $ this -> ll_access_token ) ) { return $ this -> ll_access_token ; } $ app_client_values = array ( 'client_id' => $ this -> client_id , 'client_secret' => $ this -> client_secret , 'grant_type' => 'client_credentials' ) ; $ access_data = MPRestClient :: post ( array ( "uri" => "/oauth/token" , "data" => $ app_client_values , "headers" => array ( "content-type" => "application/x-www-form-urlencoded" ) ) ) ; if ( $ access_data [ "status" ] != 200 ) { throw new MercadoPagoException ( $ access_data [ 'response' ] [ 'message' ] , $ access_data [ 'status' ] ) ; } $ this -> access_data = $ access_data [ 'response' ] ; return $ this -> access_data [ 'access_token' ] ; }
Get Access Token for API use
Get Access Token for API use