@deiondz/better-auth-razorpay 2.0.11 → 2.0.13
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 +66 -8
- package/dist/client/hooks.d.ts +81 -6
- package/dist/client/hooks.js +52 -0
- package/dist/client/hooks.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +131 -27
- package/dist/index.js.map +1 -1
- package/dist/{types-C2IdKTof.d.ts → types-B91GdcpF.d.ts} +6 -3
- package/dist/{types-VZW_XCzQ.d.ts → types-BC0odu_S.d.ts} +10 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SubscriptionRecord } from './types-
|
|
1
|
+
import { S as SubscriptionRecord } from './types-BC0odu_S.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Client-side types for Razorpay plugin hooks and API responses.
|
|
@@ -25,11 +25,12 @@ interface ListSubscriptionsResponse {
|
|
|
25
25
|
success: true;
|
|
26
26
|
data: SubscriptionRecord[];
|
|
27
27
|
}
|
|
28
|
-
/** Response shape for create-or-update (success). */
|
|
28
|
+
/** Response shape for create-or-update (success). When `embed: true`, checkoutUrl is omitted; use openRazorpaySubscriptionCheckout with razorpaySubscriptionId for in-page modal. */
|
|
29
29
|
interface CreateOrUpdateSubscriptionResponse {
|
|
30
30
|
success: true;
|
|
31
31
|
data: {
|
|
32
|
-
|
|
32
|
+
/** Present when not using embed; omit when embed is true (use in-page modal instead). */
|
|
33
|
+
checkoutUrl?: string | null;
|
|
33
34
|
subscriptionId: string;
|
|
34
35
|
razorpaySubscriptionId: string;
|
|
35
36
|
};
|
|
@@ -114,6 +115,8 @@ interface CreateOrUpdateSubscriptionInput {
|
|
|
114
115
|
subscriptionId?: string;
|
|
115
116
|
successUrl?: string;
|
|
116
117
|
disableRedirect?: boolean;
|
|
118
|
+
/** When true, checkout runs in-page via Razorpay modal; no redirect to checkoutUrl. */
|
|
119
|
+
embed?: boolean;
|
|
117
120
|
}
|
|
118
121
|
/** Input for cancel subscription. */
|
|
119
122
|
interface CancelSubscriptionInput {
|
|
@@ -168,6 +168,16 @@ interface RazorpayPluginOptions {
|
|
|
168
168
|
razorpayWebhookSecret?: string;
|
|
169
169
|
/** Create Razorpay customer when user signs up. Default: false. */
|
|
170
170
|
createCustomerOnSignUp?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Optional. When set with createCustomerOnSignUp, creates an app-level trial subscription at sign-up (no Razorpay subscription until user subscribes).
|
|
173
|
+
* Omit for no sign-up trial. Only applies when both createCustomerOnSignUp and trialOnSignUp are set.
|
|
174
|
+
* @property days - Trial length in days (e.g. 7, 14, 30). Required when trialOnSignUp is set.
|
|
175
|
+
* @property planName - Display name for the trial in the subscription list (e.g. "Trial", "Free trial"). Default: "Trial".
|
|
176
|
+
*/
|
|
177
|
+
trialOnSignUp?: {
|
|
178
|
+
days: number;
|
|
179
|
+
planName?: string;
|
|
180
|
+
};
|
|
171
181
|
/** Called after a Razorpay customer is created. */
|
|
172
182
|
onCustomerCreate?: (args: {
|
|
173
183
|
user: RazorpayUserRecord;
|