Overview
The Test Users API allows you to create test user accounts for Mercado Pago’s sandbox environment. Test users are essential for testing payment flows without processing real transactions or using real money.Test users created through this endpoint can be used to obtain test credentials and simulate complete payment flows in Mercado Pago’s sandbox environment.
Create Test User
Creates a new test user for a specific Mercado Pago site/country.Endpoint
Request Parameters
Mercado Pago site/country identifier. Must be one of:
MLA- ArgentinaMLB- BrazilMLC- ChileMLM- MexicoMLU- UruguayMCO- ColombiaMPE- Peru
Optional description to identify the test user (e.g., “QA Testing User”, “Buyer Account”)
Request Example
Response
Indicates if the request was successful
The test user object returned by Mercado Pago
Additional metadata (typically empty)
Response Example
cURL Example
Error Response
Supported Countries
Test users can be created for the following Mercado Pago markets:| Site ID | Country | Currency |
|---|---|---|
MLA | Argentina | ARS (Argentine Peso) |
MLB | Brazil | BRL (Brazilian Real) |
MLC | Chile | CLP (Chilean Peso) |
MLM | Mexico | MXN (Mexican Peso) |
MLU | Uruguay | UYU (Uruguayan Peso) |
MCO | Colombia | COP (Colombian Peso) |
MPE | Peru | PEN (Peruvian Sol) |
Use Cases
Creating Test Users for Different Scenarios
Create multiple test users for comprehensive testing:Obtaining Test Credentials
After creating a test user:- Use the returned
emailandpasswordto log into the Mercado Pago Developers dashboard - Navigate to Your integrations → Credentials
- Copy the test
access_tokenandpublic_key - Use these credentials in your local/testing environment
Automated QA Setup
Implementation Notes
Availability
This endpoint is protected by themercadopago.demo middleware and only responds when:
MERCADOPAGO_ENABLE_DEMO_ROUTES=truein configuration- Application environment is
localortesting
404.
Validation Rules
The endpoint validates:site_idis required and must be one of:MLA,MLB,MLC,MLM,MLU,MCO,MPEdescriptionis optional and must be a string
Controller Reference
Implemented in:src/Http/Controllers/Api/TestUserController.php:13
Request validation: src/Http/Requests/CreateTestUserRequest.php:17
Related Services
- TestUserService - Service layer for test user operations
Related Guides
- Testing with Sandbox - Complete guide on sandbox testing
- Test Cards - Available test cards for each country
Best Practices
Credential Management: Save the returned test user credentials securely. You’ll need them to obtain test access tokens from Mercado Pago’s dashboard.
Testing Workflow
- Create test users for your target country
- Log in to Mercado Pago with test user credentials
- Obtain test credentials (access token, public key)
- Configure your application with test credentials
- Run test transactions using test cards
- Verify webhooks and payment flows
Example Production Controller
Testing Different Scenarios
Success Payment Flow
- Create a test user
- Use test cards that simulate successful payments
- Verify payment status is
approved
Rejected Payment Flow
- Create a test user
- Use test cards that simulate rejections
- Verify appropriate error handling
Pending Payment Flow
- Create a test user
- Use payment methods that require manual approval
- Test webhook notifications for status changes
Test Cards by Country
After creating a test user, use these test cards for simulating different payment scenarios. Refer to Mercado Pago’s official documentation for complete test card lists.
Common Test Cards
| Card Network | Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4509 9535 6623 3704 | 123 | 11/25 |
| Mastercard | 5031 7557 3453 0604 | 123 | 11/25 |
| Amex | 3711 803032 57522 | 1234 | 11/25 |
Troubleshooting
Invalid site_id Error
Error:The site_id field must be one of: MLA, MLB, MLC, MLM, MLU, MCO, MPE.
Solution: Ensure you’re using a valid site ID. Check the Supported Countries section.
Endpoint Returns 404
Cause: Demo routes are disabled or environment is production. Solution:- Set
MERCADOPAGO_ENABLE_DEMO_ROUTES=true - Ensure
APP_ENVislocalortesting - Run
php artisan config:clear
Cannot Access Test Credentials
Issue: Can’t find test credentials in Mercado Pago dashboard. Solution:- Log in to Mercado Pago with the test user email and password
- Navigate to Developers → Your integrations
- Select your application
- Go to Production and test credentials
- Copy the Test credentials