Introduction
Webhooks are messages that Stripe sends to your website when important actions take place, like when a payment method becomes chargeable.
Webhooks allow your eCommerce site and Stripe to stay in sync and they are a very important piece in the plugin’s local payment method functionality.
For example: When a customer uses iDEAL to pay for an order on your site, they are redirected to a bank authentication page. Once they authenticate, they are redirected back to your order received page. But what if they closed their browser before they were redirect back to your site?
This is where webhooks come in to play. Stripe sends an event message to your server that informs the plugin that the iDEAL payment method can be charged. Our plugin then finishes processing the order.
Configure Webhooks
-
To begin configuring webhooks, Login to Stripe
-
The option Viewing test data will determine if you are creating a Test or Live webhook.
3. On the left navigation bar, under the Developers section, click Webhooks.
4. Click the Add endpoint button.
5. On the plugin’s API Settings page, copy the Webhook url and paste it to the Stripe Endpoint url.
6. Stripe allows you to configure all the event types that are sent to the endpoint url. Our plugin utilizes source.chargeable, charge.succeeded, charge.failed, payment_intent.succeeded for local payment methods. Once you have added the event, click Add endpoint
7. On the next page, you will see that the endpoint has been added and it’s active. For security purposes, Stripe uses an endpoint secret. We must add that secret to the plugin’s settings. Click the Click to reveal button located in the Signing secret section, which will display your webhook secret. Copy the value and paste it in the plugin’s Webhook secret field, which is located on the API settings page.