mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 23:53:17 -05:00
docs(dodopayments): use checkoutSession in docs (#8501)
This commit is contained in:
@@ -99,6 +99,7 @@ export const auth = betterAuth({
|
||||
<Step title="Set up client-side integration">
|
||||
Create or update `src/lib/auth-client.ts`:
|
||||
```typescript
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
import { dodopaymentsClient } from "@dodopayments/better-auth";
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
@@ -114,27 +115,21 @@ export const authClient = createAuthClient({
|
||||
### Creating a Checkout Session
|
||||
|
||||
```typescript
|
||||
const { data: checkout, error } = await authClient.dodopayments.checkout({
|
||||
const { data: checkoutSession, error } =
|
||||
await authClient.dodopayments.checkoutSession({
|
||||
slug: "premium-plan",
|
||||
customer: {
|
||||
email: "customer@example.com",
|
||||
name: "John Doe",
|
||||
},
|
||||
billing: {
|
||||
city: "San Francisco",
|
||||
country: "US",
|
||||
state: "CA",
|
||||
street: "123 Market St",
|
||||
zipcode: "94103",
|
||||
},
|
||||
referenceId: "order_123",
|
||||
});
|
||||
|
||||
if (checkout) {
|
||||
window.location.href = checkout.url;
|
||||
if (checkoutSession) {
|
||||
window.location.href = checkoutSession.url;
|
||||
}
|
||||
```
|
||||
|
||||
<Callout type="warn">
|
||||
`authClient.dodopayments.checkout()` is deprecated. Use
|
||||
`authClient.dodopayments.checkoutSession()` for new integrations.
|
||||
</Callout>
|
||||
|
||||
### Accessing the Customer Portal
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user