reyesoft / mercadopago
This library helps to make payments through MercadoPago, even with QR
Installs: 14 620
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 2
Requires
- php: >=8.2
- mercadopago/dx-php: 3.0.8
Requires (Dev)
- phpunit/phpunit: ^10.2
- reyesoft/ci: ^2.0
- v3.0.x-dev
- 3.0.2
- 3.0.0
- v1.1.x-dev
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- v1.0.x-dev
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- v0.0.x-dev
- 0.0.2
- 0.0.1
- dev-fix/repeated-code-and-resource-extends
- dev-feat/dynamic-qr-tramma
- dev-v1_to_v3
- dev-v3.0_dd
- dev-changed/upgrade-qr-code-lbrary
- dev-fix/deprecated-doctrine-annotation-dx-bump
- dev-fix/doctrine-inflector
- dev-dx-bump
- dev-bump/dx-php
- dev-changed/dx-php-2.2.3
- dev-dx-php-1.7.3-updated-with-fix
- dev-dx-php-updated-with-psr-4-fixes
- dev-fix-dev-mercadopago-dx-php
- dev-migration-to-mercadopago-dx-php
- dev-feature/order_qr
- dev-readme-description
- dev-readme-gitignore
- dev-fix-circleci
This package is auto-updated.
Last update: 2024-11-26 15:53:02 UTC
README
This library extend API entrypoints of mercadopago/dx-php, like Instore V2, Qr Tramma, and Store Client.
Installation
composer require reyesoft/mercadopago
Usage
Usage it's the same of mercadopago/dx-php, but with some new features and extensions. Like...
Creating and handling a Pos
MercadoPagoConfig::setAccessToken('YOUR_ACCESS_TOKEN']); $store = (new StoreClient())->create( $params->getUserId(), [ 'name' => 'Reyesoft Point', 'business_hours' => [ 'wednesday' => [ [ 'open' => '00:00', 'close' => '23:59', ], ], ], 'external_id' => 'your_store_external_id', 'location' => [ 'street_number' => '3039', 'street_name' => 'Caseros', 'city_name' => 'Belgrano', 'state_name' => 'Capital Federal', 'latitude' => -32.8897322, 'longitude' => -68.8443275, 'reference' => '3er Piso', ], ] );
You can get MercadoPago credentials from https://www.mercadopago.com/mla/account/credentials
Showing a Point Of Sale QR
$pos = new MercadoPagoPos('your_pos_external_id'); $qr_content = $pos->getQrContent(); // just an example, this is Endroid\QrCode library $qr_code = new QrCode($qr_content); $qr_code->setText($qr_content); echo $qr_code->getDataUri();
Putting a order in a Point Of Sale
(new InstoreOrderV2())->create( 'your_mercadopago_user_id', 'your_store_external_id', 'your_pos_external_id', [ 'external_reference' => '#' . $your_order_id, 'title' => 'Order ' . $your_order_id, 'description' => 'Your proyects', 'notification_url' => 'https://yourserver.com/endpoint', 'total_amount' => 100.10, 'expiration_date' => today()->addDays(7)->format('Y-m-d\TH:i:s.vP'), 'items' => [ [ 'title' => 'Your lovely product', 'id' => '#' . $your_order_id, 'external_reference' => '#' . $your_order_id, 'quantity' => 1, 'unit_measure' => 'unit', 'currency_id' => 'ARS', 'unit_price' => 100.10, 'total_amount' => 100.10, 'picture_url' => 'https://yourserver.com/image.jpg', ], ], ] );
Images
docker run -it --rm --name php82 -e PHP_EXTENSIONS="" -v "$PWD":/usr/src/app pablorsk/laravel-json-api:8.2 bash