Giter Site home page Giter Site logo

dx-php's Introduction

Mercado Pago SDK for PHP

Build Status

This library provides developers with a simple set of bindings to the Mercado Pago API.

PHP Versions Supported:

The SDK supports PHP 5.6 or major

Installation

Using Composer

  1. Download Composer if not already installed
  2. Go to your project directory and run composer require "mercadopago/dx-php:1.2.1" on the command line.
  3. This how your directory structure would look like.
  4. Thats all, you have Mercado Pago SDK installed.

installation-demo

Quick Start

  1. You have to require the library from your Composer vendor folder.
require __DIR__  . '/vendor/autoload.php';
  1. Setup your credentials

You have two types of credentials:

  • For API or custom checkout:
    MercadoPago\SDK::setAccessToken("YOUR_ACCESS_TOKEN");      // On Production
    MercadoPago\SDK::setAccessToken("YOUR_TEST_ACCESS_TOKEN"); // On Sandbox
  • For Web-checkout:
    MercadoPago\SDK::setClientId("YOUR_CLIENT_ID");
    MercadoPago\SDK::setClientSecret("YOUR_CLIENT_SECRET");
  1. Using resource objects.

You can interact with all the resources available in the public API, to this each resource is represented by classes according to the following diagram:

sdk resource structure

Sample

  <?php
  
    require __DIR__  . '/vendor/autoload.php';

    MercadoPago\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]"
    );
 
    echo $payment->status;
    
  ?>

Support

Write us at developers.mercadopago.com

dx-php's People

Contributors

ahoulgrave avatar bachilli avatar dann95 avatar fgilio avatar imasson avatar joelibaceta avatar juaniveltri avatar matiasgualino avatar mminestrelli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.