@paykit-sdk/razorpay 1.0.0
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 +180 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4853 -0
- package/dist/index.mjs +4849 -0
- package/dist/razorpay-provider.d.mts +62 -0
- package/dist/razorpay-provider.d.ts +62 -0
- package/dist/razorpay-provider.js +4834 -0
- package/dist/razorpay-provider.mjs +4832 -0
- package/dist/schema.d.mts +275 -0
- package/dist/schema.d.ts +275 -0
- package/dist/schema.js +2 -0
- package/dist/schema.mjs +1 -0
- package/dist/utils/mapper.d.mts +33 -0
- package/dist/utils/mapper.d.ts +33 -0
- package/dist/utils/mapper.js +167 -0
- package/dist/utils/mapper.mjs +160 -0
- package/package.json +46 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Razorpay's error envelope, returned on any non-2xx response, e.g.
|
|
3
|
+
* `{ error: { code: "BAD_REQUEST_ERROR", description: "...", ... } }`
|
|
4
|
+
*/
|
|
5
|
+
interface RazorpayErrorResponse {
|
|
6
|
+
error: {
|
|
7
|
+
code: string;
|
|
8
|
+
description: string;
|
|
9
|
+
field: string | null;
|
|
10
|
+
source: string | null;
|
|
11
|
+
step: string | null;
|
|
12
|
+
reason: string | null;
|
|
13
|
+
metadata: Record<string, unknown> | null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The shape returned by `POST /orders` and `GET /orders/:id`.
|
|
18
|
+
*/
|
|
19
|
+
interface RazorpayOrder {
|
|
20
|
+
id: string;
|
|
21
|
+
entity: 'order';
|
|
22
|
+
amount: number;
|
|
23
|
+
amount_paid: number;
|
|
24
|
+
amount_due: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
receipt: string | null;
|
|
27
|
+
offer_id: string | null;
|
|
28
|
+
status: 'created' | 'attempted' | 'paid';
|
|
29
|
+
attempts: number;
|
|
30
|
+
notes: Record<string, string> | null;
|
|
31
|
+
created_at: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The shape returned by `GET /payments/:id` and `POST /payments/:id/capture`,
|
|
35
|
+
* and embedded as `payload.payment.entity` in webhook events.
|
|
36
|
+
*/
|
|
37
|
+
interface RazorpayPayment {
|
|
38
|
+
id: string;
|
|
39
|
+
entity: 'payment';
|
|
40
|
+
amount: number;
|
|
41
|
+
currency: string;
|
|
42
|
+
status: 'created' | 'authorized' | 'captured' | 'refunded' | 'failed';
|
|
43
|
+
order_id: string | null;
|
|
44
|
+
invoice_id: string | null;
|
|
45
|
+
international: boolean;
|
|
46
|
+
method: string;
|
|
47
|
+
amount_refunded: number;
|
|
48
|
+
refund_status: 'null' | 'partial' | 'full' | null;
|
|
49
|
+
captured: boolean;
|
|
50
|
+
description: string | null;
|
|
51
|
+
card_id: string | null;
|
|
52
|
+
bank: string | null;
|
|
53
|
+
wallet: string | null;
|
|
54
|
+
vpa: string | null;
|
|
55
|
+
email: string;
|
|
56
|
+
contact: string | null;
|
|
57
|
+
notes: Record<string, string> | null;
|
|
58
|
+
fee: number | null;
|
|
59
|
+
tax: number | null;
|
|
60
|
+
error_code: string | null;
|
|
61
|
+
error_description: string | null;
|
|
62
|
+
error_source: string | null;
|
|
63
|
+
error_step: string | null;
|
|
64
|
+
error_reason: string | null;
|
|
65
|
+
acquirer_data: Record<string, unknown> | null;
|
|
66
|
+
created_at: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The shape returned by `POST /payments/:id/refund`.
|
|
70
|
+
*/
|
|
71
|
+
interface RazorpayRefund {
|
|
72
|
+
id: string;
|
|
73
|
+
entity: 'refund';
|
|
74
|
+
amount: number;
|
|
75
|
+
receipt: string | null;
|
|
76
|
+
currency: string;
|
|
77
|
+
payment_id: string;
|
|
78
|
+
notes: Record<string, string> | null;
|
|
79
|
+
acquirer_data: {
|
|
80
|
+
arn: string | null;
|
|
81
|
+
} | null;
|
|
82
|
+
created_at: number;
|
|
83
|
+
batch_id: string | null;
|
|
84
|
+
status: 'pending' | 'processed' | 'failed';
|
|
85
|
+
speed_processed: 'normal' | 'optimum' | 'instant' | null;
|
|
86
|
+
speed_requested: 'normal' | 'optimum' | 'instant' | null;
|
|
87
|
+
}
|
|
88
|
+
interface RazorpayPaymentLinkCustomer {
|
|
89
|
+
name?: string;
|
|
90
|
+
contact?: string;
|
|
91
|
+
email?: string;
|
|
92
|
+
}
|
|
93
|
+
interface RazorpayPaymentLinkPaymentEntry {
|
|
94
|
+
amount: number;
|
|
95
|
+
created_at: number;
|
|
96
|
+
method: string;
|
|
97
|
+
payment_id: string;
|
|
98
|
+
status: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The shape returned by `POST /payment_links/` and `GET /payment_links/:id`.
|
|
102
|
+
* `payments` and `order_id` are only populated once the link has been paid.
|
|
103
|
+
*/
|
|
104
|
+
interface RazorpayPaymentLink {
|
|
105
|
+
id: string;
|
|
106
|
+
entity: 'payment_link';
|
|
107
|
+
amount: number;
|
|
108
|
+
currency: string;
|
|
109
|
+
accept_partial: boolean;
|
|
110
|
+
first_min_partial_amount?: number;
|
|
111
|
+
description: string | null;
|
|
112
|
+
reference_id: string | null;
|
|
113
|
+
customer: RazorpayPaymentLinkCustomer | null;
|
|
114
|
+
notify: {
|
|
115
|
+
sms?: boolean;
|
|
116
|
+
email?: boolean;
|
|
117
|
+
};
|
|
118
|
+
reminder_enable: boolean;
|
|
119
|
+
notes: Record<string, string> | null;
|
|
120
|
+
status: 'created' | 'paid' | 'cancelled' | 'expired' | 'partially_paid';
|
|
121
|
+
short_url: string;
|
|
122
|
+
order_id: string | null;
|
|
123
|
+
expire_by: number | null;
|
|
124
|
+
callback_url: string | null;
|
|
125
|
+
callback_method: string | null;
|
|
126
|
+
payments: RazorpayPaymentLinkPaymentEntry[] | null;
|
|
127
|
+
created_at: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The shape returned by `POST /customers` and `PUT /customers/:id`.
|
|
131
|
+
* There is no delete-customer endpoint on Razorpay's Customers API.
|
|
132
|
+
*/
|
|
133
|
+
interface RazorpayCustomer {
|
|
134
|
+
id: string;
|
|
135
|
+
entity: 'customer';
|
|
136
|
+
name: string;
|
|
137
|
+
email: string;
|
|
138
|
+
contact: string | null;
|
|
139
|
+
gstin: string | null;
|
|
140
|
+
notes: Record<string, string> | null;
|
|
141
|
+
created_at: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The shape returned by `POST /plans`.
|
|
145
|
+
*/
|
|
146
|
+
interface RazorpayPlan {
|
|
147
|
+
id: string;
|
|
148
|
+
entity: 'plan';
|
|
149
|
+
interval: number;
|
|
150
|
+
period: 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly';
|
|
151
|
+
item: {
|
|
152
|
+
id: string;
|
|
153
|
+
active: boolean;
|
|
154
|
+
name: string;
|
|
155
|
+
description: string | null;
|
|
156
|
+
amount: number;
|
|
157
|
+
unit_amount: number;
|
|
158
|
+
currency: string;
|
|
159
|
+
type: string;
|
|
160
|
+
unit: string | null;
|
|
161
|
+
tax_inclusive: boolean;
|
|
162
|
+
created_at: number;
|
|
163
|
+
updated_at: number;
|
|
164
|
+
};
|
|
165
|
+
notes: Record<string, string> | null;
|
|
166
|
+
created_at: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The shape returned by `POST /subscriptions`. `customer_id`/`customer_email`
|
|
170
|
+
* stay null until the customer completes authorization via `short_url` -
|
|
171
|
+
* a customer can't be attached at creation time, analogous to Payment Links.
|
|
172
|
+
*/
|
|
173
|
+
interface RazorpaySubscription {
|
|
174
|
+
id: string;
|
|
175
|
+
entity: 'subscription';
|
|
176
|
+
plan_id: string;
|
|
177
|
+
customer_id: string | null;
|
|
178
|
+
offer_id?: string | null;
|
|
179
|
+
status: 'created' | 'authenticated' | 'active' | 'pending' | 'halted' | 'cancelled' | 'completed' | 'expired' | 'paused';
|
|
180
|
+
current_start: number | null;
|
|
181
|
+
current_end: number | null;
|
|
182
|
+
ended_at: number | null;
|
|
183
|
+
quantity: number;
|
|
184
|
+
notes: Record<string, string> | null;
|
|
185
|
+
charge_at: number | null;
|
|
186
|
+
start_at: number | null;
|
|
187
|
+
end_at: number | null;
|
|
188
|
+
auth_attempts: number;
|
|
189
|
+
total_count: number;
|
|
190
|
+
paid_count: number;
|
|
191
|
+
customer_notify: boolean;
|
|
192
|
+
created_at: number;
|
|
193
|
+
expire_by: number | null;
|
|
194
|
+
short_url: string;
|
|
195
|
+
has_scheduled_changes: boolean;
|
|
196
|
+
change_scheduled_at: number | null;
|
|
197
|
+
source: string;
|
|
198
|
+
remaining_count: number;
|
|
199
|
+
}
|
|
200
|
+
type RazorpayRawEvents = {
|
|
201
|
+
'razorpay.payment.authorized': RazorpayWebhookEvent;
|
|
202
|
+
'razorpay.payment.captured': RazorpayWebhookEvent;
|
|
203
|
+
'razorpay.payment.failed': RazorpayWebhookEvent;
|
|
204
|
+
'razorpay.order.paid': RazorpayWebhookEvent;
|
|
205
|
+
'razorpay.refund.created': RazorpayWebhookEvent;
|
|
206
|
+
'razorpay.refund.processed': RazorpayWebhookEvent;
|
|
207
|
+
'razorpay.payment_link.paid': RazorpayWebhookEvent;
|
|
208
|
+
'razorpay.payment_link.cancelled': RazorpayWebhookEvent;
|
|
209
|
+
'razorpay.payment_link.expired': RazorpayWebhookEvent;
|
|
210
|
+
'razorpay.subscription.authenticated': RazorpayWebhookEvent;
|
|
211
|
+
'razorpay.subscription.activated': RazorpayWebhookEvent;
|
|
212
|
+
'razorpay.subscription.charged': RazorpayWebhookEvent;
|
|
213
|
+
'razorpay.subscription.completed': RazorpayWebhookEvent;
|
|
214
|
+
'razorpay.subscription.updated': RazorpayWebhookEvent;
|
|
215
|
+
'razorpay.subscription.pending': RazorpayWebhookEvent;
|
|
216
|
+
'razorpay.subscription.halted': RazorpayWebhookEvent;
|
|
217
|
+
'razorpay.subscription.paused': RazorpayWebhookEvent;
|
|
218
|
+
'razorpay.subscription.resumed': RazorpayWebhookEvent;
|
|
219
|
+
'razorpay.subscription.cancelled': RazorpayWebhookEvent;
|
|
220
|
+
};
|
|
221
|
+
type StripRazorpayPrefix<T> = T extends `razorpay.${infer Rest}` ? Rest : T;
|
|
222
|
+
type RazorpayEventsClean = StripRazorpayPrefix<keyof RazorpayRawEvents>;
|
|
223
|
+
interface RazorpayWebhookEvent {
|
|
224
|
+
entity: 'event';
|
|
225
|
+
/**
|
|
226
|
+
* The ID of the Razorpay account that the webhook is for.
|
|
227
|
+
*/
|
|
228
|
+
account_id: string;
|
|
229
|
+
/**
|
|
230
|
+
* The webhook event name.
|
|
231
|
+
*/
|
|
232
|
+
event: RazorpayEventsClean;
|
|
233
|
+
/**
|
|
234
|
+
* The resources that the webhook contains.
|
|
235
|
+
*/
|
|
236
|
+
contains: string[];
|
|
237
|
+
/**
|
|
238
|
+
* The payload of the webhook.
|
|
239
|
+
*/
|
|
240
|
+
payload: {
|
|
241
|
+
/**
|
|
242
|
+
* The payment resource that the webhook contains.
|
|
243
|
+
*/
|
|
244
|
+
payment?: {
|
|
245
|
+
entity: RazorpayPayment;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* The order resource that the webhook contains.
|
|
249
|
+
*/
|
|
250
|
+
order?: {
|
|
251
|
+
entity: RazorpayOrder;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* The refund resource that the webhook contains.
|
|
255
|
+
*/
|
|
256
|
+
refund?: {
|
|
257
|
+
entity: RazorpayRefund;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* The payment link resource that the webhook contains.
|
|
261
|
+
*/
|
|
262
|
+
payment_link?: {
|
|
263
|
+
entity: RazorpayPaymentLink;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* The subscription resource that the webhook contains.
|
|
267
|
+
*/
|
|
268
|
+
subscription?: {
|
|
269
|
+
entity: RazorpaySubscription;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
created_at: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type { RazorpayCustomer, RazorpayErrorResponse, RazorpayEventsClean, RazorpayOrder, RazorpayPayment, RazorpayPaymentLink, RazorpayPaymentLinkCustomer, RazorpayPaymentLinkPaymentEntry, RazorpayPlan, RazorpayRawEvents, RazorpayRefund, RazorpaySubscription, RazorpayWebhookEvent };
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Razorpay's error envelope, returned on any non-2xx response, e.g.
|
|
3
|
+
* `{ error: { code: "BAD_REQUEST_ERROR", description: "...", ... } }`
|
|
4
|
+
*/
|
|
5
|
+
interface RazorpayErrorResponse {
|
|
6
|
+
error: {
|
|
7
|
+
code: string;
|
|
8
|
+
description: string;
|
|
9
|
+
field: string | null;
|
|
10
|
+
source: string | null;
|
|
11
|
+
step: string | null;
|
|
12
|
+
reason: string | null;
|
|
13
|
+
metadata: Record<string, unknown> | null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The shape returned by `POST /orders` and `GET /orders/:id`.
|
|
18
|
+
*/
|
|
19
|
+
interface RazorpayOrder {
|
|
20
|
+
id: string;
|
|
21
|
+
entity: 'order';
|
|
22
|
+
amount: number;
|
|
23
|
+
amount_paid: number;
|
|
24
|
+
amount_due: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
receipt: string | null;
|
|
27
|
+
offer_id: string | null;
|
|
28
|
+
status: 'created' | 'attempted' | 'paid';
|
|
29
|
+
attempts: number;
|
|
30
|
+
notes: Record<string, string> | null;
|
|
31
|
+
created_at: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The shape returned by `GET /payments/:id` and `POST /payments/:id/capture`,
|
|
35
|
+
* and embedded as `payload.payment.entity` in webhook events.
|
|
36
|
+
*/
|
|
37
|
+
interface RazorpayPayment {
|
|
38
|
+
id: string;
|
|
39
|
+
entity: 'payment';
|
|
40
|
+
amount: number;
|
|
41
|
+
currency: string;
|
|
42
|
+
status: 'created' | 'authorized' | 'captured' | 'refunded' | 'failed';
|
|
43
|
+
order_id: string | null;
|
|
44
|
+
invoice_id: string | null;
|
|
45
|
+
international: boolean;
|
|
46
|
+
method: string;
|
|
47
|
+
amount_refunded: number;
|
|
48
|
+
refund_status: 'null' | 'partial' | 'full' | null;
|
|
49
|
+
captured: boolean;
|
|
50
|
+
description: string | null;
|
|
51
|
+
card_id: string | null;
|
|
52
|
+
bank: string | null;
|
|
53
|
+
wallet: string | null;
|
|
54
|
+
vpa: string | null;
|
|
55
|
+
email: string;
|
|
56
|
+
contact: string | null;
|
|
57
|
+
notes: Record<string, string> | null;
|
|
58
|
+
fee: number | null;
|
|
59
|
+
tax: number | null;
|
|
60
|
+
error_code: string | null;
|
|
61
|
+
error_description: string | null;
|
|
62
|
+
error_source: string | null;
|
|
63
|
+
error_step: string | null;
|
|
64
|
+
error_reason: string | null;
|
|
65
|
+
acquirer_data: Record<string, unknown> | null;
|
|
66
|
+
created_at: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The shape returned by `POST /payments/:id/refund`.
|
|
70
|
+
*/
|
|
71
|
+
interface RazorpayRefund {
|
|
72
|
+
id: string;
|
|
73
|
+
entity: 'refund';
|
|
74
|
+
amount: number;
|
|
75
|
+
receipt: string | null;
|
|
76
|
+
currency: string;
|
|
77
|
+
payment_id: string;
|
|
78
|
+
notes: Record<string, string> | null;
|
|
79
|
+
acquirer_data: {
|
|
80
|
+
arn: string | null;
|
|
81
|
+
} | null;
|
|
82
|
+
created_at: number;
|
|
83
|
+
batch_id: string | null;
|
|
84
|
+
status: 'pending' | 'processed' | 'failed';
|
|
85
|
+
speed_processed: 'normal' | 'optimum' | 'instant' | null;
|
|
86
|
+
speed_requested: 'normal' | 'optimum' | 'instant' | null;
|
|
87
|
+
}
|
|
88
|
+
interface RazorpayPaymentLinkCustomer {
|
|
89
|
+
name?: string;
|
|
90
|
+
contact?: string;
|
|
91
|
+
email?: string;
|
|
92
|
+
}
|
|
93
|
+
interface RazorpayPaymentLinkPaymentEntry {
|
|
94
|
+
amount: number;
|
|
95
|
+
created_at: number;
|
|
96
|
+
method: string;
|
|
97
|
+
payment_id: string;
|
|
98
|
+
status: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The shape returned by `POST /payment_links/` and `GET /payment_links/:id`.
|
|
102
|
+
* `payments` and `order_id` are only populated once the link has been paid.
|
|
103
|
+
*/
|
|
104
|
+
interface RazorpayPaymentLink {
|
|
105
|
+
id: string;
|
|
106
|
+
entity: 'payment_link';
|
|
107
|
+
amount: number;
|
|
108
|
+
currency: string;
|
|
109
|
+
accept_partial: boolean;
|
|
110
|
+
first_min_partial_amount?: number;
|
|
111
|
+
description: string | null;
|
|
112
|
+
reference_id: string | null;
|
|
113
|
+
customer: RazorpayPaymentLinkCustomer | null;
|
|
114
|
+
notify: {
|
|
115
|
+
sms?: boolean;
|
|
116
|
+
email?: boolean;
|
|
117
|
+
};
|
|
118
|
+
reminder_enable: boolean;
|
|
119
|
+
notes: Record<string, string> | null;
|
|
120
|
+
status: 'created' | 'paid' | 'cancelled' | 'expired' | 'partially_paid';
|
|
121
|
+
short_url: string;
|
|
122
|
+
order_id: string | null;
|
|
123
|
+
expire_by: number | null;
|
|
124
|
+
callback_url: string | null;
|
|
125
|
+
callback_method: string | null;
|
|
126
|
+
payments: RazorpayPaymentLinkPaymentEntry[] | null;
|
|
127
|
+
created_at: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The shape returned by `POST /customers` and `PUT /customers/:id`.
|
|
131
|
+
* There is no delete-customer endpoint on Razorpay's Customers API.
|
|
132
|
+
*/
|
|
133
|
+
interface RazorpayCustomer {
|
|
134
|
+
id: string;
|
|
135
|
+
entity: 'customer';
|
|
136
|
+
name: string;
|
|
137
|
+
email: string;
|
|
138
|
+
contact: string | null;
|
|
139
|
+
gstin: string | null;
|
|
140
|
+
notes: Record<string, string> | null;
|
|
141
|
+
created_at: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The shape returned by `POST /plans`.
|
|
145
|
+
*/
|
|
146
|
+
interface RazorpayPlan {
|
|
147
|
+
id: string;
|
|
148
|
+
entity: 'plan';
|
|
149
|
+
interval: number;
|
|
150
|
+
period: 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly';
|
|
151
|
+
item: {
|
|
152
|
+
id: string;
|
|
153
|
+
active: boolean;
|
|
154
|
+
name: string;
|
|
155
|
+
description: string | null;
|
|
156
|
+
amount: number;
|
|
157
|
+
unit_amount: number;
|
|
158
|
+
currency: string;
|
|
159
|
+
type: string;
|
|
160
|
+
unit: string | null;
|
|
161
|
+
tax_inclusive: boolean;
|
|
162
|
+
created_at: number;
|
|
163
|
+
updated_at: number;
|
|
164
|
+
};
|
|
165
|
+
notes: Record<string, string> | null;
|
|
166
|
+
created_at: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The shape returned by `POST /subscriptions`. `customer_id`/`customer_email`
|
|
170
|
+
* stay null until the customer completes authorization via `short_url` -
|
|
171
|
+
* a customer can't be attached at creation time, analogous to Payment Links.
|
|
172
|
+
*/
|
|
173
|
+
interface RazorpaySubscription {
|
|
174
|
+
id: string;
|
|
175
|
+
entity: 'subscription';
|
|
176
|
+
plan_id: string;
|
|
177
|
+
customer_id: string | null;
|
|
178
|
+
offer_id?: string | null;
|
|
179
|
+
status: 'created' | 'authenticated' | 'active' | 'pending' | 'halted' | 'cancelled' | 'completed' | 'expired' | 'paused';
|
|
180
|
+
current_start: number | null;
|
|
181
|
+
current_end: number | null;
|
|
182
|
+
ended_at: number | null;
|
|
183
|
+
quantity: number;
|
|
184
|
+
notes: Record<string, string> | null;
|
|
185
|
+
charge_at: number | null;
|
|
186
|
+
start_at: number | null;
|
|
187
|
+
end_at: number | null;
|
|
188
|
+
auth_attempts: number;
|
|
189
|
+
total_count: number;
|
|
190
|
+
paid_count: number;
|
|
191
|
+
customer_notify: boolean;
|
|
192
|
+
created_at: number;
|
|
193
|
+
expire_by: number | null;
|
|
194
|
+
short_url: string;
|
|
195
|
+
has_scheduled_changes: boolean;
|
|
196
|
+
change_scheduled_at: number | null;
|
|
197
|
+
source: string;
|
|
198
|
+
remaining_count: number;
|
|
199
|
+
}
|
|
200
|
+
type RazorpayRawEvents = {
|
|
201
|
+
'razorpay.payment.authorized': RazorpayWebhookEvent;
|
|
202
|
+
'razorpay.payment.captured': RazorpayWebhookEvent;
|
|
203
|
+
'razorpay.payment.failed': RazorpayWebhookEvent;
|
|
204
|
+
'razorpay.order.paid': RazorpayWebhookEvent;
|
|
205
|
+
'razorpay.refund.created': RazorpayWebhookEvent;
|
|
206
|
+
'razorpay.refund.processed': RazorpayWebhookEvent;
|
|
207
|
+
'razorpay.payment_link.paid': RazorpayWebhookEvent;
|
|
208
|
+
'razorpay.payment_link.cancelled': RazorpayWebhookEvent;
|
|
209
|
+
'razorpay.payment_link.expired': RazorpayWebhookEvent;
|
|
210
|
+
'razorpay.subscription.authenticated': RazorpayWebhookEvent;
|
|
211
|
+
'razorpay.subscription.activated': RazorpayWebhookEvent;
|
|
212
|
+
'razorpay.subscription.charged': RazorpayWebhookEvent;
|
|
213
|
+
'razorpay.subscription.completed': RazorpayWebhookEvent;
|
|
214
|
+
'razorpay.subscription.updated': RazorpayWebhookEvent;
|
|
215
|
+
'razorpay.subscription.pending': RazorpayWebhookEvent;
|
|
216
|
+
'razorpay.subscription.halted': RazorpayWebhookEvent;
|
|
217
|
+
'razorpay.subscription.paused': RazorpayWebhookEvent;
|
|
218
|
+
'razorpay.subscription.resumed': RazorpayWebhookEvent;
|
|
219
|
+
'razorpay.subscription.cancelled': RazorpayWebhookEvent;
|
|
220
|
+
};
|
|
221
|
+
type StripRazorpayPrefix<T> = T extends `razorpay.${infer Rest}` ? Rest : T;
|
|
222
|
+
type RazorpayEventsClean = StripRazorpayPrefix<keyof RazorpayRawEvents>;
|
|
223
|
+
interface RazorpayWebhookEvent {
|
|
224
|
+
entity: 'event';
|
|
225
|
+
/**
|
|
226
|
+
* The ID of the Razorpay account that the webhook is for.
|
|
227
|
+
*/
|
|
228
|
+
account_id: string;
|
|
229
|
+
/**
|
|
230
|
+
* The webhook event name.
|
|
231
|
+
*/
|
|
232
|
+
event: RazorpayEventsClean;
|
|
233
|
+
/**
|
|
234
|
+
* The resources that the webhook contains.
|
|
235
|
+
*/
|
|
236
|
+
contains: string[];
|
|
237
|
+
/**
|
|
238
|
+
* The payload of the webhook.
|
|
239
|
+
*/
|
|
240
|
+
payload: {
|
|
241
|
+
/**
|
|
242
|
+
* The payment resource that the webhook contains.
|
|
243
|
+
*/
|
|
244
|
+
payment?: {
|
|
245
|
+
entity: RazorpayPayment;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* The order resource that the webhook contains.
|
|
249
|
+
*/
|
|
250
|
+
order?: {
|
|
251
|
+
entity: RazorpayOrder;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* The refund resource that the webhook contains.
|
|
255
|
+
*/
|
|
256
|
+
refund?: {
|
|
257
|
+
entity: RazorpayRefund;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* The payment link resource that the webhook contains.
|
|
261
|
+
*/
|
|
262
|
+
payment_link?: {
|
|
263
|
+
entity: RazorpayPaymentLink;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* The subscription resource that the webhook contains.
|
|
267
|
+
*/
|
|
268
|
+
subscription?: {
|
|
269
|
+
entity: RazorpaySubscription;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
created_at: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type { RazorpayCustomer, RazorpayErrorResponse, RazorpayEventsClean, RazorpayOrder, RazorpayPayment, RazorpayPaymentLink, RazorpayPaymentLinkCustomer, RazorpayPaymentLinkPaymentEntry, RazorpayPlan, RazorpayRawEvents, RazorpayRefund, RazorpaySubscription, RazorpayWebhookEvent };
|
package/dist/schema.js
ADDED
package/dist/schema.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Payment, Checkout, Customer, Subscription, Refund, Invoice } from '@paykit-sdk/core';
|
|
2
|
+
import { RazorpayPayment, RazorpayPaymentLink, RazorpayCustomer, RazorpaySubscription, RazorpayPlan, RazorpayRefund } from '../schema.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
declare const Payment$inboundSchema: (data: RazorpayPayment, overridePaymentUrl?: string | null) => Payment;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
declare const Checkout$inboundSchema: (data: RazorpayPaymentLink) => Checkout;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
declare const Customer$inboundSchema: (data: RazorpayCustomer) => Customer;
|
|
16
|
+
/**
|
|
17
|
+
* Razorpay's subscription entity carries only `plan_id`/`quantity` - the
|
|
18
|
+
* amount, currency and billing interval all live on the plan, so the plan
|
|
19
|
+
* must be fetched and passed in alongside the subscription.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
declare const Subscription$inboundSchema: (data: RazorpaySubscription, plan: RazorpayPlan) => Subscription;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
declare const Refund$inboundSchema: (data: RazorpayRefund) => Refund;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
declare const Invoice$inboundSchema: (data: RazorpayPayment) => Invoice;
|
|
32
|
+
|
|
33
|
+
export { Checkout$inboundSchema, Customer$inboundSchema, Invoice$inboundSchema, Payment$inboundSchema, Refund$inboundSchema, Subscription$inboundSchema };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Payment, Checkout, Customer, Subscription, Refund, Invoice } from '@paykit-sdk/core';
|
|
2
|
+
import { RazorpayPayment, RazorpayPaymentLink, RazorpayCustomer, RazorpaySubscription, RazorpayPlan, RazorpayRefund } from '../schema.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
declare const Payment$inboundSchema: (data: RazorpayPayment, overridePaymentUrl?: string | null) => Payment;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
declare const Checkout$inboundSchema: (data: RazorpayPaymentLink) => Checkout;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
declare const Customer$inboundSchema: (data: RazorpayCustomer) => Customer;
|
|
16
|
+
/**
|
|
17
|
+
* Razorpay's subscription entity carries only `plan_id`/`quantity` - the
|
|
18
|
+
* amount, currency and billing interval all live on the plan, so the plan
|
|
19
|
+
* must be fetched and passed in alongside the subscription.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
declare const Subscription$inboundSchema: (data: RazorpaySubscription, plan: RazorpayPlan) => Subscription;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
declare const Refund$inboundSchema: (data: RazorpayRefund) => Refund;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
declare const Invoice$inboundSchema: (data: RazorpayPayment) => Invoice;
|
|
32
|
+
|
|
33
|
+
export { Checkout$inboundSchema, Customer$inboundSchema, Invoice$inboundSchema, Payment$inboundSchema, Refund$inboundSchema, Subscription$inboundSchema };
|