I am integrating mercadopago into a project with shopping cart and I need that when the user goes to checkout
he can see the list of products with the amount for each one in the checkout
of mercadopago
. So far it shows only the total for all products, but only the name and quantity of the first.
//datos que se encuentran en el arreglo para crear las preferencias
array:1 [//$preference_data
"items" => array:2 [
0 => array:4 [
"title" => "Segundo producto"
"quantity" => 1
"currency_id" => "VEF"
"unit_price" => 3000000.0
]
1 => array:4 [
"title" => "Primer producto"
"quantity" => 1
"currency_id" => "VEF"
"unit_price" => 2500000.0
]
]
]
The above data is created with the next cycle with the products.
$preference_data = [
"items" => []
];
//recorro los productos en la compra y los agrego.
foreach($fact->compras as $i){
$preference_data["items"][] = [
"title" => $i->items->titles->first()->text,
"quantity" => $i->qty,
"currency_id" => "VEF",
"unit_price" => $this->helper()->calcOffer($i->items)
];
}
and finally I think the preference with the arrangement and the products.
$preference = $mp->create_preference ($preference_data);
Finally I show the button with
<a href="{{$preference['response']['sandbox_init_point']}}" name="MP-Checkout" class="lightblue-M-Ov-ArOn" onreturn="execute_my_onreturn">Enviar pago</a>
<script type="text/javascript" src="https://www.mercadopago.com/org-img/jsapi/mptools/buttons/render.js"></script>
this shows "Second product", and the total amount of both products Bs. 5.500.00000
Is it possible to show the most detailed list? like names, quantities, subtotals by products?