Payment preferences are the foundation of MercadoPago’s checkout experience. They define what items your customer is purchasing, where to redirect them after payment, and how to notify your system.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fitodac/laravel-mercadopago/llms.txt
Use this file to discover all available pages before exploring further.
Understanding preferences
A preference contains:- Items: Products or services being purchased
- Payer information: Buyer’s email and optional details
- URLs: Where to redirect users after payment
- Notification URL: Where MercadoPago sends webhook notifications
- External reference: Your internal order/transaction ID
Basic preference creation
Payload structure
Required fields
The minimum payload requires only an items array:Complete payload example
Here’s a comprehensive example with all common options:Field validation rules
The package validates preference payloads using these rules:| Field | Rule | Description |
|---|---|---|
items | required, array, min:1 | At least one item required |
items.*.title | required, string | Item name |
items.*.quantity | required, integer, min:1 | Quantity must be positive |
items.*.unit_price | required, numeric, min:0 | Price cannot be negative |
payer | sometimes, array | Optional payer information |
back_urls | sometimes, array | Optional redirect URLs |
notification_url | sometimes, url | Must be valid URL |
external_reference | sometimes, string | Your internal reference |
expires | sometimes, boolean | Enable expiration |
expiration_date_from | sometimes, date | Expiration start |
expiration_date_to | sometimes, date | Expiration end |
metadata | sometimes, array | Custom data |
Validation rules are defined in
src/Http/Requests/CreatePreferenceRequest.phpUnderstanding URLs
Back URLs
These URLs define where users are redirected after payment:- success: Payment approved
- pending: Payment pending (e.g., bank transfer)
- failure: Payment rejected or cancelled
Notification URL
The notification URL receives webhook POST requests when payment status changes:Response structure
Successful preference creation returns:Key response fields
- id: Preference unique identifier
- init_point: Production checkout URL
- sandbox_init_point: Testing checkout URL
Common patterns
Linking preferences to orders
Useexternal_reference to link preferences to your internal orders:
Adding metadata
Store custom data for webhook processing:Setting expiration
Create time-limited payment preferences:Next steps
Processing Payments
Learn about direct payment processing
Handling Webhooks
Process payment notifications