@deiondz/better-auth-razorpay 2.0.10 → 2.0.12
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 +107 -11
- 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 +5 -4
- package/dist/index.js +69 -30
- package/dist/index.js.map +1 -1
- package/dist/{types-bkMGY9Jy.d.ts → types-BGWv0IJy.d.ts} +6 -3
- package/dist/{types-B25gyPpX.d.ts → types-VZW_XCzQ.d.ts} +7 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SubscriptionRecord } from './types-
|
|
1
|
+
import { S as SubscriptionRecord } from './types-VZW_XCzQ.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 {
|
|
@@ -156,14 +156,16 @@ interface RazorpayWebhookContext {
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
type OnWebhookEventCallback = (payload: RazorpayWebhookPayload, context: RazorpayWebhookContext) => Promise<void>;
|
|
159
|
-
/** Main plugin options: client, webhook secret, customer creation, subscription config, callbacks. */
|
|
159
|
+
/** Main plugin options: client or credentials, webhook secret, customer creation, subscription config, callbacks. */
|
|
160
160
|
interface RazorpayPluginOptions {
|
|
161
|
-
/** Initialized Razorpay client instance. */
|
|
162
|
-
razorpayClient
|
|
161
|
+
/** Initialized Razorpay client instance. Omit if using razorpayKeyId + razorpayKeySecret (plugin creates the instance). */
|
|
162
|
+
razorpayClient?: razorpay;
|
|
163
|
+
/** Razorpay API key ID. Required when razorpayClient is not provided; plugin creates the Razorpay instance. */
|
|
164
|
+
razorpayKeyId?: string;
|
|
165
|
+
/** Razorpay API key secret. Required when razorpayClient is not provided (plugin creates the instance). When set, also enables POST /razorpay/verify-payment (same as Razorpay client secret, not webhook secret). */
|
|
166
|
+
razorpayKeySecret?: string;
|
|
163
167
|
/** Webhook secret for signature verification. */
|
|
164
168
|
razorpayWebhookSecret?: string;
|
|
165
|
-
/** API key secret for payment signature verification. When set, enables POST /razorpay/verify-payment (same secret as Razorpay client, not webhook secret). */
|
|
166
|
-
razorpayKeySecret?: string;
|
|
167
169
|
/** Create Razorpay customer when user signs up. Default: false. */
|
|
168
170
|
createCustomerOnSignUp?: boolean;
|
|
169
171
|
/** Called after a Razorpay customer is created. */
|