cobroinmediato / pagospyme-sdk-public-api-php
1.2.13
2021-07-20 06:54 UTC
Requires
- php: >=5.5.0
- doctrine/annotations: ^1.4
- doctrine/common: ~2.6
Requires (Dev)
- doctrine/orm: ~2.3
- phpmd/phpmd: @stable
- phpunit/phpunit: ^5
- sebastian/phpcpd: *
- squizlabs/php_codesniffer: 2.3.*
- symfony/yaml: ~2.5
- vlucas/phpdotenv: ^2.5
README
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
- Download Composer if not already installed
- Go to your project directory and run
composer require "cobroinmediato/pagospyme-sdk-public-api-php"
on the command line. - This how your directory structure would look like.
- Thats all, you have Mercado Pago SDK installed.
Quick Start
- You have to require the library from your Composer vendor folder.
require __DIR__ . '/vendor/autoload.php';
- Setup your credentials
You have two types of credentials:
- For API or custom checkout:
PagosPyme\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); // On Production PagosPyme\SDK::setAccessToken("YOUR_TEST_ACCESS_TOKEN"); // On Sandbox
- For Web-checkout:
PagosPyme\SDK::setClientId("YOUR_CLIENT_ID"); PagosPyme\SDK::setClientSecret("YOUR_CLIENT_SECRET");
- 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:
Sample
<?php require __DIR__ . '/vendor/autoload.php'; PagosPyme\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); $payment = new PagosPyme\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" => "larue.nienow@hotmail.com" ); echo $payment->status; ?>