Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

feat: add webhook event constructor #23

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

carstenlebek
Copy link
Contributor

I have added a webhook event constructor similar to stripe.

import { constructEvent } from "lemonsqueezy.ts";

const event = constructEvent(
    "RAW_REQUEST_BODY",
    "X-Signature HEADER_VALUE",
    "YOUR_WEBHOOK_SECRET"
)

switch (event.type) {
    case "order_created":
        const order = event.data;
        break;
    case "order_refunded":
        const order = event.data;
        break;
    case "subscription_created":
        const subscription = event.data;
        break;
    default:
        break;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant