Configuration Issues
Mercado Pago access token is not configured
Mercado Pago access token is not configured
Error Message:Cause:
The package cannot find the
MERCADOPAGO_ACCESS_TOKEN environment variable.Solution:-
Add the access token to your
.envfile: -
Clear the configuration cache:
-
Verify the configuration:
Package is installed but routes don't appear
Package is installed but routes don't appear
Symptoms:
- Running
php artisan route:list --name=mercadopagoshows no routes - Requests to
/api/mercadopago/*return 404
-
Regenerate the package discovery cache:
-
Clear the route cache:
-
Verify routes are registered:
If using route caching in production, regenerate it with:
Demo Routes Issues
404 error on demo routes
404 error on demo routes
Error:
Demo routes like
/api/mercadopago/health or /api/mercadopago/preferences return 404.Cause:
Demo routes are protected by the EnsureDemoRoutesEnabled middleware and only work when both conditions are met:MERCADOPAGO_ENABLE_DEMO_ROUTES=true- Application environment is
localortesting
-
Check your
.envfile: -
Clear configuration cache:
-
Verify the environment:
Route prefix conflicts with existing routes
Route prefix conflicts with existing routes
Error:
Routes conflict with your application’s existing endpoints.Solution:Change the route prefix in your Or publish and modify the configuration:Then edit
.env:config/mercadopago.php:Webhook Issues
Webhook returns 401 Unauthorized
Webhook returns 401 Unauthorized
Webhook signature header is malformed
Webhook signature header is malformed
Error Message:Cause:
The Solution:
x-signature header doesn’t contain the required ts and v1 parameters.Expected format:- Verify you’re receiving webhooks directly from Mercado Pago
- Check if a proxy or load balancer is modifying headers
- Ensure the webhook URL is configured correctly in Mercado Pago dashboard
Webhook not receiving notifications
Webhook not receiving notifications
Problem:
Mercado Pago isn’t calling your webhook endpoint.Solution:
-
Verify the webhook URL is publicly accessible:
- Must use HTTPS in production
- Must be reachable from Mercado Pago servers
-
For local development, use a tunnel service:
-
Configure the public URL in Mercado Pago:
-
Test the endpoint manually:
You can also specify
notification_url when creating preferences or payments to override the default webhook URL.SDK and API Errors
Mercado Pago PHP SDK is not installed
Mercado Pago PHP SDK is not installed
Error Message:Solution:The package requires Then clear caches:
mercadopago/dx-php. Install it:SDK client class not found
SDK client class not found
Error Message:Cause:
The package couldn’t find the expected SDK client class.Solution:
-
Verify the SDK version:
-
Ensure you’re using version
^3.8: -
Clear composer cache:
422 Unprocessable Entity from Mercado Pago
422 Unprocessable Entity from Mercado Pago
Error:
Mercado Pago API returns 422 when creating preferences or payments.Common causes:Enable debugging to see the exact error from Mercado Pago:
- Invalid payload structure - Check the required fields in the API Reference
- Invalid email format - Ensure
payer.emailis valid - Invalid amount - Must be positive and properly formatted
- Invalid payment method - Verify the payment method ID is valid for your country
401 Unauthorized from Mercado Pago API
401 Unauthorized from Mercado Pago API
Testing Issues
Test users endpoint not working
Test users endpoint not working
Problem:
Cannot create test users via
/api/mercadopago/test-users.Solution:-
Ensure demo routes are enabled:
-
Use a valid
site_id:
MLA, MLB, MLC, MLM, MLU, MCO, MPETest user creation requires a valid production access token, even in test mode.
Card token is invalid or expired
Card token is invalid or expired
Error:
Payment creation fails with invalid card token.Cause:
Card tokens generated by MercadoPago.js expire after a short time.Solution:
- Generate the token immediately before creating the payment
- Don’t store tokens for later use
- Handle token expiration errors gracefully:
Need More Help?
If your issue isn’t listed here:- Check the Debugging guide for diagnostic techniques
- Enable detailed logging to capture error details
- Review the GitHub issues for similar problems
- Consult the official Mercado Pago documentation