Mercado Pago SDK for PHP
This library provides developers with a simple set of bindings to help you integrate Mercado Pago API to a website and start receiving payments.
๐ก Requirements
PHP 5.6, 7.1 or higher
๐ป Installation
First time using Mercado Pago? Create your Mercado Pago account, if you donโt have one already.
-
Download Composer if not already installed
-
On your project directory run on the command line
composer require "mercadopago/dx-php:2.5.3"
for PHP7 orcomposer require "mercadopago/dx-php:1.12.5"
for PHP5.6. -
Copy the access_token in the credentials section of the page and replace YOUR_ACCESS_TOKEN with it.
That's it! Mercado Pago SDK has been successfully installed.
๐ Getting Started
Simple usage looks like:
<?php
require_once 'vendor/autoload.php'; // You have to require the library from your Composer vendor folder
MercadoPago\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); // Either Production or SandBox AccessToken
$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;
?>
๐ Documentation
Visit our Dev Site for further information regarding:
- Payments APIs: Spanish / Portuguese
- Mercado Pago checkout: Spanish / Portuguese
- Web Tokenize checkout: Spanish / Portuguese
Check our official code reference to explore all available functionalities.
โค๏ธ Support
If you require technical support, please contact our support team at developers.mercadopago.com
๐ป License
MIT license. Copyright (c) 2018 - Mercado Pago / Mercado Libre
For more information, see the LICENSE file.