Download the PHP package puntodev/mercadopago-fake without Composer

On this page you can find all versions of the php package puntodev/mercadopago-fake. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mercadopago-fake

mercadopago-fake

A fake MercadoPago API server for testing Laravel applications. It replaces the real puntodev/mercadopago client with a mock implementation that simulates the full checkout flow without hitting the MercadoPago API.

Installation

Activation

Set the environment variable in your .env or phpunit.xml:

The service provider auto-registers and swaps the MercadoPago binding in the container with MercadoPagoFake.

How It Works

The library has four main parts:

MercadoPagoFake

Implements MercadoPago and manages global test state. Stores preferences, payments, and merchant orders in a file-based cache, records method calls for assertions, and provides a reset() method to clean up between tests.

MercadoPagoFakeApi

Implements MercadoPagoApi with mock implementations:

FakeCheckoutController

Exposes HTTP routes that simulate MercadoPago's checkout UI:

Method Route Description
GET /mercadopago-fake/checkout/{preferenceId} Displays a styled checkout page with Pay, Decline, and Cancel buttons
POST /mercadopago-fake/checkout/{preferenceId}/approve Simulates approval and posts a webhook (IPN) to your app's notification_url
POST /mercadopago-fake/checkout/{preferenceId}/decline Marks the payment as declined and redirects to the failure URL
GET /mercadopago-fake/checkout/{preferenceId}/cancel Redirects to the failure back URL

MercadoPagoFakeServiceProvider

When MERCADOPAGO_USE_FAKE is true, it binds MercadoPagoFake as a singleton in place of MercadoPago, registers the checkout routes, and loads the Blade views.

Checkout Flow

Usage

Automated Tests

Manual Browser Testing

Start your Laravel app with MERCADOPAGO_USE_FAKE=true and navigate to the init_point URL returned by createPaymentPreference(). The checkout page lets you click Pay, Decline, or Cancel to test the full flow, including IPN webhooks hitting your application.

Test Helpers

Method Description
MercadoPagoFake::storePreference($id, $preference) Store a preference in the fake cache
MercadoPagoFake::getStoredPreference($id) Retrieve a stored preference
MercadoPagoFake::storePayment($id, $payment) Store a payment in the fake cache
MercadoPagoFake::getStoredPayment($id) Retrieve a stored payment
MercadoPagoFake::storeMerchantOrder($id, $order) Store a merchant order in the fake cache
MercadoPagoFake::getStoredMerchantOrder($id) Retrieve a stored merchant order
MercadoPagoFake::markPaymentAsDeclined($id) Mark a payment as declined
MercadoPagoFake::isPaymentDeclined($id) Check if a payment is declined
MercadoPagoFake::recordCall($method, $args) Record a method call
MercadoPagoFake::getCalls($method) Get recorded calls, optionally filtered by method
MercadoPagoFake::reset() Clear all stored state and recorded calls

Development

Code style is enforced with Laravel Pint (laravel preset, see pint.json). The test suite is fully isolated — it never reaches the network, so no MercadoPago credentials are required.

Please run composer format before opening a pull request. See CONTRIBUTING.md for the full contribution guide.

Requirements

Changelog

See CHANGELOG.md for the list of changes per version.

Releases are cut from GitHub's "Generate release notes" button (grouping configured in .github/release.yml). When a release is published, the update-changelog workflow writes its notes into CHANGELOG.md and commits them back to main.


All versions of mercadopago-fake with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
illuminate/support Version ^13.0
puntodev/mercadopago Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package puntodev/mercadopago-fake contains the following files

Loading the files please wait ...