TheDocumentation Index
Fetch the complete documentation index at: https://docs.stellartools.dev/llms.txt
Use this file to discover all available pages before exploring further.
@stellartools/betterauth-adapter adds a billing plugin to Better Auth. It links users to StellarTools customers and adds session-protected endpoints for subscriptions, refunds, and credits.
Install
Configure
stellartools_customer_id to the user schema. Run migrations after adding it so your database is up to date.
Plugin options
Your StellarTools API key.
Create a StellarTools customer when a user signs up. Defaults to
false.Trigger
on_credits_low when balance is at or below this value. Defaults to 10.Called when a customer is created or linked.
Called when a subscription is created.
Called when a subscription is canceled.
Called when credits fall below the threshold after a consume.
Endpoints
All endpoints require a valid Better Auth session.Customers
| Method | Path | Description |
|---|---|---|
POST | /api/auth/stellar/customer/create | Create or link a StellarTools customer. |
GET | /api/auth/stellar/customer/retrieve | Get the current user’s customer. |
POST | /api/auth/stellar/customer/update | Update name, email, phone, or metadata. |
Subscriptions
| Method | Path | Description |
|---|---|---|
POST | /api/auth/stellar/subscription/create | Create a subscription. |
GET | /api/auth/stellar/subscription/list | List subscriptions for the current user. |
Credits
| Method | Path | Description |
|---|---|---|
POST | /api/auth/stellar/credits/consume | Consume credits for a product. |
GET | /api/auth/stellar/credits/transactions | Get credit transaction history. |
Refunds
| Method | Path | Description |
|---|---|---|
POST | /api/auth/stellar/refund/create | Create a refund for a payment. |

