PHP code example of codions / laravel-mercadopago
1. Go to this page and download the library: Download codions/laravel-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/ */
codions / laravel-mercadopago example snippets
MercadoPago\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); // On Production
MercadoPago\SDK::setAccessToken("YOUR_TEST_ACCESS_TOKEN"); // On Sandbox
MercadoPago\SDK::setClientId("YOUR_CLIENT_ID");
MercadoPago\SDK::setClientSecret("YOUR_CLIENT_SECRET");
go\SDK::setAccessToken("YOUR_ACCESS_TOKEN");
$payment = new MercadoPago\Payment();
$payment->transaction_amount = 141;
$payment->token = "YOUR_CARD_TOKEN";
$payment->description = "Ergonomic Silk Shirt";
$payment->installments = 1;
$payment->payment_method_id = "visa";
$payment->payer = array(
"email" => "[email protected]"
);
$payment->save();
echo $payment->status;