As indicated by the documentation associated with this change: link
The changes correspond to the way in which payments are notified, if in your code the payment ids are being used to validate if a payment is credited then this could cause your site to fail.
Summary
+---------+--------------------------------------------+------------------------+------------------------+
| Intento | Descripción | Version Actual | Nueva Version |
+---------+--------------------------------------------+------------------------+------------------------+
| 1 | Cliente intenta realizar un | payment_id: 1223456742 | payment_id: 1239084567 |
| | pago con su tarjeta de crédito. | status=rejected | status=rejected |
| | La transacción es rechazada | | |
| | por fondos insuficientes. | |
| 2 | Tu cliente vuelve a intentar con Rapipago. | payment_id: 1223456742 | payment_id: 5432123343 |
| | | status=pending | status=pending |
| 2 | Tu cliente va a Rapipago | payment_id: 1223456742 | payment_id: 5432123343 |
| | y completa el pago. | status=approved | status=approved |
+---------+--------------------------------------------+------------------------+------------------------+
A PHP code snippet to process the IPN would be
<?php
require_once "mercadopago.php";
$mp = new MP("3964826791704277", "TcLhELCaYEFzm522gJxua6tBRf0VbSMd");
if (!isset($_GET["id"], $_GET["topic"]) || !ctype_digit($_GET["id"])) {
http_response_code(400);
return;
}
// Get the payment and the corresponding merchant_order reported by the IPN.
if($_GET["topic"] == 'payment'){
$payment_info = $mp->get("/collections/notifications/" . $_GET["id"]);
$merchant_order_info = $mp->get("/merchant_orders/" . $payment_info["response"]["collection"]["merchant_order_id"]);
// Get the merchant_order reported by the IPN.
} else if($_GET["topic"] == 'merchant_order'){
$merchant_order_info = $mp->get("/merchant_orders/" . $_GET["id"]);
}
if ($merchant_order_info["status"] == 200) {
// If the payment's transaction amount is equal (or bigger) than the merchant_order's amount you can release your items
$paid_amount = 0;
foreach ($merchant_order_info["response"]["payments"] as $payment) {
if ($payment['status'] == 'approved'){
$paid_amount += $payment['transaction_amount'];
}
}
if($paid_amount >= $merchant_order_info["response"]["total_amount"]){
if(count($merchant_order_info["response"]["shipments"]) > 0) { // The merchant_order has shipments
if($merchant_order_info["response"]["shipments"][0]["status"] == "ready_to_ship"){
print_r("Totally paid. Print the label and release your item.");
}
} else { // The merchant_order don't has any shipments
print_r("Totally paid. Release your item.");
}
} else {
print_r("Not paid yet. Do not release your item.");
}
}
?>
If you use any eCommerce plugin / module / extension supported by
MercadoPago ( link ), the
latest version of each plugin / module / extension available before
September should have support for this change so only
you should do an update.