feat(cli): add polar as better-auth plugin (#578)

This commit is contained in:
Aman Varshney
2025-09-16 17:53:44 +05:30
committed by GitHub
parent 3f22373cc3
commit ba3d62b6b9
77 changed files with 1221 additions and 308 deletions

View File

@@ -0,0 +1,6 @@
import { Polar } from "@polar-sh/sdk";
export const polarClient = new Polar({
accessToken: process.env.POLAR_ACCESS_TOKEN,
server: "sandbox",
});

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
const route = useRoute()
const checkout_id = route.query.checkout_id as string
</script>
<template>
<div class="container mx-auto px-4 py-8">
<h1 class="text-2xl font-bold mb-4">Payment Successful!</h1>
<p v-if="checkout_id">Checkout ID: \{{ checkout_id }}</p>
</div>
</template>

View File

@@ -0,0 +1,15 @@
export default async function SuccessPage({
searchParams,
}: {
searchParams: Promise<{ checkout_id: string }>
}) {
const params = await searchParams;
const checkout_id = params.checkout_id;
return (
<div className="px-4 py-8">
<h1>Payment Successful!</h1>
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
</div>
);
}

View File

@@ -0,0 +1,13 @@
import { useSearchParams } from "react-router";
export default function SuccessPage() {
const [searchParams] = useSearchParams();
const checkout_id = searchParams.get("checkout_id");
return (
<div className="container mx-auto px-4 py-8">
<h1>Payment Successful!</h1>
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
</div>
);
}

View File

@@ -0,0 +1,19 @@
import { createFileRoute, useSearch } from "@tanstack/react-router";
export const Route = createFileRoute("/success")({
component: SuccessPage,
validateSearch: (search) => ({
checkout_id: search.checkout_id as string,
}),
});
function SuccessPage() {
const { checkout_id } = useSearch({ from: "/success" });
return (
<div className="container mx-auto px-4 py-8">
<h1>Payment Successful!</h1>
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
</div>
);
}

View File

@@ -0,0 +1,19 @@
import { createFileRoute, useSearch } from "@tanstack/react-router";
export const Route = createFileRoute("/success")({
component: SuccessPage,
validateSearch: (search) => ({
checkout_id: search.checkout_id as string,
}),
});
function SuccessPage() {
const { checkout_id } = useSearch({ from: "/success" });
return (
<div className="container mx-auto px-4 py-8">
<h1>Payment Successful!</h1>
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
</div>
);
}

View File

@@ -0,0 +1,23 @@
import { createFileRoute } from "@tanstack/solid-router";
import { Show } from "solid-js";
export const Route = createFileRoute("/success")({
component: SuccessPage,
validateSearch: (search) => ({
checkout_id: search.checkout_id as string,
}),
});
function SuccessPage() {
const searchParams = Route.useSearch();
const checkout_id = searchParams().checkout_id;
return (
<div class="container mx-auto px-4 py-8">
<h1>Payment Successful!</h1>
<Show when={checkout_id}>
<p>Checkout ID: {checkout_id}</p>
</Show>
</div>
);
}

View File

@@ -0,0 +1,12 @@
<script lang="ts">
import { page } from '$app/stores';
const checkout_id = $page.url.searchParams.get('checkout_id');
</script>
<div class="container mx-auto px-4 py-8">
<h1>Payment Successful!</h1>
{#if checkout_id}
<p>Checkout ID: {checkout_id}</p>
{/if}
</div>