DEV Community

Carlos Estrada
Carlos Estrada

Posted on

My experience on the integration of mercado pago in Laravel and vue

As the title say today we're going to talk about mercado pago and the experience of integration in Laravel and vuejs.

What is Mercado pago?

Mercado pago is a payment platform similar to stripe or PayPal. Its used a lot in latin America.

Integration in laravel

Start with the easy part first, we need to define one route to generate the payment preference and one for the webhook.

The preference id is used in the frontend part by the mercadopagojs. And the webhook for getting notifications about the payments.

The first thing that I did was to create a controller to handle the creation of the preference id.

After having the method for the implementation about the creation of the preference id, I pass to the webhook route and handle all the data to create a table in the db for handle a log of the transactions being executed.

Integration in vuejs

Vue js was in my opinion a bit more complicated that the laravel part, because I haven’t made a implementation of a payment platform in vue. In short what we need to do is create the routes for the success , failure and pending states.

Recieve the query params in our component and with that updating the necesary tables in the db.

Another thing is that using the js package that provides mercado pago made the integration a really nice experience of do.

Conclusion

In short the integration of a payment platform was a interesting and growing experience for me, beacuse I could understand and face the challenges to implement things like a webhook, transaction, etc.

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay