Adds Mercado Pago Checkout Pro to a Payload app. It registers payments and webhook event collections plus a settings global, and exposes endpoints for webhooks, refunds, sync and reconciliation. Credentials are read from environment variables, and it requires Payload 3.94 or newer. Only one-time payments are supported.
Mercado Pago Checkout Pro plugin for Payload CMS: preferences, signed webhooks, refunds and payment reconciliation.
Installation
npm i payload-mercadopago0
Stars
0
Forks
0
Open Issues
4 days ago
Last Updated
0
Weekly Downloads
v
npm Version
Dependencies
00 since Nov 29
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1479751591-root)<a href="https://payloaddirectory.dev/plugins/1479751591-root"><img src="https://payloaddirectory.dev/badge/1479751591-root.svg" alt="Payload Directory"></a>README
Mercado Pago Checkout Pro plugin for Payload CMS 3.x.
It adds preferences, signed webhooks, payment records, refunds and reconciliation helpers to any Payload app.
x-signature validation and timing-safe comparison.payment_id or external_reference, including a cron-ready endpoint.Only one-time Checkout Pro payments are supported. Subscriptions, Point/QR and marketplace split payments are intentionally out of scope.
Install directly from GitHub:
pnpm add github:d4lanis/payload-mercadopago#v0.1.1
For local development inside another repository:
pnpm add link:../payload-mercadopago
MP_ACCESS_TOKEN=TEST-...
MP_PUBLIC_KEY=TEST-...
MP_WEBHOOK_SECRET=...
MP_ENVIRONMENT=sandbox
MP_STATEMENT_DESCRIPTOR=MESA
MP_CRON_SECRET=change-me
MP_PUBLIC_KEY is optional for Checkout Pro but useful for status displays. Secrets are never exposed to the browser.
import { mercadoPagoPlugin } from 'payload-mercadopago'
import type { MercadoPagoPluginConfig } from 'payload-mercadopago/types'
const mercadoPagoOptions: MercadoPagoPluginConfig = {
access: {
admin: ({ req }) => Boolean(req.user),
},
admin: {
group: 'Pagos',
},
checkout: {
autoReturn: 'approved',
maxInstallments: 12,
statementDescriptor: 'MESA',
},
hooks: {
onPaymentUpdated: async ({ payment, previousStatus, payload }) => {
// Update your order/document here.
},
},
}
export const config = buildConfig({
// ...
plugins: [mercadoPagoPlugin(mercadoPagoOptions)],
})
The plugin registers:
| Item | Default slug |
|---|---|
| Payments collection | mercadopago-payments |
| Webhook events collection | mercadopago-events |
| Settings global | mercadopago-settings |
You can rename them with collections and globals. The settings global stores non-secret options; credentials stay in environment variables.
import { createPreference, resolveConfig } from 'payload-mercadopago'
const config = await resolveConfig(payload, mercadoPagoOptions)
const { initPoint, preference, payment } = await createPreference({
config,
payload,
input: {
externalReference: String(order.id),
expectedAmount: 290,
items: [
{ quantity: 1, title: 'Comida', unitPrice: 241 },
{ quantity: 1, title: 'Envío', unitPrice: 49 },
],
payer: {
email: customer.email,
name: 'Ada',
surname: 'Lovelace',
},
backUrls: {
success: 'https://shop.example.com/pedido/123?new=1',
failure: 'https://shop.example.com/checkout?canceled=1',
pending: 'https://shop.example.com/pedido/123?pending=1',
},
metadata: { orderId: String(order.id) },
},
})
// Redirect the browser to initPoint.
expectedAmount is validated against the sum of the items. Amounts are decimals in the currency unit (for example 35.50, not cents).
Point the Mercado Pago dashboard to:
https://your-domain.com/api/mercadopago/webhook
Select payment and merchant_order notifications. Copy the webhook secret from the Mercado Pago dashboard into MP_WEBHOOK_SECRET.
The endpoint:
x-signature with HMAC SHA-256.mercadopago-events.onPaymentCreated, onPaymentUpdated and the status-specific hook.200 only when processing succeeds, so Mercado Pago can retry failures.If MP_WEBHOOK_SECRET is missing, webhooks are rejected unless allowUnsignedWebhooks: true is explicitly set for local development.
type MercadoPagoHooks = {
onPaymentCreated?: (args) => Promise<void> | void
onPaymentUpdated?: (args) => Promise<void> | void
onPaymentApproved?: (args) => Promise<void> | void
onPaymentPending?: (args) => Promise<void> | void
onPaymentRejected?: (args) => Promise<void> | void
onPaymentRefunded?: (args) => Promise<void> | void
}
Each hook receives { payment, mpPayment, previousStatus, payload, req }.
Hooks should be idempotent: Mercado Pago can retry a webhook. If a hook throws, the event is marked as failed and Mercado Pago will retry.
import {
cancelPayment,
getPaymentFromApi,
refundPayment,
searchPayments,
syncPayment,
syncPaymentByExternalReference,
verifyWebhookSignature,
} from 'payload-mercadopago'
syncPayment({ config, paymentId, payload })syncPaymentByExternalReference({ config, externalReference, payload })refundPayment({ config, input: { paymentId, amount? }, payload })cancelPayment({ config, paymentId, payload })| Method | Path | Access |
|---|---|---|
POST | /api/mercadopago/webhook | Public, signature-verified |
POST | /api/mercadopago/refund | Admin |
POST | /api/mercadopago/refund/cancel | Admin |
POST | /api/mercadopago/sync | Admin |
POST | /api/mercadopago/reconcile | Admin or x-cron-secret |
GET | /api/mercadopago/status | Admin |
Refund body:
{ "paymentId": "123456", "amount": 50 }
Omit amount for a full refund.
Reconcile body:
{ "externalReference": "order-123" }
For cron, send x-cron-secret: $MP_CRON_SECRET.
externalReference.metadata for non-sensitive references.MXN by default).amountMismatch when the Mercado Pago payment amount does not match the expected preference amount. Do not fulfill an order when this flag is set.Run the plugin checks:
pnpm lint
pnpm typecheck
pnpm test
pnpm build
For end-to-end testing:
https://<tunnel>/api/mercadopago/webhook and copy the secret.The Mercado Pago sandbox can be intermittent. Use the dashboard's webhook simulator and retry if a test notification does not arrive.
timingSafeEqual.MIT
payload ecommerce tpay
Tpay payment adapter for the Payload ecommerce plugin with BLIK, bank transfers and cards for Polish shops
596/wk2v3
payload paystack plugin
Sync Payload collections with Paystack resources through webhooks, a REST proxy and customer blacklisting
30143/wk6v3
stripe
Connect Stripe and Payload CMS to work with Stripe data from your Payload project
10022.2k/wk46.1kv3 v4
payload billing
Payments, invoices and refunds for Payload with Stripe, Mollie and a local test provider
68443/wk0v3
payload invoicepdf
Invoice and quote collections with JSX-based PDF generation, email sending and quote acceptance links
459/wk9v3
payload plugin membership
Patreon-style membership tiers and category pledges billed as Stripe subscriptions, with a backers wall
791.5k/wk1v3