Skip to content

dnetix/mercadopago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MercadoPago SDK module for Payments integration

Installation

With Composer

From command line

composer require dnetix/mercadopago

As a dependency in your project's composer.json

{
    "require": {
        "dnetix/mercadopago": "0.8.*"
    }
}

Basic checkout

  • Create your application in https://applications.mercadopago.com
  • Set the values for the configuration array (Structure in examples/config.php)
  • Instanciate a MercadoPago object to create a preference. It can be binded to an IoC and create the preference
$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();
  • In your html
    <a href="<?= $preference->initPoint() ?>" name="MP-Checkout" class="">Payment Link</a>
  • And that's all. This process is explained in detail on examples/payment-creation/payment-simple.php

Examples

The examples for the different usage methods such as marketplace charges, payment search, notification handling and others are explained in the examples folder.

About

An SDK developed for interacting with MercadoPago API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages