When to Use Mercado Pago
Mercado Pago is ideal for:- E-commerce customers familiar with digital wallets.
- Younger demographics (18-35 years old).
- Repeat customers who value quick checkout.
- Markets where Mercado Pago has strong adoption.
Step 1: Create and Send the Payment Request
Mercado Pago payments use a redirect flow where customers authenticate on Mercado Pago’s platform. Send your payment request to the Process Transaction endpoint:Always include a
return_url
for Mercado Pago payments. This is where customers will be redirected after completing their payment.Step 2: Handle the Response and Redirect
The API response will include payment instructions and redirect information. Mercado Pago payments require a redirect flow where customers authenticate on Mercado Pago’s platform:Field | Description |
---|---|
id | Unique transaction identifier - store this for status checking |
status | Current payment status - will be pending initially |
next_action.redirect_to_url.url | URL where you should redirect the customer |
next_action.redirect_to_url.return_url | URL where customer returns after payment |
id
and status
fields validationCheck that you received a valid id
and status
before proceeding. If either is missing or invalid, do not redirect the customer and handle the error appropriately.Step 3: Redirect Customer to Mercado Pago
Guide your customer through the payment flow:1
Redirect to Mercado Pago
Use the URL from
next_action.redirect_to_url.url
to redirect your customer.2
Customer authenticates
Customer logs into their Mercado Pago account and confirms payment details.
3
Customer completes payment
Customer selects their preferred funding source and confirms the payment.
4
Customer returns to your site
After payment, customer is redirected back to your
return_url
.Step 4: Handle Customer Return
When customers return to your site, check the payment status. This code verifies the payment status and shows the appropriate page:Step 5: Track Payment Status
Mercado Pago payments follow this status flow:pending
- Customer being redirected to Mercado Pagosuccess
- Payment completed successfullyfailed
- Payment failed or was cancelled
Step 6: Handle Different Payment Outcomes
Different payment outcomes can occur:Successful Payment
Successful Payment
When the payment is completed successfully, you’ll receive a response with
status: "success"
and additional Mercado Pago details:Failed or Cancelled Payment
Failed or Cancelled Payment
When the payment fails or is cancelled, you’ll receive a response with
status: "failed"
and a reason for the failure:Best Practices for Mercado Pago Integration
Follow the best practices below to integrate Mercado Pago:User Experience
User Experience
- Display Mercado Pago logo to build customer confidence.
- Show progress indicators during redirects.
- Ensure redirect flow works well on mobile devices.
- Consider using popups for better user experience.
Technical Implementation
Technical Implementation
- Save the transaction ID before redirecting.
- Set reasonable timeouts for payment completion.
- Gracefully handle network issues and API errors.
- Always verify payment status server-side, not just client-side.
Customer Communication
Customer Communication
- Set clear expectations about the redirect process.
- Provide support information for Mercado Pago-related questions.
- Send confirmation emails after successful payments.
- Offer alternative payment methods as backup.
Common Integration Patterns
This is an example of how to implement Mercado Pago integration:Next Steps
- Set up webhooks to receive real-time notifications when Mercado Pago payments are completed.
- Learn about HTTP response codes to handle different API responses.
- Explore card payments as an alternative for customers without digital wallets.