@deiondz/better-auth-razorpay 2.0.0 → 2.0.1
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 +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,13 +50,13 @@ The Razorpay plugin provides a subscription management solution aligned with the
|
|
|
50
50
|
1. **Install the Package**
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
npm install better-auth-razorpay
|
|
53
|
+
npm install @deiondz/better-auth-razorpay
|
|
54
54
|
# or
|
|
55
|
-
yarn add better-auth-razorpay
|
|
55
|
+
yarn add @deiondz/better-auth-razorpay
|
|
56
56
|
# or
|
|
57
|
-
pnpm add better-auth-razorpay
|
|
57
|
+
pnpm add @deiondz/better-auth-razorpay
|
|
58
58
|
# or
|
|
59
|
-
bun add better-auth-razorpay
|
|
59
|
+
bun add @deiondz/better-auth-razorpay
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
The package includes `razorpay` and `zod` as dependencies.
|
|
@@ -67,7 +67,7 @@ The package includes `razorpay` and `zod` as dependencies.
|
|
|
67
67
|
// src/lib/auth.ts (or your auth configuration file)
|
|
68
68
|
import Razorpay from 'razorpay'
|
|
69
69
|
import { betterAuth } from 'better-auth'
|
|
70
|
-
import { razorpayPlugin } from 'better-auth-razorpay'
|
|
70
|
+
import { razorpayPlugin } from '@deiondz/better-auth-razorpay'
|
|
71
71
|
|
|
72
72
|
const razorpayClient = new Razorpay({
|
|
73
73
|
key_id: process.env.RAZORPAY_KEY_ID!,
|
|
@@ -116,7 +116,7 @@ export const auth = betterAuth({
|
|
|
116
116
|
```typescript
|
|
117
117
|
// src/lib/auth-client.ts
|
|
118
118
|
import { createAuthClient } from 'better-auth/react'
|
|
119
|
-
import { razorpayClientPlugin } from 'better-auth-razorpay/client'
|
|
119
|
+
import { razorpayClientPlugin } from '@deiondz/better-auth-razorpay/client'
|
|
120
120
|
import type { auth } from './auth'
|
|
121
121
|
|
|
122
122
|
export const authClient = createAuthClient<typeof auth>({
|
|
@@ -708,12 +708,12 @@ npm install @tanstack/react-query react
|
|
|
708
708
|
# or yarn / pnpm / bun
|
|
709
709
|
```
|
|
710
710
|
|
|
711
|
-
Import from
|
|
711
|
+
Import from `@deiondz/better-auth-razorpay/hooks` and pass your Better Auth client as the first argument:
|
|
712
712
|
|
|
713
713
|
```tsx
|
|
714
714
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
715
715
|
import { createAuthClient } from 'better-auth/react'
|
|
716
|
-
import { razorpayClientPlugin } from 'better-auth-razorpay/client'
|
|
716
|
+
import { razorpayClientPlugin } from '@deiondz/better-auth-razorpay/client'
|
|
717
717
|
import {
|
|
718
718
|
usePlans,
|
|
719
719
|
useSubscriptions,
|
|
@@ -721,8 +721,8 @@ import {
|
|
|
721
721
|
useCancelSubscription,
|
|
722
722
|
useRestoreSubscription,
|
|
723
723
|
razorpayQueryKeys,
|
|
724
|
-
} from 'better-auth-razorpay/hooks'
|
|
725
|
-
import type { CreateOrUpdateSubscriptionInput } from 'better-auth-razorpay/hooks'
|
|
724
|
+
} from '@deiondz/better-auth-razorpay/hooks'
|
|
725
|
+
import type { CreateOrUpdateSubscriptionInput } from '@deiondz/better-auth-razorpay/hooks'
|
|
726
726
|
|
|
727
727
|
const queryClient = new QueryClient()
|
|
728
728
|
// auth from your server config (e.g. import type { auth } from './auth')
|
|
@@ -804,7 +804,7 @@ function SubscriptionUI() {
|
|
|
804
804
|
**Query keys** (for manual invalidation or prefetching):
|
|
805
805
|
|
|
806
806
|
```ts
|
|
807
|
-
import { razorpayQueryKeys } from 'better-auth-razorpay/hooks'
|
|
807
|
+
import { razorpayQueryKeys } from '@deiondz/better-auth-razorpay/hooks'
|
|
808
808
|
|
|
809
809
|
razorpayQueryKeys.plans() // ['razorpay', 'plans']
|
|
810
810
|
razorpayQueryKeys.subscriptions() // ['razorpay', 'subscriptions', 'me']
|
|
@@ -888,7 +888,7 @@ import type {
|
|
|
888
888
|
RazorpayErrorResponse,
|
|
889
889
|
RazorpayPluginOptions,
|
|
890
890
|
OnWebhookEventCallback,
|
|
891
|
-
} from 'better-auth-razorpay'
|
|
891
|
+
} from '@deiondz/better-auth-razorpay'
|
|
892
892
|
```
|
|
893
893
|
|
|
894
894
|
### Response Types
|
|
@@ -1385,7 +1385,7 @@ async function initializeRazorpayCheckout(subscriptionId: string) {
|
|
|
1385
1385
|
|
|
1386
1386
|
**7. Type Errors**
|
|
1387
1387
|
- Ensure you're using `createAuthClient<typeof auth>()` for type inference
|
|
1388
|
-
- Import types from
|
|
1388
|
+
- Import types from `@deiondz/better-auth-razorpay`
|
|
1389
1389
|
- Check that plugin is properly exported
|
|
1390
1390
|
|
|
1391
1391
|
## Resources
|