feat: add MercadoPago payment app#11246
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This PR is being marked as stale due to inactivity. |
|
Hey there, there is a merge conflict, can you take a look? |
|
This PR is being marked as stale due to inactivity. |
joeauyeung
left a comment
There was a problem hiding this comment.
If we're going to merge this I would feel better if we used the SDK provided by Mercado Pago. I'm seeing in packages/app-store/mercadopago/lib/MercadoPago.ts we're still using API calls
|
As of today, MercadoPago is not accepting an application from country X to allow users from country Y to connect their accounts. In other words, if the CalCom<>MercadoPago application is created from As I DMed to Peer, this PR could be used as a reference for self-hosters. Another alternative is to make the user create their own Developer Application in MercadoPago and add a Setup page for the app installation in CalCom (just like PayPal). However, this requires providing the user with a unique webhook URL so they can paste it into their MercadoPago applications (doable). The webhook should be unique and provide CalCom the association to a user, as the payment event data doesn't provide any helpful resource. We need to retrieve the user's data in order to i) validate the webhook signature with the particular user's webhook secret and ii) retrieve the CalCom Payment entity to call The worst alternative is creating a CalCom application in MercadoPago for each of the 7 countries, which would require adding 28 env variables. I believe it's definitely not worth the chaos. Please let me know your thoughts. Your feedback is always appreciated. |
|
Thanks for the detailed input, @ubinatus. Much appreciated. It indeed sounds like a bit of a mess at the moment so will close the PR but as you mentioned it can stay as a reference point. |
What does this PR do?
About MercadoPago
Mercado Pago is a leading digital payment platform in Latin America. Currently, it's available in seven countries: Argentina, Brazil, Chile, Colombia, Mexico, Uruguay, and Peru. It's widely used by businesses and consumers in all the above countries, and it surpassed $20 billion payment volume in 2019.
Checkout the Loom Video Demo for this PR.
Requirement/Documentation
No
No
Type of change
How should this be tested?
-- Yes, we need the following environment variables:
MERCADOPAGO_CLIENT_ID,MERCADOPAGO_CLIENT_SECRET,NEXT_PUBLIC_MERCADOPAGO_PUBLIC_KEY. See the guide after this bullet points to learn how to retrieve the configs from the App in MercadoPago to Cal.com enviornment variables.-- MercadoPago requirements:
--- 1. Signup to MercadoPago here.
--- 2. Create MercadoPago application in the developers portal here.
--- 3. Retrieve the Client ID on the applications page.
--- 4. Retrieve the Secret on the test credentials section (sidebar).
--- 5. Retrieve the Public Key on the test credentials section (sidebar)
--- 6. Set the Webhook (sidebar). Should point to
YOUR_URL/api/integrations/mercadopago/webhookand should select "Pagos" (Payments) as the only event needed.--- 7. Set the Redirect Url on the the application page. Should point to
YOUR_URL/api/integrations/mercadopago/callbackSee the guide after this bullet points to learn how to setup an App in MercadoPago.
-- Cal.com requirements:
--- 1. Install MercadoPago payment app.
--- 2. Add the MercadoPago payment information in an EventType
-- Being able to install MercadoPago payment app in Cal.com.
-- Being able to book and pay an event with MercadoPago in Cal.com.
-- Being able to cancel an event and refund with MercadoPago in Cal.com.
-- See the following guide.
In order to test the MercadoPago integration:
.envfile. You'll need the Application ID of MercadoPago (MERCADOPAGO_CLIENT_ID), the Public Key of MercadoPago (NEXT_PUBLIC_MERCADOPAGO_PUBLIC_KEY), the Access Token of MercadoPago (MERCADOPAGO_CLIENT_SECRET). After that you will to set up the Webhook URL to point to thehttps://yesyesyes.ngrok.app/api/integrations/mercadopago/webhook. Finally, you should edit the MercadoPago application and add the RedirectURL to point tohttps://yesyesyes.ngrok.app/api/integrations/mercadopago/callback. I've made a Loom Video to quickly explain this process..envfile you should runyarn dxso that it can seed again the app credentials to the database.Mandatory Tasks
Checklist