I need to know how I integrate a product id to the payment button and how it informs me then Mercado pago.
I enclose image to explain better. I have coupon listings, everyone must carry their ID to be able to identify it later.
Ok, from what I understand, you need to assign a type of "id" to the buttons or coupons you're listing.
What you have to do is one of two, generate the id of your object from your backend and concatenate it in the "id" attribute of your HTML:
<?php
$pagos_ids = array('17625', '2882', '66244');
foreach( $pagos_ids as $pago_id ){
echo '<a href="mi-enlace" id="mi-boton-de-pago-generado--pagar-' . $pago_id . '">Pagar</a>';
}
The rendered result
<a href="un-enlace" id="mi-boton-de-pago-generado--pagar-id-17625">Pagar</a>
<a href="un-enlace" id="mi-boton-de-pago-generado--pagar-id-2882">Pagar</a>
<a href="un-enlace" id="mi-boton-de-pago-generado--pagar-id-66244">Pagar</a>
If you're not comfortable with using the "id" attribute, you can use the "data" attribute:
<a href="un-enlace" data-pago-id="mi-boton-de-pago-generado--pagar-id-17625">Pagar</a>
<a href="un-enlace" data-pago-id="mi-boton-de-pago-generado--pagar-id-2882">Pagar</a>
<a href="un-enlace" data-pago-id="mi-boton-de-pago-generado--pagar-id-66244">Pagar</a>
Remember, those ids are generated from your PHP, and since they are generated, then you can manipulate those ids with JavaScript.
I hope I have answered your answer. Greetings.