PHP code example of dnetix / mercadopago
1. Go to this page and download the library: Download dnetix/mercadopago library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dnetix / mercadopago example snippets
$mercadopago = Dnetix\MercadoPago\MercadoPago::load($config);
$preference = $mercadoPago->addItem([
'id' => 'PRODUCT_ID',
'title' => 'PRODUCT_TITLE',
'description' => 'PRODUCT_DESCRIPTION',
'quantity' => 1,
'unit_price' => 10000,
'picture_url' => 'OPTIONAL_URL_IMAGE_OF_PRODUCT',
])
->addExternalReference('OPTIONAL_EXTERNAL_REFERENCE')
->createPreference();
html
<a href="<?= $preference->initPoint()