Skip to content
Digisys Alpha
Menu

Mercado Pago · Laravel · LATAM payments

Mercado Pago Card Payment Brick in Laravel: the flow

With Mercado Pago's Card Payment Brick, the browser turns card details into a token, your Laravel server creates the payment with that token, and a webhook confirms the final status. Never trust the browser's result alone.

By Ahmed Memon · Published 2026-11-27 · Updated 2026-11-27 · 6 min read

Card details should never touch your server. The Brick renders the card form in the page and returns a token. Your server only ever sees that token.

1. Render the Brick and get a token

Load Mercado Pago's JavaScript SDK with your public key, mount the Card Payment Brick, and send the token it returns to your own endpoint.

2. Create the payment on the server

Call the Payments API from Laravel with the token, amount and payer details, using your private access token. Send an idempotency key so a double click or retry cannot charge twice.

// Laravel controller, simplified
$response = Http::withToken(config('services.mercadopago.token'))
    ->withHeaders(['X-Idempotency-Key' => $order->uuid])
    ->post('https://api.mercadopago.com/v1/payments', [
        'transaction_amount' => $order->total,
        'token' => $request->token,
        'installments' => $request->installments,
        'payer' => ['email' => $request->email],
    ]);

3. Confirm with a webhook

A payment can be pending or change state after the browser returns. Treat the webhook, plus a fresh lookup of the payment by ID, as the source of truth. Verify the webhook's signature as described in Mercado Pago's documentation.

Things to test

  • Declined and pending payments, not only approved ones.
  • The same webhook arriving twice.
  • Local currency and installment rules for each country you sell in.

Questions

Can I trust the result the browser shows?

No. Show it to the user, but update the order only after the server confirms the payment status.

Do I need a separate account per country?

Mercado Pago operates per country, so check its documentation for the countries you sell in.

Need this built or reviewed?

Book a 30-minute discovery call or message us on WhatsApp. We reply within one business day.