I receive Malformed access_token: null in API MercadoPago

1

This is the code I am using (made from example provided on the web of mercadopago ):

require_once ( 'mercadopago.php');
$mp = new MP('xxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxx');

$params = array(
    "dimensions" => "30x30x30,500",
    "zip_code" => "5700",
    "item_price"=>"100.58",
    "free_method" => "73328" // optional
);

$response = $mp->get("/shipping_options", $params);
print_r($response);

I am getting the following error in the print_r($response) when trying to connect with the mercadopago API, specifically to $mp->get("/shipping_options", $params); :

Array ( 
        [status] => 400 
        [response] => Array ( 
                              [message] => Malformed access_token: null 
                              [error] => bad_request 
                              [status] => 400 
                              [cause] => Array ( ) 
                            ) 
)

Does anyone know what happens? How can I solve this problem?

    
asked by Jennifer Arias 31.03.2017 в 18:29
source

1 answer

0

You are actually receiving that answer because you are not sending the token, you are sending your client_key and client_secret.

    
answered by 23.05.2017 в 08:06