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.
Top comments (0)