docs: fix minor polar documentation issues

This commit is contained in:
Emil Widlund
2025-05-19 17:29:32 +02:00
committed by GitHub
parent d23084d5d2
commit 73dca10e5a

View File

@@ -132,8 +132,10 @@ const auth = betterAuth({
polar({
client: polarClient,
createCustomerOnSignUp: true,
getCustomerCreateParams: ({ user, session }, request) => ({
myCustomProperty: 123,
getCustomerCreateParams: ({ user }, request) => ({
metadata: {
myCustomProperty: 123,
},
}),
use: [
// This is where you add Polar plugins
@@ -156,7 +158,7 @@ const auth = betterAuth({
When `createCustomerOnSignUp` is enabled, a new Polar Customer is automatically created when a new User is added in the Better-Auth Database.
All new customers are created with an associated `externalId`, which is the ID of your User in the Database. This allows us to skip any Polar User mapping in your Database.
All new customers are created with an associated `externalId`, which is the ID of your User in the Database. This allows us to skip any Polar to User mapping in your Database.
## Checkout Plugin
@@ -211,7 +213,7 @@ await authClient.checkout({
// Any Polar Product ID can be passed here
products: ["e651f46d-ac20-4f26-b769-ad088b123df2"],
// Or, if you setup "products" in the Checkout Config, you can pass the slug
slug: 'my-pro-product',
slug: 'pro',
// Reference ID will be saved as `referenceId` in the metadata of the checkout, order & subscription object
referenceId: organizationId
});
@@ -306,7 +308,7 @@ const { data: orders } = await authClient.customer.orders.list({
This method lists the subscriptions associated with authenticated user/customer.
```typescript
const { data: subscriptions } = await authClient.customer.orders.list({
const { data: subscriptions } = await authClient.customer.subscriptions.list({
query: {
page: 1,
limit: 10,
@@ -464,6 +466,3 @@ The plugin supports handlers for all Polar webhook events:
- `onCustomerUpdated` - Triggered when a customer is updated
- `onCustomerDeleted` - Triggered when a customer is deleted
- `onCustomerStateChanged` - Triggered when a customer is created
For configuration options and more information, check out [Polar's Better Auth docs](https://docs.polar.sh/integrate/sdk/adapters/better-auth).