Problem when wanting to pay market payment in sandbox mode with php

1

I am trying to make the fictitious payment of the payment market in sandbox mode with easy payment, when I return the payment codes, I go to the easy payment I tell the cashier and it says something like "code not valid", this is the code that I'm using.

<?php 
session_start();

require_once ("sdk-php-master/lib/mercadopago.php");

$mp = new MP("inserto aqui mi client_id", "inserto aqui mi client_Secret");

$preference_data = array(
"items" => array(
    array(
        "title" => "Productos Cubiertas Oeste",
        "currency_id" => "ARG",
        "category_id" => "Category",
        "quantity" => 1,
        "unit_price" => (float)$_POST['total']
    )
),
"payer" => array(
        "name" => $_POST['nombre'],
        "surname" => $_POST['apellido'],
        "email" => $_POST['email'],
        "date_created" => "2017-03-15",
        ),
"phone" => array(
        "area_code" => $_POST['cod_area'],
        "number" => $_POST['telefono']
),
"identification" => array(
        "type" => $_POST['tipo_dni'],
        "number" => $_POST['dni']
),
);

$preference = $mp->create_preference($preference_data);
?>
<html lang="en">
<head>
...
</head>
<body>
    <a href="<?php echo $preference["response"]["sandbox_init_point"]; ?>"    name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a>
    <script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script>

The data of the multi dimensional array I bring from a form of another page with the POST method as you can see. I do not think it is necessary to insert here the html code of the form.

Everything is fine, my problem is simply at the time of payment.

Greetings !!

    
asked by rodrigo1990 15.03.2017 в 23:07
source

0 answers