Problem with IPN

0

I am setting up a project in laravel 5.4. Now integrate the marketpay sdk and configure the notification url with a test user.

To perform a basic checkout, I first create the preferences:

        $preference_data = array(
        "items" => $items,
        "payer" => array(
            "name" => 'TEST_Name',
            "surname" => 'TEST_surname',
            "email" => '[email protected]',
            "phone" => array(
                "number" => 'TEST_351471'
            ),
            "address" => array(
                "zip_code" => 'TEST_zipcode',
                "street_name" => 'TEST_street',
                "street_number" => intval('123')
            )

        ),//TODO Replace hardoced urls
        "notification_url" => /*url*/,
        "auto_return" => "all",
        //TODO remove hardcoded order id.
        "external_reference" => base64_encode(json_encode(['order_id' => '123'])),
    );

then instantiate an MP object and call the function create_preference ()

$mp = new \MP(Config::get('mpago.client_id'),Config::get('mpago.client_secret'));
$preference = $mp->create_preference($preference_data);

return redirect()->to($preference['response']['sandbox_init_point']);

Until here everything is perfect. Now the problem is that when the payment market notifies me, the following happens:

As soon as you start the checkout, you send me a notification with the parameters id and the topic "merchant_order", with this I can bring the info quietly but as the checkout just starts it does not help me at all.

once the checkout process is finished, send me another notification but with the following parameters:

{
    "data": {
        "id": "3980044"
    },
    "date_created": "2017-06-16T16:34:14.000-04:00",
    "type": "payment",
    "api_version": "v1",
    "id": 170178729,
    "action": "payment.created",
    "user_id": 260874864,
    "live_mode": false,
    "data_id": "3980044"
}

Now when I try to bring the payment_info (probe with sandbox in true and false) it always returns "not_found", either using the id or the data_id, so I do not know how to update the status of my order from this point.

    
asked by Cnovarino 16.06.2017 в 23:05
source

1 answer

0

The Sandbox is the problem. It happened to me and once I made sure that everything worked more or less well, I opted to use my card with the check account real payment, and that way I am sure that the data it brings are the same as I am going to have. in production. I used approximately 7 or 8 payments of $ 1 until I had it working, so it's not worth using the sandbox ...

    
answered by 26.11.2018 в 13:50