@polar-sh/better-auth 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A [Better Auth](https://github.com/better-auth/better-auth) plugin for integrati
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
pnpm add better-auth @polar-sh/better-auth
|
|
15
|
+
pnpm add better-auth @polar-sh/better-auth @polar-sh/sdk
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### Preparation
|
|
@@ -31,10 +31,10 @@ import { Polar } from "@polar-sh/sdk";
|
|
|
31
31
|
|
|
32
32
|
const client = new Polar({
|
|
33
33
|
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
|
34
|
-
// Use 'sandbox' if you're using the Polar Sandbox environment
|
|
35
|
-
// Remember that access tokens, products, etc. are completely separated between environments.
|
|
34
|
+
// Use 'sandbox' if you're using the Polar Sandbox environment
|
|
35
|
+
// Remember that access tokens, products, etc. are completely separated between environments.
|
|
36
36
|
// Access tokens obtained in Production are for instance not usable in the Sandbox environment.
|
|
37
|
-
server: 'production'
|
|
37
|
+
server: 'production'
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const auth = betterAuth({
|
|
@@ -130,7 +130,6 @@ The plugin adds the following API routes:
|
|
|
130
130
|
- `GET /customer-portal` - Redirects to Polar Customer Portal for authenticated user
|
|
131
131
|
- `POST /polar/webhooks` - Incoming webhooks are automatically parsed & validated
|
|
132
132
|
|
|
133
|
-
|
|
134
133
|
## Customers
|
|
135
134
|
|
|
136
135
|
When `createCustomerOnSignUp` is enabled, a new Polar Customer is automatically created when a new User is added in the Better-Auth Database.
|
|
@@ -139,7 +138,7 @@ All new customers are created with an associated `externalId`, which is the ID o
|
|
|
139
138
|
|
|
140
139
|
## Checkouts
|
|
141
140
|
|
|
142
|
-
When checkouts are enabled, you're able to initialize Checkout Sessions on the `/checkout/:slug` route.
|
|
141
|
+
When checkouts are enabled, you're able to initialize Checkout Sessions on the `/checkout/:slug` route.
|
|
143
142
|
|
|
144
143
|
### Checkouts with slug
|
|
145
144
|
|
|
@@ -149,4 +148,4 @@ If you pass an array of products to the configuration, you're able to use the sl
|
|
|
149
148
|
|
|
150
149
|
All your organization products are eligible for checkouts, even if they're not passed to the products-configuration.
|
|
151
150
|
|
|
152
|
-
You can initialize a checkout session like following - `/checkout?productId=123-456-789`
|
|
151
|
+
You can initialize a checkout session like following - `/checkout?productId=123-456-789`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polar-sh/better-auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Polar integration for better-auth",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "1.9.4",
|
|
33
|
+
"@polar-sh/sdk": "^0.29.2",
|
|
33
34
|
"@sindresorhus/tsconfig": "^7.0.0",
|
|
34
35
|
"@types/node": "^20.0.0",
|
|
35
36
|
"better-auth": "^1.2.0",
|
|
@@ -37,10 +38,10 @@
|
|
|
37
38
|
"vitest": "^2.1.8"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@polar-sh/sdk": "^0.29.2",
|
|
41
41
|
"zod": "^3.24.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
+
"@polar-sh/sdk": "^0.29.2",
|
|
44
45
|
"better-auth": "^1.2.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|