SETUP:
-
Place the 4 files into the same folder in your desired web directory.
-
Edit webhook_config.php as desired
-
Add the logs table to database:
CREATE TABLE IF NOT EXISTS webhook_logs (
id INT(11) PRIMARY KEY AUTO_INCREMENT,
event_id VARCHAR(255) UNIQUE,
event_type VARCHAR(255) NOT NULL,
date DATETIME DEFAULT CURRENT_TIMESTAMP
);
-
In your stripe dashboard(https://dashboard.stripe.com/account/webhooks), click ADD ENDPOINT, and set it to the URL for handler.php
-
Inside of webhookclass.php there is a function corresponding to all the possible event types(https://stripe.com/docs/api#event_types),
insert any desired logic inside of the function related to the event type's you plan on using.
- Fire off a test webhook from your dashboard!