Implement Lemon Squeezy billing services
Added implementation for various billing services with Lemon Squeezy. This includes processing of webhooks for order and subscription handling, verification of webhook signatures, and validating subscription statuses and order states. Additionally, types for order and subscription webhooks have been created.
This commit is contained in:
1
packages/billing/lemon-squeezy/src/components/index.ts
Normal file
1
packages/billing/lemon-squeezy/src/components/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lemon-squeezy-embedded-checkout';
|
||||
@@ -0,0 +1,29 @@
|
||||
interface LemonSqueezyWindow extends Window {
|
||||
createLemonSqueezy: () => void;
|
||||
LemonSqueezy: {
|
||||
Setup: (options: {
|
||||
eventHandler: (event: { event: string }) => void;
|
||||
}) => void;
|
||||
Refresh: () => void;
|
||||
|
||||
Url: {
|
||||
Open: (url: string) => void;
|
||||
Close: () => void;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function LemonSqueezyEmbeddedCheckout(props: { checkoutToken: string }) {
|
||||
return (
|
||||
<script
|
||||
src="https://app.lemonsqueezy.com/js/lemon.js"
|
||||
defer
|
||||
onLoad={() => {
|
||||
const win = window as unknown as LemonSqueezyWindow;
|
||||
|
||||
win.createLemonSqueezy();
|
||||
win.LemonSqueezy.Url.Open(props.checkoutToken);
|
||||
}}
|
||||
></script>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user