To receive notifications about subscriptions and recurrent payments, in addition to creating the plans through our application, it is necessary to configure the webhook in the Mercado Pago app. This step is required because, at the moment, Mercado Pago does not allow us to set it up when creating the plan.
Prerequisites:
- Create a Mercado Pago application
- Create a connection with the Mercado Pago application in the Connections section
You can read how to make this connection in the Guide on how to connect Mercado Pago.
Webhook Configuration
Once the connection with Mercado Pago is established, it will be listed in the Connections section. To configure the webhook, you need to copy the URL included in the connection under the name “Webhook URL for Mercado Pago”. This is shown in the following image within the red box:
Next, you should access the Mercado Pago dashboard using the following url: https://www.mercadopago.com/developers
Once you log in, open the settings of the created application, and find the “Webhooks” section as shown in the image below:
In this section, you must add the “Payments” and “Plans and Subscriptions” events, and then click “Save Settings”.
https://api.notificationsformercadopago.com/mercadopago-webhook?connection_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Ensure the URL and events are configured under the “Production Mode” tab to receive real payment notifications.
Test the connection (optional)
You can test the connection using the “Simulate Notification” tool found in the same Webhook configuration section of Mercado Pago.
In this tool, you can select the newly completed production URL, an event type, and an identifier.
Fill in the details as shown in the previous image and click “Send Test.” This will send a test notification using the provided identifier. In the example, a non-existent identifier “123456” is used, so no notification will be created in the system, but it will help test the connection. If configured correctly, you should see a message like the following: