Magento 2 Integration - Webhook Endpoint


Subscribe Pro sends webhooks to your Magento 2 instance in order to keep saved credit cards (payment profiles) in sync.

We do this because Magento 2 requires tokenized customer payment data to be stored in its database. Our M2 extension sends updates from Magento to Subscribe Pro. This webhook is needed to send updates the other way, from Subscribe Pro to Magento.

To set this, configure Subscribe Pro to point to the Webhook Endpoint which is hosted on your Magento 2 server.

Webhook Endpoint Configuration

To set up a webhook endpoint, navigate in the Subscribe Pro Merchant App to System > Webhook Endpoints.

  1. Click New to create a new endpoint.

    New Webhook Endpoint

  2. On that page, enter the following into the URL box: https://{yourdomain.com}/subscribepro/webhook You will need to replace {yourdomain.com} with the correct base domain name for your Magento installation. This is most likely the same as the URL configured in System > Configuration > Store Connection Settings.
  3. Uncheck the "Subscribe To All Event Types" box, and then uncheck each of the boxes under Subscribe To Specific Event Types heading, except payment_profile.created, payment_profile.updated, and payment_profile.redacted.

    New Webhook Endpoint Configuration

  4. Click Save. This will store the new record and return to you to the Webhook Endpoints list page.
  5. You will need to click the "Enable" button under Actions.

    Enable Webhook Endpoint

  6. You can use the "Ping" button under Actions to send a test request to the endpoint and make sure that it responds successfully.

    Test Webhook Endpoint

  7. You can also confirm that the endpoint is working successfully with organic requests as change are made to payment profiles in Subscribe Pro by going to System > Webhook Event Log and seeing that the rows show "Delivered".

    Webhook Endpoint Logs

If you have any questions or issues setting up the endpoint, please contact [email protected].

Advanced Setup in Magento 2 (Optional)

The webhook feature in the Magento 2 extension allows you to specify IP Addresses from which the webhook request must originate or else it will be blocked. By default, this is unnecessary and you can skip this step because the Subscribe Pro server IPs come pre-filled into the extension. However, if you require a webhook request to be sent from another server, or if the Subscribe Pro API IP addresses ever need to be changed, there is a setting for the extension that allows you to specify those IP addresses.

Restrict IP Addresses

Sign into Magento, and go to Stores > Configuration. Be sure to select your preferred configuration scope. Expand the Swarming section, and click on Subscribe Pro.

Expand the Advanced section and un-check the Use Default checkbox next to Allowed Webhook IP Address. That field will become editable. In that field, append or replace the existing list of IP addresses with the correct IP addresses that need to have webhook access to your server. Each IP address must be separated by a single comma, with no comma at the end.

Finally, click Save Config.