@payclave/sdk-server 0.1.1 → 0.3.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/CHANGELOG.md +37 -0
- package/README.md +192 -7
- package/dist/index.cjs +843 -14
- package/dist/index.d.cts +697 -8
- package/dist/index.d.ts +697 -8
- package/dist/index.js +843 -15
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,10 @@ import { Buffer } from 'node:buffer';
|
|
|
3
3
|
type PayclaveMode = "test" | "live" | (string & {});
|
|
4
4
|
type PayclaveInvoiceStatus = "pending" | "processing" | "paid" | "underpaid" | "overpaid" | "expired" | "failed" | "cancelled" | (string & {});
|
|
5
5
|
type PayclavePaymentStatus = "detected" | "validating" | "confirmed" | "failed" | "duplicate" | "underpaid" | "overpaid" | (string & {});
|
|
6
|
-
|
|
6
|
+
type PayclaveInvoiceCollectionState = "draft" | "open" | "past_due" | "partially_paid" | "paid" | "void" | "uncollectible" | (string & {});
|
|
7
|
+
type PayclaveMigrationState = "current" | "review_required" | (string & {});
|
|
8
|
+
type PayclaveSourceType = "api" | "dashboard" | "payment_link" | "sdk" | "legacy" | (string & {});
|
|
9
|
+
declare const PAYCLAVE_WEBHOOK_EVENT_TYPES: readonly ["invoice.issued", "invoice.paid", "invoice.partially_paid", "invoice.past_due", "invoice.overpaid", "invoice.voided", "invoice.uncollectible", "invoice.refund_recorded", "invoice.refund_verified", "invoice.refund_failed", "invoice.payment_received_after_void", "invoice.payment_received_after_uncollectible", "invoice.expired", "payment_link.completed", "payment_link.expired", "payment.failed", "payment.underpaid", "payment.overpaid"];
|
|
7
10
|
type PayclaveWebhookEventType = (typeof PAYCLAVE_WEBHOOK_EVENT_TYPES)[number];
|
|
8
11
|
type PayclaveWebhookDeliveryStatus = "pending" | "delivering" | "delivered" | "retry_scheduled" | "failed" | (string & {});
|
|
9
12
|
type PayclaveMetadata = Record<string, unknown>;
|
|
@@ -17,6 +20,20 @@ type PayclaveServerClientOptions = {
|
|
|
17
20
|
type PayclaveRequestOptions = {
|
|
18
21
|
signal?: AbortSignal;
|
|
19
22
|
};
|
|
23
|
+
type PayclaveInvoicePDF = {
|
|
24
|
+
bytes: Uint8Array;
|
|
25
|
+
contentType: "application/pdf";
|
|
26
|
+
filename: string;
|
|
27
|
+
requestId: string | null;
|
|
28
|
+
};
|
|
29
|
+
type PayclaveReconciliationDownload = {
|
|
30
|
+
stream: ReadableStream<Uint8Array>;
|
|
31
|
+
contentType: "application/zip";
|
|
32
|
+
filename: string;
|
|
33
|
+
byteSize: number | null;
|
|
34
|
+
sha256: string | null;
|
|
35
|
+
requestId: string | null;
|
|
36
|
+
};
|
|
20
37
|
type CreateCheckoutSessionInput = PayclaveRequestOptions & {
|
|
21
38
|
amount: string;
|
|
22
39
|
customerEmail?: string;
|
|
@@ -34,6 +51,191 @@ type CreateInvoiceInput = PayclaveRequestOptions & {
|
|
|
34
51
|
expiresInMinutes?: number;
|
|
35
52
|
idempotencyKey?: string;
|
|
36
53
|
};
|
|
54
|
+
type PayclaveInvoiceCustomer = {
|
|
55
|
+
name?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
company?: string;
|
|
58
|
+
billingAddress?: string | null;
|
|
59
|
+
};
|
|
60
|
+
type PayclaveInvoiceLineInput = {
|
|
61
|
+
id?: string;
|
|
62
|
+
description: string;
|
|
63
|
+
sku?: string | null;
|
|
64
|
+
quantity: string;
|
|
65
|
+
unitAmount: string;
|
|
66
|
+
};
|
|
67
|
+
type PayclaveInvoiceDiscountInput = {
|
|
68
|
+
type: "fixed";
|
|
69
|
+
amount: string;
|
|
70
|
+
percentage?: never;
|
|
71
|
+
} | {
|
|
72
|
+
type: "percentage";
|
|
73
|
+
percentage: string;
|
|
74
|
+
amount?: never;
|
|
75
|
+
};
|
|
76
|
+
type PayclaveInvoiceTaxInput = {
|
|
77
|
+
id?: string;
|
|
78
|
+
label: string;
|
|
79
|
+
jurisdiction?: string | null;
|
|
80
|
+
registrationReference?: string | null;
|
|
81
|
+
amount: string;
|
|
82
|
+
};
|
|
83
|
+
type PayclaveInvoiceReminderSchedule = {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
daysBeforeDue?: number[];
|
|
86
|
+
onDue?: boolean;
|
|
87
|
+
daysAfterDue?: number[];
|
|
88
|
+
};
|
|
89
|
+
type PayclaveInvoiceDraftFields = {
|
|
90
|
+
customer: PayclaveInvoiceCustomer;
|
|
91
|
+
lines: PayclaveInvoiceLineInput[];
|
|
92
|
+
discount?: PayclaveInvoiceDiscountInput | null;
|
|
93
|
+
taxes?: PayclaveInvoiceTaxInput[];
|
|
94
|
+
dueAt?: string | null;
|
|
95
|
+
paymentTerms?: string;
|
|
96
|
+
memo?: string;
|
|
97
|
+
footer?: string;
|
|
98
|
+
purchaseOrderNumber?: string;
|
|
99
|
+
externalReference?: string | null;
|
|
100
|
+
currencyCode?: string;
|
|
101
|
+
metadata?: PayclaveMetadata;
|
|
102
|
+
successUrl?: string | null;
|
|
103
|
+
cancelUrl?: string | null;
|
|
104
|
+
checkoutExpiresInMinutes?: number;
|
|
105
|
+
reminderSchedule?: PayclaveInvoiceReminderSchedule;
|
|
106
|
+
};
|
|
107
|
+
type CreateInvoiceDraftInput = PayclaveRequestOptions & PayclaveInvoiceDraftFields & {
|
|
108
|
+
idempotencyKey?: string;
|
|
109
|
+
};
|
|
110
|
+
type UpdateInvoiceDraftInput = PayclaveRequestOptions & PayclaveInvoiceDraftFields & {
|
|
111
|
+
version: number;
|
|
112
|
+
idempotencyKey?: string;
|
|
113
|
+
};
|
|
114
|
+
type IssueInvoiceInput = PayclaveRequestOptions & {
|
|
115
|
+
version: number;
|
|
116
|
+
send?: boolean;
|
|
117
|
+
idempotencyKey?: string;
|
|
118
|
+
};
|
|
119
|
+
type PayclaveInvoiceDelivery = {
|
|
120
|
+
id: string;
|
|
121
|
+
type: "issue" | "send" | "reminder" | (string & {});
|
|
122
|
+
recipient: string;
|
|
123
|
+
templateVersion: string;
|
|
124
|
+
status: string;
|
|
125
|
+
providerMessageId: string | null;
|
|
126
|
+
lastError: string | null;
|
|
127
|
+
scheduledFor: string;
|
|
128
|
+
sentAt: string | null;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
reminderKey: string | null;
|
|
131
|
+
};
|
|
132
|
+
type PayclaveInvoiceActivityEvent = {
|
|
133
|
+
id: string;
|
|
134
|
+
action: string;
|
|
135
|
+
actorType: string;
|
|
136
|
+
actorId: string;
|
|
137
|
+
changes: Record<string, unknown>;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
};
|
|
140
|
+
type InvoiceActionInput = PayclaveRequestOptions & {
|
|
141
|
+
reason?: string;
|
|
142
|
+
idempotencyKey?: string;
|
|
143
|
+
};
|
|
144
|
+
type CreateInvoiceCheckoutSessionInput = PayclaveRequestOptions & {
|
|
145
|
+
idempotencyKey?: string;
|
|
146
|
+
};
|
|
147
|
+
type RecordInvoiceRefundReferenceInput = PayclaveRequestOptions & {
|
|
148
|
+
paymentId: string;
|
|
149
|
+
amount: string;
|
|
150
|
+
reason: string;
|
|
151
|
+
/** Omit in test mode; Payclave simulates one. */
|
|
152
|
+
externalTransactionHash?: string;
|
|
153
|
+
chainId: number;
|
|
154
|
+
tokenContract: string;
|
|
155
|
+
/** Where the refund was sent. Optional when the payment has a verified paying wallet. */
|
|
156
|
+
destinationAddress?: string;
|
|
157
|
+
/** Required when destinationAddress is not the verified paying wallet. */
|
|
158
|
+
destinationReason?: string;
|
|
159
|
+
idempotencyKey?: string;
|
|
160
|
+
};
|
|
161
|
+
type CheckInvoiceRefundInput = PayclaveRequestOptions & {
|
|
162
|
+
paymentId: string;
|
|
163
|
+
amount: string;
|
|
164
|
+
destinationAddress: string;
|
|
165
|
+
};
|
|
166
|
+
type PayclaveRefundRiskCode = "different_destination" | "repeat_destination" | "overpayment" | "sent_from_other_wallet" | (string & {});
|
|
167
|
+
type PayclaveRefundDecision = {
|
|
168
|
+
allowed: boolean;
|
|
169
|
+
blockedReason?: string;
|
|
170
|
+
requiresApproval: boolean;
|
|
171
|
+
destinationSource?: "verified_payer" | "provided" | (string & {});
|
|
172
|
+
refundableAmount: string;
|
|
173
|
+
overpaidAmount: string;
|
|
174
|
+
warnings: Array<{
|
|
175
|
+
code: PayclaveRefundRiskCode;
|
|
176
|
+
message: string;
|
|
177
|
+
}>;
|
|
178
|
+
};
|
|
179
|
+
type ListInvoicesInput = PayclaveRequestOptions & {
|
|
180
|
+
limit?: number;
|
|
181
|
+
startingAfter?: string;
|
|
182
|
+
collectionState?: PayclaveInvoiceCollectionState;
|
|
183
|
+
};
|
|
184
|
+
type PayclavePaymentLinkStatus = "draft" | "active" | "paused" | "completed" | "expired" | "archived" | (string & {});
|
|
185
|
+
type PayclavePaymentLinkAmountType = "fixed" | "customer_entered";
|
|
186
|
+
type PayclavePaymentLinkUsageType = "single_use" | "reusable";
|
|
187
|
+
type PayclavePaymentLinkCollect = {
|
|
188
|
+
email: boolean;
|
|
189
|
+
name: boolean;
|
|
190
|
+
reference: boolean;
|
|
191
|
+
};
|
|
192
|
+
type PayclavePaymentLinkFields = {
|
|
193
|
+
mode?: "test" | "live";
|
|
194
|
+
title: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
amountType: PayclavePaymentLinkAmountType;
|
|
197
|
+
amount?: string;
|
|
198
|
+
minimumAmount?: string;
|
|
199
|
+
maximumAmount?: string;
|
|
200
|
+
currencyCode?: "USDC" | "USDT";
|
|
201
|
+
usageType?: PayclavePaymentLinkUsageType;
|
|
202
|
+
activeAt?: string | null;
|
|
203
|
+
expiresAt?: string | null;
|
|
204
|
+
collect?: Partial<PayclavePaymentLinkCollect>;
|
|
205
|
+
referencePrefix?: string;
|
|
206
|
+
successUrl?: string | null;
|
|
207
|
+
cancelUrl?: string | null;
|
|
208
|
+
successMessage?: string;
|
|
209
|
+
metadata?: PayclaveMetadata;
|
|
210
|
+
};
|
|
211
|
+
type CreatePaymentLinkInput = PayclaveRequestOptions & PayclavePaymentLinkFields & {
|
|
212
|
+
idempotencyKey?: string;
|
|
213
|
+
};
|
|
214
|
+
type UpdatePaymentLinkInput = PayclaveRequestOptions & PayclavePaymentLinkFields & {
|
|
215
|
+
version: number;
|
|
216
|
+
idempotencyKey?: string;
|
|
217
|
+
};
|
|
218
|
+
type PaymentLinkActionInput = PayclaveRequestOptions & {
|
|
219
|
+
idempotencyKey?: string;
|
|
220
|
+
};
|
|
221
|
+
type ReleasePaymentLinkReservationInput = PayclaveRequestOptions & {
|
|
222
|
+
acknowledgeLatePaymentRisk: true;
|
|
223
|
+
idempotencyKey?: string;
|
|
224
|
+
};
|
|
225
|
+
type ListPaymentLinksInput = PayclaveRequestOptions & {
|
|
226
|
+
limit?: number;
|
|
227
|
+
startingAfter?: string;
|
|
228
|
+
status?: PayclavePaymentLinkStatus;
|
|
229
|
+
amountType?: PayclavePaymentLinkAmountType;
|
|
230
|
+
usageType?: PayclavePaymentLinkUsageType;
|
|
231
|
+
currencyCode?: "USDC" | "USDT";
|
|
232
|
+
search?: string;
|
|
233
|
+
createdFrom?: string;
|
|
234
|
+
createdTo?: string;
|
|
235
|
+
};
|
|
236
|
+
type ListPaymentLinkPaymentsInput = PayclaveRequestOptions & {
|
|
237
|
+
limit?: number;
|
|
238
|
+
};
|
|
37
239
|
type CreateWebhookEndpointInput = PayclaveRequestOptions & {
|
|
38
240
|
url: string;
|
|
39
241
|
eventTypes?: PayclaveWebhookEventType[];
|
|
@@ -44,17 +246,186 @@ type CreateTestWebhookInput = PayclaveRequestOptions & {
|
|
|
44
246
|
};
|
|
45
247
|
type ListWebhookDeliveriesInput = PayclaveRequestOptions & {
|
|
46
248
|
limit?: number;
|
|
249
|
+
endpointId?: string;
|
|
250
|
+
eventType?: PayclaveWebhookEventType;
|
|
251
|
+
status?: PayclaveWebhookDeliveryStatus;
|
|
252
|
+
createdFrom?: string;
|
|
253
|
+
createdTo?: string;
|
|
254
|
+
replayStatus?: "original" | "replay";
|
|
255
|
+
responseFamily?: "2xx" | "3xx" | "4xx" | "5xx" | "network";
|
|
256
|
+
};
|
|
257
|
+
type ReplayWebhookDeliveryInput = PayclaveRequestOptions & {
|
|
258
|
+
idempotencyKey: string;
|
|
259
|
+
};
|
|
260
|
+
type UpdateWebhookEndpointInput = PayclaveRequestOptions & {
|
|
261
|
+
url?: string;
|
|
262
|
+
enabled?: boolean;
|
|
263
|
+
eventTypes?: PayclaveWebhookEventType[];
|
|
264
|
+
alertsEnabled?: boolean;
|
|
265
|
+
alertThreshold?: number;
|
|
266
|
+
recoveryAlertsEnabled?: boolean;
|
|
267
|
+
idempotencyKey: string;
|
|
268
|
+
};
|
|
269
|
+
type WebhookEndpointActionInput = PayclaveRequestOptions & {
|
|
270
|
+
idempotencyKey: string;
|
|
271
|
+
};
|
|
272
|
+
type ListWebhookIncidentsInput = PayclaveRequestOptions & {
|
|
273
|
+
status?: "open" | "resolved";
|
|
274
|
+
};
|
|
275
|
+
declare const PAYCLAVE_RECONCILIATION_SCHEMA_VERSION: "2026-08-29.v1";
|
|
276
|
+
type PayclaveReconciliationDateBasis = "invoice_created" | "invoice_issued" | "invoice_paid" | "payment_confirmed" | "transaction_observed";
|
|
277
|
+
type GetReconciliationSummaryInput = PayclaveRequestOptions & {
|
|
278
|
+
dateBasis: PayclaveReconciliationDateBasis;
|
|
279
|
+
from: string;
|
|
280
|
+
to: string;
|
|
281
|
+
timezone?: string;
|
|
282
|
+
invoiceStatuses?: PayclaveInvoiceStatus[];
|
|
283
|
+
paymentStatuses?: PayclavePaymentStatus[];
|
|
284
|
+
settlementTokens?: Array<"USDC" | "USDT" | (string & {})>;
|
|
285
|
+
exceptionOnly?: boolean;
|
|
286
|
+
};
|
|
287
|
+
type PayclaveReconciliationTokenSummary = {
|
|
288
|
+
tokenSymbol: string;
|
|
289
|
+
tokenContract: string;
|
|
290
|
+
chainId: number;
|
|
291
|
+
invoiceCount: number;
|
|
292
|
+
paymentCount: number;
|
|
293
|
+
exceptionCount: number;
|
|
294
|
+
invoiceTotal: string;
|
|
295
|
+
customerGrossPaid: string;
|
|
296
|
+
platformFeeExpected: string;
|
|
297
|
+
platformFeeCollected: string;
|
|
298
|
+
expectedMerchantSettlement: string;
|
|
299
|
+
merchantSettled: string;
|
|
300
|
+
outstanding: string;
|
|
301
|
+
overpayment: string;
|
|
302
|
+
nominalStablecoinUsd: string;
|
|
303
|
+
invoiceStatusCounts: Record<string, number>;
|
|
304
|
+
paymentStatusCounts: Record<string, number>;
|
|
305
|
+
};
|
|
306
|
+
type PayclaveReconciliationSummary = {
|
|
307
|
+
schemaVersion: string;
|
|
308
|
+
dateBasis: PayclaveReconciliationDateBasis;
|
|
309
|
+
from: string;
|
|
310
|
+
to: string;
|
|
311
|
+
cutoffAt: string;
|
|
312
|
+
timezone: string;
|
|
313
|
+
rowCounts: Record<string, number>;
|
|
314
|
+
summaryByToken: PayclaveReconciliationTokenSummary[];
|
|
315
|
+
exceptions: Array<{
|
|
316
|
+
invoiceId: string;
|
|
317
|
+
invoiceNumber: string;
|
|
318
|
+
state: string;
|
|
319
|
+
reasonCodes: string[];
|
|
320
|
+
tokenSymbol: string;
|
|
321
|
+
customerGrossPaid: string;
|
|
322
|
+
outstanding: string;
|
|
323
|
+
}>;
|
|
324
|
+
warnings: string[];
|
|
325
|
+
};
|
|
326
|
+
type PayclaveReconciliationSchema = {
|
|
327
|
+
schemaVersion: string;
|
|
328
|
+
formats: string[];
|
|
329
|
+
dateBases: PayclaveReconciliationDateBasis[];
|
|
330
|
+
maximumRangeDays: number;
|
|
331
|
+
rangeEnd: "exclusive" | (string & {});
|
|
332
|
+
retention: string;
|
|
333
|
+
files: Array<{
|
|
334
|
+
name: string;
|
|
335
|
+
description: string;
|
|
336
|
+
columns: Array<{
|
|
337
|
+
name: string;
|
|
338
|
+
type: string;
|
|
339
|
+
description: string;
|
|
340
|
+
pii: boolean;
|
|
341
|
+
}>;
|
|
342
|
+
}>;
|
|
343
|
+
stateRules: Array<{
|
|
344
|
+
state: string;
|
|
345
|
+
description: string;
|
|
346
|
+
}>;
|
|
347
|
+
};
|
|
348
|
+
type PayclaveReconciliationExportStatus = "queued" | "running" | "ready" | "failed" | "cancelled" | "expired" | (string & {});
|
|
349
|
+
type PayclaveReconciliationFilters = {
|
|
350
|
+
from: string;
|
|
351
|
+
to: string;
|
|
352
|
+
invoiceStatuses?: PayclaveInvoiceStatus[];
|
|
353
|
+
paymentStatuses?: PayclavePaymentStatus[];
|
|
354
|
+
settlementTokens?: string[];
|
|
355
|
+
exceptionOnly: boolean;
|
|
356
|
+
};
|
|
357
|
+
type PayclaveReconciliationFile = {
|
|
358
|
+
name: string;
|
|
359
|
+
mediaType: string;
|
|
360
|
+
rows: number;
|
|
361
|
+
bytes: number;
|
|
362
|
+
sha256: string;
|
|
363
|
+
};
|
|
364
|
+
type PayclaveReconciliationExport = {
|
|
365
|
+
id: string;
|
|
366
|
+
merchantId: string;
|
|
367
|
+
mode: PayclaveMode;
|
|
368
|
+
status: PayclaveReconciliationExportStatus;
|
|
369
|
+
format: "csv" | "json" | (string & {});
|
|
370
|
+
schemaVersion: string;
|
|
371
|
+
filters: PayclaveReconciliationFilters;
|
|
372
|
+
dateBasis: PayclaveReconciliationDateBasis;
|
|
373
|
+
cutoffAt?: string | null;
|
|
374
|
+
timezone: string;
|
|
375
|
+
requestedBy: string;
|
|
376
|
+
requestedAt: string;
|
|
377
|
+
startedAt?: string | null;
|
|
378
|
+
completedAt?: string | null;
|
|
379
|
+
cancelledAt?: string | null;
|
|
380
|
+
expiresAt?: string | null;
|
|
381
|
+
rowCounts?: Record<string, number>;
|
|
382
|
+
byteSize?: number;
|
|
383
|
+
fileManifest?: PayclaveReconciliationFile[];
|
|
384
|
+
sha256?: string;
|
|
385
|
+
summaryByToken?: PayclaveReconciliationTokenSummary[];
|
|
386
|
+
warnings?: string[];
|
|
387
|
+
errorCategory?: string;
|
|
388
|
+
attempts: number;
|
|
389
|
+
includePII: boolean;
|
|
390
|
+
piiFields?: string[];
|
|
391
|
+
createdAt: string;
|
|
392
|
+
updatedAt: string;
|
|
393
|
+
statusUrl?: string;
|
|
394
|
+
};
|
|
395
|
+
type CreateReconciliationExportInput = GetReconciliationSummaryInput & {
|
|
396
|
+
mode?: "test" | "live";
|
|
397
|
+
format: "csv" | "json";
|
|
398
|
+
includePII?: boolean;
|
|
399
|
+
idempotencyKey?: string;
|
|
400
|
+
schemaVersion?: string;
|
|
401
|
+
};
|
|
402
|
+
type ListReconciliationExportsInput = PayclaveRequestOptions & {
|
|
403
|
+
limit?: number;
|
|
404
|
+
startingAfter?: string;
|
|
405
|
+
};
|
|
406
|
+
type PayclaveReconciliationExportList = {
|
|
407
|
+
items: PayclaveReconciliationExport[];
|
|
408
|
+
hasMore: boolean;
|
|
409
|
+
nextCursor?: string;
|
|
410
|
+
};
|
|
411
|
+
type ReconciliationExportActionInput = PayclaveRequestOptions & {
|
|
412
|
+
idempotencyKey?: string;
|
|
47
413
|
};
|
|
48
414
|
type PayclaveCreatedCheckoutSession = {
|
|
49
415
|
id: string;
|
|
50
416
|
checkoutId: string;
|
|
51
417
|
object: "checkout_session";
|
|
52
418
|
mode: PayclaveMode;
|
|
419
|
+
sourceType?: PayclaveSourceType;
|
|
53
420
|
status: "pending";
|
|
421
|
+
collectionState: PayclaveInvoiceCollectionState;
|
|
54
422
|
invoiceId: string;
|
|
55
423
|
invoiceNumber: string;
|
|
56
424
|
amountDue: string;
|
|
57
425
|
amountReceived: string;
|
|
426
|
+
total: string;
|
|
427
|
+
customerAmountPaid: string;
|
|
428
|
+
customerAmountRemaining: string;
|
|
58
429
|
currencyCode: string;
|
|
59
430
|
chainId: number;
|
|
60
431
|
tokenSymbol: string;
|
|
@@ -72,11 +443,16 @@ type PayclaveCheckoutSession = {
|
|
|
72
443
|
checkoutId: string;
|
|
73
444
|
object: "checkout_session";
|
|
74
445
|
mode: PayclaveMode;
|
|
446
|
+
sourceType?: PayclaveSourceType;
|
|
75
447
|
status: PayclaveInvoiceStatus;
|
|
448
|
+
collectionState: PayclaveInvoiceCollectionState;
|
|
76
449
|
invoiceId: string | null;
|
|
77
450
|
invoiceNumber: string | null;
|
|
78
451
|
amountDue: string;
|
|
79
452
|
amountReceived: string;
|
|
453
|
+
total: string;
|
|
454
|
+
customerAmountPaid: string;
|
|
455
|
+
customerAmountRemaining: string;
|
|
80
456
|
currencyCode: string;
|
|
81
457
|
chainId: number;
|
|
82
458
|
tokenSymbol: string;
|
|
@@ -95,19 +471,48 @@ type PayclaveCheckoutSession = {
|
|
|
95
471
|
*/
|
|
96
472
|
platformFee?: string;
|
|
97
473
|
netAmount?: string;
|
|
474
|
+
expectedMerchantSettlement?: string;
|
|
475
|
+
merchantAmountSettled?: string;
|
|
476
|
+
overpaymentAmount?: string;
|
|
98
477
|
/** Present once a payment has been detected for the session. */
|
|
99
478
|
paymentId?: string;
|
|
100
479
|
paymentStatus?: PayclavePaymentStatus;
|
|
101
480
|
txHash?: string;
|
|
102
481
|
sourceTxHash?: string;
|
|
103
482
|
settlementTxHash?: string;
|
|
483
|
+
} & PayclavePaymentSource;
|
|
484
|
+
/**
|
|
485
|
+
* The network and token the customer paid with, which can differ from the
|
|
486
|
+
* settlement token (`currencyCode`/`chainId`) when the payment was routed
|
|
487
|
+
* across chains. Each field is present only when the provider reported it.
|
|
488
|
+
*/
|
|
489
|
+
type PayclavePaymentSource = {
|
|
490
|
+
/** Lowercase network slug, e.g. "base", "polygon", "tron", "solana". */
|
|
491
|
+
sourceNetwork?: string;
|
|
492
|
+
/** EVM chain id of the source network; absent for non-EVM networks. */
|
|
493
|
+
sourceChainId?: number;
|
|
494
|
+
/** Symbol of the token the customer paid with, e.g. "USDC". */
|
|
495
|
+
sourceTokenSymbol?: string;
|
|
496
|
+
sourceTokenAddress?: string;
|
|
497
|
+
sourceTokenLogoUrl?: string;
|
|
104
498
|
};
|
|
105
499
|
type PayclaveInvoice = {
|
|
106
500
|
id: string;
|
|
107
|
-
invoiceNumber: string;
|
|
501
|
+
invoiceNumber: string | null;
|
|
108
502
|
object: "invoice";
|
|
109
503
|
mode: PayclaveMode;
|
|
110
504
|
status: PayclaveInvoiceStatus;
|
|
505
|
+
collectionState: PayclaveInvoiceCollectionState;
|
|
506
|
+
subtotal: string;
|
|
507
|
+
discountTotal: string;
|
|
508
|
+
taxTotal: string;
|
|
509
|
+
total: string;
|
|
510
|
+
customerAmountPaid: string;
|
|
511
|
+
customerAmountRemaining: string;
|
|
512
|
+
expectedMerchantSettlement: string;
|
|
513
|
+
merchantAmountSettled: string;
|
|
514
|
+
overpaymentAmount: string;
|
|
515
|
+
migrationState: PayclaveMigrationState;
|
|
111
516
|
amountDue: string;
|
|
112
517
|
amountReceived: string;
|
|
113
518
|
platformFee: string;
|
|
@@ -118,10 +523,176 @@ type PayclaveInvoice = {
|
|
|
118
523
|
settlementWalletAddress: string;
|
|
119
524
|
externalReference: string | null;
|
|
120
525
|
metadata: PayclaveMetadata;
|
|
121
|
-
expiresAt: string;
|
|
526
|
+
expiresAt: string | null;
|
|
122
527
|
paidAt: string | null;
|
|
123
528
|
cancelledAt: string | null;
|
|
529
|
+
voidedAt?: string | null;
|
|
530
|
+
uncollectibleAt?: string | null;
|
|
531
|
+
createdAt: string;
|
|
532
|
+
internalId?: string;
|
|
533
|
+
sourceType?: PayclaveSourceType;
|
|
534
|
+
version?: number;
|
|
535
|
+
calculationVersion?: string;
|
|
536
|
+
sellerSnapshot?: {
|
|
537
|
+
displayName: string;
|
|
538
|
+
businessEmail?: string | null;
|
|
539
|
+
address?: string | null;
|
|
540
|
+
taxIdentifier?: string | null;
|
|
541
|
+
} | null;
|
|
542
|
+
customer?: PayclaveInvoiceCustomer;
|
|
543
|
+
lines?: Array<PayclaveInvoiceLineInput & {
|
|
544
|
+
lineTotal: string;
|
|
545
|
+
}>;
|
|
546
|
+
discount?: PayclaveInvoiceDiscountInput | null;
|
|
547
|
+
taxes?: PayclaveInvoiceTaxInput[];
|
|
548
|
+
paymentTerms?: string;
|
|
549
|
+
memo?: string;
|
|
550
|
+
footer?: string;
|
|
551
|
+
purchaseOrderNumber?: string;
|
|
552
|
+
dueAt?: string | null;
|
|
553
|
+
issuedAt?: string | null;
|
|
554
|
+
publicToken?: string | null;
|
|
555
|
+
hostedInvoiceEnabled?: boolean;
|
|
556
|
+
hostedInvoiceUrl?: string | null;
|
|
557
|
+
checkoutSessions?: PayclaveInvoiceCheckoutSession[];
|
|
558
|
+
payments?: PayclaveInvoicePayment[];
|
|
559
|
+
adjustments?: PayclavePaymentAdjustment[];
|
|
560
|
+
deliveries?: PayclaveInvoiceDelivery[];
|
|
561
|
+
activity?: PayclaveInvoiceActivityEvent[];
|
|
562
|
+
reminderSchedule?: PayclaveInvoiceReminderSchedule;
|
|
563
|
+
remindersPausedAt?: string | null;
|
|
564
|
+
lastReminderAt?: string | null;
|
|
565
|
+
nextReminderAt?: string | null;
|
|
566
|
+
lastSentAt?: string | null;
|
|
567
|
+
updatedAt?: string;
|
|
568
|
+
lastActivityAt?: string | null;
|
|
569
|
+
};
|
|
570
|
+
type PayclaveInvoiceCheckoutSession = {
|
|
571
|
+
id: string;
|
|
572
|
+
checkoutId: string;
|
|
573
|
+
status: string;
|
|
574
|
+
sourceType?: PayclaveSourceType;
|
|
575
|
+
amountDue: string;
|
|
576
|
+
checkoutUrl: string;
|
|
577
|
+
expiresAt: string;
|
|
578
|
+
completedAt: string | null;
|
|
579
|
+
createdAt: string;
|
|
580
|
+
};
|
|
581
|
+
type PayclaveInvoicePayment = {
|
|
582
|
+
id: string;
|
|
583
|
+
invoiceId: string;
|
|
584
|
+
checkoutSessionId?: string;
|
|
585
|
+
transactionId: string | null;
|
|
586
|
+
sourceTransactionId: string | null;
|
|
587
|
+
settlementTransactionId: string | null;
|
|
588
|
+
mode: PayclaveMode;
|
|
589
|
+
status: PayclavePaymentStatus;
|
|
590
|
+
amountExpected: string;
|
|
591
|
+
amountReceived: string;
|
|
592
|
+
customerAmountTendered?: string;
|
|
593
|
+
customerAmountCredited?: string;
|
|
594
|
+
expectedMerchantSettlement?: string;
|
|
595
|
+
merchantAmountSettled?: string;
|
|
596
|
+
platformFeeExpected?: string;
|
|
597
|
+
platformFeeCollected?: string;
|
|
598
|
+
platformFee: string;
|
|
599
|
+
netAmount: string;
|
|
600
|
+
chainId: number;
|
|
601
|
+
settlementWalletAddress: string;
|
|
602
|
+
failureReason: string | null;
|
|
603
|
+
confirmedAt: string | null;
|
|
604
|
+
createdAt: string;
|
|
605
|
+
};
|
|
606
|
+
type PayclavePaymentAdjustment = {
|
|
607
|
+
id: string;
|
|
608
|
+
merchantId: string;
|
|
609
|
+
mode: PayclaveMode;
|
|
610
|
+
invoiceId: string;
|
|
611
|
+
paymentId?: string;
|
|
612
|
+
type: "refund_reference" | "write_off" | "correction" | (string & {});
|
|
613
|
+
amount: string;
|
|
614
|
+
reason: string;
|
|
615
|
+
externalTransactionHash?: string;
|
|
616
|
+
chainId?: number;
|
|
617
|
+
tokenContract?: string;
|
|
618
|
+
/** Refund references only: whether Payclave verified the transfer onchain. */
|
|
619
|
+
verificationStatus?: "unverified" | "pending" | "verified" | "failed" | (string & {});
|
|
620
|
+
destinationAddress?: string;
|
|
621
|
+
destinationSource?: "verified_payer" | "provided" | (string & {});
|
|
622
|
+
destinationReason?: string;
|
|
623
|
+
riskFlags?: PayclaveRefundRiskCode[];
|
|
624
|
+
/** Where a verified refund actually came from. */
|
|
625
|
+
senderAddress?: string;
|
|
626
|
+
verifiedAt?: string;
|
|
627
|
+
verificationFailureReason?: string;
|
|
628
|
+
/** A failed refund's hash, released so the transfer can be recorded again. */
|
|
629
|
+
failedTransactionHash?: string;
|
|
630
|
+
createdByType: string;
|
|
631
|
+
createdById: string;
|
|
632
|
+
createdAt: string;
|
|
633
|
+
};
|
|
634
|
+
type PayclaveInvoiceCheckoutSessionCreated = {
|
|
635
|
+
invoiceId: string;
|
|
636
|
+
invoiceNumber: string;
|
|
637
|
+
checkoutSessionId: string;
|
|
638
|
+
checkoutUrl: string;
|
|
639
|
+
amountDue: string;
|
|
640
|
+
currencyCode: string;
|
|
641
|
+
expiresAt: string;
|
|
642
|
+
};
|
|
643
|
+
type PayclaveRefundReferenceResult = {
|
|
644
|
+
adjustment: PayclavePaymentAdjustment;
|
|
645
|
+
invoice: PayclaveInvoice;
|
|
646
|
+
};
|
|
647
|
+
type PayclaveInvoiceList = {
|
|
648
|
+
items: PayclaveInvoice[];
|
|
649
|
+
hasMore: boolean;
|
|
650
|
+
nextCursor: string | null;
|
|
651
|
+
};
|
|
652
|
+
type PayclavePaymentLink = {
|
|
653
|
+
id: string;
|
|
654
|
+
object: "payment_link";
|
|
655
|
+
publicId: string;
|
|
656
|
+
url: string;
|
|
657
|
+
merchantId: string;
|
|
658
|
+
mode: PayclaveMode;
|
|
659
|
+
status: PayclavePaymentLinkStatus;
|
|
660
|
+
version: number;
|
|
661
|
+
title: string;
|
|
662
|
+
description: string;
|
|
663
|
+
amountType: PayclavePaymentLinkAmountType;
|
|
664
|
+
amount: string | null;
|
|
665
|
+
minimumAmount: string | null;
|
|
666
|
+
maximumAmount: string | null;
|
|
667
|
+
currencyCode: string;
|
|
668
|
+
chainId: number;
|
|
669
|
+
tokenContract: string;
|
|
670
|
+
usageType: PayclavePaymentLinkUsageType;
|
|
671
|
+
completedPayments: number;
|
|
672
|
+
startedCheckouts: number;
|
|
673
|
+
activeAt: string | null;
|
|
674
|
+
expiresAt: string | null;
|
|
675
|
+
pausedAt: string | null;
|
|
676
|
+
archivedAt: string | null;
|
|
677
|
+
collect: PayclavePaymentLinkCollect;
|
|
678
|
+
referencePrefix: string;
|
|
679
|
+
successUrl: string | null;
|
|
680
|
+
cancelUrl: string | null;
|
|
681
|
+
successMessage: string;
|
|
682
|
+
metadata: PayclaveMetadata;
|
|
683
|
+
reservationInvoiceId: string | null;
|
|
684
|
+
reservedAt: string | null;
|
|
124
685
|
createdAt: string;
|
|
686
|
+
updatedAt: string;
|
|
687
|
+
lastCheckoutCreatedAt: string | null;
|
|
688
|
+
};
|
|
689
|
+
type PayclavePaymentLinkList = {
|
|
690
|
+
items: PayclavePaymentLink[];
|
|
691
|
+
hasMore: boolean;
|
|
692
|
+
nextCursor: string | null;
|
|
693
|
+
};
|
|
694
|
+
type PayclavePaymentLinkPayments = {
|
|
695
|
+
items: PayclaveInvoice[];
|
|
125
696
|
};
|
|
126
697
|
type PayclavePayment = {
|
|
127
698
|
id: string;
|
|
@@ -133,6 +704,16 @@ type PayclavePayment = {
|
|
|
133
704
|
status: PayclavePaymentStatus;
|
|
134
705
|
amountExpected: string;
|
|
135
706
|
amountReceived: string;
|
|
707
|
+
customerAmountTendered: string;
|
|
708
|
+
customerAmountCredited: string;
|
|
709
|
+
expectedMerchantSettlement: string;
|
|
710
|
+
merchantAmountSettled: string;
|
|
711
|
+
platformFeeExpected: string;
|
|
712
|
+
platformFeeCollected: string;
|
|
713
|
+
payerWalletAddress: string;
|
|
714
|
+
payerWalletEvidence: string;
|
|
715
|
+
creditEvidenceType: string;
|
|
716
|
+
migrationState: PayclaveMigrationState;
|
|
136
717
|
platformFee: string;
|
|
137
718
|
netAmount: string;
|
|
138
719
|
chainId: number;
|
|
@@ -140,7 +721,7 @@ type PayclavePayment = {
|
|
|
140
721
|
failureReason: string | null;
|
|
141
722
|
confirmedAt: string | null;
|
|
142
723
|
createdAt: string;
|
|
143
|
-
};
|
|
724
|
+
} & PayclavePaymentSource;
|
|
144
725
|
type PayclaveWebhookEndpoint = {
|
|
145
726
|
id: string;
|
|
146
727
|
object: "webhook_endpoint";
|
|
@@ -148,19 +729,74 @@ type PayclaveWebhookEndpoint = {
|
|
|
148
729
|
url: string;
|
|
149
730
|
enabled: boolean;
|
|
150
731
|
eventTypes: PayclaveWebhookEventType[];
|
|
151
|
-
signingSecret
|
|
732
|
+
signingSecret?: string;
|
|
733
|
+
copyRequired?: boolean;
|
|
734
|
+
currentSecretVersion: number;
|
|
735
|
+
secretVersions: PayclaveWebhookSecretVersion[];
|
|
736
|
+
secretOverlap: {
|
|
737
|
+
status: "none" | "active" | (string & {});
|
|
738
|
+
expiresAt: string | null;
|
|
739
|
+
previousVersion: number | null;
|
|
740
|
+
};
|
|
152
741
|
createdAt: string;
|
|
742
|
+
updatedAt: string;
|
|
743
|
+
};
|
|
744
|
+
type PayclaveWebhookSecretVersion = {
|
|
745
|
+
version: number;
|
|
746
|
+
createdAt: string;
|
|
747
|
+
activatesAt: string;
|
|
748
|
+
expiresAt: string | null;
|
|
749
|
+
revokedAt: string | null;
|
|
750
|
+
testedAt: string | null;
|
|
751
|
+
};
|
|
752
|
+
type PayclaveWebhookIncident = {
|
|
753
|
+
id: string;
|
|
754
|
+
object: "webhook_incident";
|
|
755
|
+
endpointId: string;
|
|
756
|
+
mode: PayclaveMode;
|
|
757
|
+
status: "open" | "resolved" | (string & {});
|
|
758
|
+
reasonFamily: string;
|
|
759
|
+
failureCount: number;
|
|
760
|
+
affectedDeliveryCount: number;
|
|
761
|
+
affectedDeliveryIds: string[];
|
|
762
|
+
firstFailedAt: string;
|
|
763
|
+
lastFailedAt: string;
|
|
764
|
+
openedAt: string;
|
|
765
|
+
resolvedAt: string | null;
|
|
766
|
+
lastDeliveryId: string;
|
|
767
|
+
lastAttemptId: string;
|
|
768
|
+
createdAt: string;
|
|
769
|
+
updatedAt: string;
|
|
153
770
|
};
|
|
154
771
|
type PayclaveWebhookDeliveryAttemptSummary = {
|
|
155
772
|
responseStatusCode: number | null;
|
|
156
773
|
errorMessage: string | null;
|
|
774
|
+
errorCategory?: string | null;
|
|
775
|
+
attemptedAt: string;
|
|
776
|
+
};
|
|
777
|
+
type PayclaveWebhookDeliveryAttempt = {
|
|
778
|
+
id: string;
|
|
779
|
+
attemptNumber: number;
|
|
780
|
+
responseStatusCode: number | null;
|
|
781
|
+
responseBody: string | null;
|
|
782
|
+
responseBodyTruncated: boolean;
|
|
783
|
+
errorMessage: string | null;
|
|
784
|
+
errorCategory?: string | null;
|
|
785
|
+
responseHeaders?: Record<string, string> | null;
|
|
786
|
+
requestHeaders?: Record<string, string> | null;
|
|
787
|
+
destinationHost?: string;
|
|
788
|
+
sanitizedAt?: string;
|
|
157
789
|
attemptedAt: string;
|
|
790
|
+
startedAt: string;
|
|
791
|
+
completedAt: string;
|
|
792
|
+
durationMs: number;
|
|
158
793
|
};
|
|
159
794
|
type PayclaveWebhookDelivery = {
|
|
160
795
|
id: string;
|
|
161
796
|
object: "webhook_delivery";
|
|
162
797
|
endpointId: string;
|
|
163
798
|
invoiceId: string | null;
|
|
799
|
+
eventId: string;
|
|
164
800
|
eventType: PayclaveWebhookEventType | (string & {});
|
|
165
801
|
status: PayclaveWebhookDeliveryStatus;
|
|
166
802
|
idempotencyKey: string;
|
|
@@ -169,6 +805,12 @@ type PayclaveWebhookDelivery = {
|
|
|
169
805
|
deliveredAt: string | null;
|
|
170
806
|
attemptCount: number;
|
|
171
807
|
latestAttempt: PayclaveWebhookDeliveryAttemptSummary | null;
|
|
808
|
+
latestErrorCategory?: string | null;
|
|
809
|
+
replayOfDeliveryId: string | null;
|
|
810
|
+
replayRootDeliveryId: string | null;
|
|
811
|
+
replayedBy: string | null;
|
|
812
|
+
replayedAt: string | null;
|
|
813
|
+
attempts?: PayclaveWebhookDeliveryAttempt[];
|
|
172
814
|
createdAt: string;
|
|
173
815
|
};
|
|
174
816
|
type PayclaveWebhookData = Record<string, unknown>;
|
|
@@ -180,7 +822,7 @@ type PayclaveWebhookEvent<TData = PayclaveWebhookData> = {
|
|
|
180
822
|
createdAt: string;
|
|
181
823
|
data: TData;
|
|
182
824
|
};
|
|
183
|
-
declare const PAYCLAVE_API_ERROR_CODES: readonly ["ACCOUNT_SUSPENDED", "API_KEY_FORBIDDEN", "API_KEY_REQUIRED", "AUTH_FORBIDDEN", "GOOGLE_ACCOUNT_CONFLICT", "GOOGLE_AUTH_CANCELLED", "GOOGLE_AUTH_CODE_MISSING", "GOOGLE_EMAIL_UNVERIFIED", "GOOGLE_AUTH_EXCHANGE_FAILED", "GOOGLE_AUTH_FAILED", "GOOGLE_PROFILE_UNAVAILABLE", "GOOGLE_AUTH_STATE_INVALID", "AUTH_PASSWORD_ALREADY_SET", "AUTH_PROVIDER_UNAVAILABLE", "AUTH_REQUIRED", "USE_SOCIAL_LOGIN", "AUTH_VERIFIED_EMAIL_REQUIRED", "DEFAULT_WALLET_REQUIRED", "INTERNAL_JOB_UNAUTHORIZED", "INTERNAL_SERVER_ERROR", "INVALID_AMOUNT", "INVALID_API_KEY", "INVALID_CREDENTIALS", "INVALID_EXPIRY", "INVALID_IDEMPOTENCY_KEY", "INVALID_DEPOSIT_NETWORK", "INVALID_WALLET_PAYMENT_ATTEMPT", "INVALID_TX_HASH", "INVALID_WALLET_ADDRESS", "NOT_FOUND", "RATE_LIMIT_EXCEEDED", "REQUEST_ERROR", "SCAN_OR_COPY_UNAVAILABLE", "WALLET_PAYMENTS_UNAVAILABLE", "UNSUPPORTED_DEFAULT_WALLET", "VALIDATION_ERROR", "WEBHOOK_DELIVERY_NOT_FOUND", "WEBHOOK_ENDPOINT_NOT_FOUND", "WEBHOOK_EVENT_UNSUPPORTED", "WEBHOOK_SIGNATURE_INVALID", "CHECKOUT_SESSION_NOT_PAYABLE", "INVOICE_NOT_FOUND", "INVOICE_STATE_MISMATCH", "INVOICE_TRANSITION_GUARD_FAILED", "IDEMPOTENCY_KEY_CONFLICT"];
|
|
825
|
+
declare const PAYCLAVE_API_ERROR_CODES: readonly ["ACCOUNT_SUSPENDED", "ACTIVE_MERCHANT_REQUIRED", "API_KEY_FORBIDDEN", "API_KEY_REQUIRED", "AUTH_FORBIDDEN", "GOOGLE_ACCOUNT_CONFLICT", "GOOGLE_AUTH_CANCELLED", "GOOGLE_AUTH_CODE_MISSING", "GOOGLE_EMAIL_UNVERIFIED", "GOOGLE_AUTH_EXCHANGE_FAILED", "GOOGLE_AUTH_FAILED", "GOOGLE_PROFILE_UNAVAILABLE", "GOOGLE_AUTH_STATE_INVALID", "AUTH_PASSWORD_ALREADY_SET", "AUTH_PROXY_UNAUTHORIZED", "AUTH_PROVIDER_UNAVAILABLE", "AUTH_REQUIRED", "USE_SOCIAL_LOGIN", "AUTH_VERIFIED_EMAIL_REQUIRED", "DEFAULT_WALLET_REQUIRED", "INTERNAL_JOB_UNAUTHORIZED", "INTERNAL_SERVER_ERROR", "INVALID_AMOUNT", "INVALID_API_KEY", "INVALID_CREDENTIALS", "INVALID_EXPIRY", "INVALID_IDEMPOTENCY_KEY", "INVALID_DEPOSIT_NETWORK", "INVALID_WALLET_PAYMENT_ATTEMPT", "INVALID_TX_HASH", "INVALID_WALLET_ADDRESS", "MODE_MISMATCH", "MEMBERSHIP_REVOKED", "MEMBER_ALREADY_EXISTS", "MEMBER_LIMIT_REACHED", "LAST_OWNER_REQUIRED", "INVITATION_ALREADY_PENDING", "INVITATION_ALREADY_USED", "INVITATION_EMAIL_MISMATCH", "INVITATION_EXPIRED", "INVITATION_NOT_FOUND", "OWNERSHIP_TRANSFER_REQUIRED", "NOT_FOUND", "PUBLIC_KEY_FIELD_NOT_ALLOWED", "PERMISSION_DENIED", "RATE_LIMIT_EXCEEDED", "REAUTH_REQUIRED", "STEP_UP_REQUIRED", "REQUEST_ERROR", "REQUEST_TOO_LARGE", "SCAN_OR_COPY_UNAVAILABLE", "WALLET_PAYMENTS_UNAVAILABLE", "UNSUPPORTED_DEFAULT_WALLET", "VALIDATION_ERROR", "WEBHOOK_DELIVERY_NOT_FOUND", "WEBHOOK_ENDPOINT_DISABLED", "WEBHOOK_ENDPOINT_NOT_FOUND", "WEBHOOK_EVENT_UNSUPPORTED", "WEBHOOK_INCIDENT_NOT_FOUND", "WEBHOOK_SIGNATURE_INVALID", "SECRET_OVERLAP_ACTIVE", "SECRET_OVERLAP_EXPIRED", "CHECKOUT_SESSION_NOT_PAYABLE", "EVENT_TYPE_UNSUPPORTED", "EVENT_PAYLOAD_TOO_LARGE", "JOURNEY_TOKEN_INVALID", "EVENT_DUPLICATE", "TIMESTAMP_OUT_OF_RANGE", "INVOICE_NOT_FOUND", "INVOICE_STATE_MISMATCH", "INVOICE_TRANSITION_GUARD_FAILED", "INVOICE_NOT_EDITABLE", "INVOICE_ALREADY_ISSUED", "INVOICE_NOT_PAYABLE", "INVOICE_PDF_UNAVAILABLE", "INVOICE_VERSION_CONFLICT", "CURRENCY_MISMATCH", "INVALID_TOTAL", "CUSTOMER_EMAIL_REQUIRED", "IDEMPOTENCY_KEY_CONFLICT", "PAYMENT_LINK_NOT_FOUND", "PAYMENT_LINK_VERSION_CONFLICT", "LINK_INACTIVE", "LINK_EXPIRED", "LINK_ALREADY_USED", "LINK_RESERVED", "AMOUNT_OUT_OF_RANGE", "FIELD_REQUIRED", "FEATURE_UNAVAILABLE", "MODE_UNAVAILABLE", "CONFIG_CHANGED", "RATE_LIMITED", "EXPORT_RANGE_TOO_LARGE", "EXPORT_NOT_READY", "EXPORT_EXPIRED", "EXPORT_CANCELLED", "EXPORT_SCHEMA_UNSUPPORTED", "EXPORT_TOO_LARGE_FOR_SYNC"];
|
|
184
826
|
type PayclaveApiErrorCode = (typeof PAYCLAVE_API_ERROR_CODES)[number];
|
|
185
827
|
declare const PAYCLAVE_SERVER_SDK_ERROR_CODES: readonly ["INVALID_SECRET_KEY", "INVALID_API_BASE_URL", "INVALID_TIMEOUT", "INVALID_ID", "INVALID_AMOUNT", "INVALID_EXPIRY", "INVALID_METADATA", "INVALID_IDEMPOTENCY_KEY", "INVALID_LIMIT", "INVALID_WEBHOOK_URL", "INVALID_REQUEST_BODY", "INVALID_RESPONSE", "NETWORK_ERROR", "TIMEOUT", "ABORTED"];
|
|
186
828
|
type PayclaveServerSdkErrorCode = (typeof PAYCLAVE_SERVER_SDK_ERROR_CODES)[number];
|
|
@@ -217,7 +859,7 @@ declare class PayclaveError extends Error {
|
|
|
217
859
|
};
|
|
218
860
|
}
|
|
219
861
|
declare const PAYCLAVE_SERVER_SDK_NAME = "payclave-sdk-server";
|
|
220
|
-
declare const PAYCLAVE_SERVER_SDK_VERSION = "0.
|
|
862
|
+
declare const PAYCLAVE_SERVER_SDK_VERSION = "0.3.0";
|
|
221
863
|
declare function assertPayclaveWebhookSignature({ payload, signature, secret, toleranceSeconds, now, }: VerifyWebhookSignatureInput): void;
|
|
222
864
|
declare function verifyPayclaveWebhookSignature(input: VerifyWebhookSignatureInput): boolean;
|
|
223
865
|
declare function constructPayclaveWebhookEvent<TData extends PayclaveWebhookData = PayclaveWebhookData>(input: VerifyWebhookSignatureInput): PayclaveWebhookEvent<TData>;
|
|
@@ -225,12 +867,59 @@ declare function createPayclaveServerClient({ secretKey, apiBaseUrl, fetcher, ti
|
|
|
225
867
|
createCheckoutSession: (input: CreateCheckoutSessionInput) => Promise<PayclaveCreatedCheckoutSession>;
|
|
226
868
|
getCheckoutSession: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveCheckoutSession>;
|
|
227
869
|
createInvoice: (input: CreateInvoiceInput) => Promise<PayclaveInvoice>;
|
|
870
|
+
createInvoiceDraft: (input: CreateInvoiceDraftInput) => Promise<PayclaveInvoice>;
|
|
871
|
+
listInvoices: (input?: ListInvoicesInput) => Promise<PayclaveInvoiceList>;
|
|
228
872
|
getInvoice: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveInvoice>;
|
|
873
|
+
downloadInvoicePDF: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveInvoicePDF>;
|
|
874
|
+
updateInvoiceDraft: (id: string, input: UpdateInvoiceDraftInput) => Promise<PayclaveInvoice>;
|
|
875
|
+
issueInvoice: (id: string, input: IssueInvoiceInput) => Promise<PayclaveInvoice>;
|
|
876
|
+
sendInvoice: (id: string, input?: CreateInvoiceCheckoutSessionInput) => Promise<PayclaveInvoice>;
|
|
877
|
+
remindInvoice: (id: string, input?: CreateInvoiceCheckoutSessionInput) => Promise<PayclaveInvoice>;
|
|
878
|
+
createInvoiceCheckoutSession: (id: string, input?: CreateInvoiceCheckoutSessionInput) => Promise<PayclaveInvoiceCheckoutSessionCreated>;
|
|
879
|
+
voidInvoice: (id: string, input?: InvoiceActionInput) => Promise<PayclaveInvoice>;
|
|
880
|
+
voidInvoiceRemaining: (id: string, input?: InvoiceActionInput) => Promise<PayclaveInvoice>;
|
|
881
|
+
markInvoiceUncollectible: (id: string, input?: InvoiceActionInput) => Promise<PayclaveInvoice>;
|
|
882
|
+
duplicateInvoice: (id: string, input?: CreateInvoiceCheckoutSessionInput) => Promise<PayclaveInvoice>;
|
|
883
|
+
checkInvoiceRefund: (id: string, input: CheckInvoiceRefundInput) => Promise<PayclaveRefundDecision>;
|
|
884
|
+
recordInvoiceRefundReference: (id: string, input: RecordInvoiceRefundReferenceInput) => Promise<PayclaveRefundReferenceResult>;
|
|
885
|
+
createPaymentLink: (input: CreatePaymentLinkInput) => Promise<PayclavePaymentLink>;
|
|
886
|
+
listPaymentLinks: (input?: ListPaymentLinksInput) => Promise<PayclavePaymentLinkList>;
|
|
887
|
+
getPaymentLink: (id: string, options?: PayclaveRequestOptions) => Promise<PayclavePaymentLink>;
|
|
888
|
+
updatePaymentLink: (id: string, input: UpdatePaymentLinkInput) => Promise<PayclavePaymentLink>;
|
|
889
|
+
pausePaymentLink: (id: string, input?: PaymentLinkActionInput) => Promise<PayclavePaymentLink>;
|
|
890
|
+
resumePaymentLink: (id: string, input?: PaymentLinkActionInput) => Promise<PayclavePaymentLink>;
|
|
891
|
+
archivePaymentLink: (id: string, input?: PaymentLinkActionInput) => Promise<PayclavePaymentLink>;
|
|
892
|
+
duplicatePaymentLink: (id: string, input?: PaymentLinkActionInput) => Promise<PayclavePaymentLink>;
|
|
893
|
+
releasePaymentLinkReservation: (id: string, input: ReleasePaymentLinkReservationInput) => Promise<PayclavePaymentLink>;
|
|
894
|
+
listPaymentLinkPayments: (id: string, input?: ListPaymentLinkPaymentsInput) => Promise<PayclavePaymentLinkPayments>;
|
|
229
895
|
getPayment: (id: string, options?: PayclaveRequestOptions) => Promise<PayclavePayment>;
|
|
230
896
|
createWebhookEndpoint: (input: CreateWebhookEndpointInput) => Promise<PayclaveWebhookEndpoint>;
|
|
897
|
+
listWebhookEndpoints: (options?: PayclaveRequestOptions) => Promise<PayclaveWebhookEndpoint[]>;
|
|
898
|
+
getWebhookEndpoint: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveWebhookEndpoint>;
|
|
899
|
+
updateWebhookEndpoint: (id: string, input: UpdateWebhookEndpointInput) => Promise<PayclaveWebhookEndpoint>;
|
|
900
|
+
archiveWebhookEndpoint: (id: string, input: WebhookEndpointActionInput) => Promise<{
|
|
901
|
+
id: string;
|
|
902
|
+
object: "webhook_endpoint";
|
|
903
|
+
archived: true;
|
|
904
|
+
}>;
|
|
905
|
+
rotateWebhookSecret: (id: string, input: WebhookEndpointActionInput) => Promise<PayclaveWebhookEndpoint>;
|
|
906
|
+
endWebhookSecretOverlap: (id: string, input: WebhookEndpointActionInput) => Promise<PayclaveWebhookEndpoint>;
|
|
231
907
|
createTestWebhook: (input: CreateTestWebhookInput) => Promise<PayclaveWebhookDelivery>;
|
|
232
908
|
listWebhookDeliveries: (input?: ListWebhookDeliveriesInput) => Promise<PayclaveWebhookDelivery[]>;
|
|
909
|
+
getWebhookDelivery: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveWebhookDelivery>;
|
|
910
|
+
listWebhookDeliveryAttempts: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveWebhookDeliveryAttempt[]>;
|
|
911
|
+
replayWebhookDelivery: (id: string, input: ReplayWebhookDeliveryInput) => Promise<PayclaveWebhookDelivery>;
|
|
912
|
+
listWebhookIncidents: (input?: ListWebhookIncidentsInput) => Promise<PayclaveWebhookIncident[]>;
|
|
913
|
+
getWebhookIncident: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveWebhookIncident>;
|
|
914
|
+
getReconciliationSchema: (version?: string, options?: PayclaveRequestOptions) => Promise<PayclaveReconciliationSchema>;
|
|
915
|
+
getReconciliationSummary: (input: GetReconciliationSummaryInput) => Promise<PayclaveReconciliationSummary>;
|
|
916
|
+
createReconciliationExport: (input: CreateReconciliationExportInput) => Promise<PayclaveReconciliationExport>;
|
|
917
|
+
listReconciliationExports: (input?: ListReconciliationExportsInput) => Promise<PayclaveReconciliationExportList>;
|
|
918
|
+
getReconciliationExport: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveReconciliationExport>;
|
|
919
|
+
cancelReconciliationExport: (id: string, input?: ReconciliationExportActionInput) => Promise<PayclaveReconciliationExport>;
|
|
920
|
+
downloadReconciliationExport: (id: string, options?: PayclaveRequestOptions) => Promise<PayclaveReconciliationDownload>;
|
|
233
921
|
};
|
|
234
922
|
type PayclaveServerClient = ReturnType<typeof createPayclaveServerClient>;
|
|
235
923
|
|
|
236
|
-
export {
|
|
924
|
+
export { PAYCLAVE_API_ERROR_CODES, PAYCLAVE_RECONCILIATION_SCHEMA_VERSION, PAYCLAVE_SERVER_SDK_ERROR_CODES, PAYCLAVE_SERVER_SDK_NAME, PAYCLAVE_SERVER_SDK_VERSION, PAYCLAVE_WEBHOOK_EVENT_TYPES, PAYCLAVE_WEBHOOK_VERIFICATION_ERROR_CODES, PayclaveError, assertPayclaveWebhookSignature, constructPayclaveWebhookEvent, createPayclaveServerClient, verifyPayclaveWebhookSignature };
|
|
925
|
+
export type { CheckInvoiceRefundInput, CreateCheckoutSessionInput, CreateInvoiceCheckoutSessionInput, CreateInvoiceDraftInput, CreateInvoiceInput, CreatePaymentLinkInput, CreateReconciliationExportInput, CreateTestWebhookInput, CreateWebhookEndpointInput, GetReconciliationSummaryInput, InvoiceActionInput, IssueInvoiceInput, ListInvoicesInput, ListPaymentLinkPaymentsInput, ListPaymentLinksInput, ListReconciliationExportsInput, ListWebhookDeliveriesInput, ListWebhookIncidentsInput, PayclaveApiErrorCode, PayclaveCheckoutSession, PayclaveCreatedCheckoutSession, PayclaveErrorCode, PayclaveFetcher, PayclaveInvoice, PayclaveInvoiceActivityEvent, PayclaveInvoiceCheckoutSession, PayclaveInvoiceCheckoutSessionCreated, PayclaveInvoiceCollectionState, PayclaveInvoiceCustomer, PayclaveInvoiceDelivery, PayclaveInvoiceDiscountInput, PayclaveInvoiceDraftFields, PayclaveInvoiceLineInput, PayclaveInvoiceList, PayclaveInvoicePDF, PayclaveInvoicePayment, PayclaveInvoiceReminderSchedule, PayclaveInvoiceStatus, PayclaveInvoiceTaxInput, PayclaveMetadata, PayclaveMigrationState, PayclaveMode, PayclavePayment, PayclavePaymentAdjustment, PayclavePaymentLink, PayclavePaymentLinkAmountType, PayclavePaymentLinkCollect, PayclavePaymentLinkFields, PayclavePaymentLinkList, PayclavePaymentLinkPayments, PayclavePaymentLinkStatus, PayclavePaymentLinkUsageType, PayclavePaymentSource, PayclavePaymentStatus, PayclaveReconciliationDateBasis, PayclaveReconciliationDownload, PayclaveReconciliationExport, PayclaveReconciliationExportList, PayclaveReconciliationExportStatus, PayclaveReconciliationFile, PayclaveReconciliationFilters, PayclaveReconciliationSchema, PayclaveReconciliationSummary, PayclaveReconciliationTokenSummary, PayclaveRefundDecision, PayclaveRefundReferenceResult, PayclaveRefundRiskCode, PayclaveRequestOptions, PayclaveServerClient, PayclaveServerClientOptions, PayclaveServerSdkErrorCode, PayclaveSourceType, PayclaveWebhookData, PayclaveWebhookDelivery, PayclaveWebhookDeliveryAttempt, PayclaveWebhookDeliveryAttemptSummary, PayclaveWebhookDeliveryStatus, PayclaveWebhookEndpoint, PayclaveWebhookEvent, PayclaveWebhookEventType, PayclaveWebhookIncident, PayclaveWebhookSecretVersion, PayclaveWebhookVerificationErrorCode, PaymentLinkActionInput, ReconciliationExportActionInput, RecordInvoiceRefundReferenceInput, ReleasePaymentLinkReservationInput, ReplayWebhookDeliveryInput, UpdateInvoiceDraftInput, UpdatePaymentLinkInput, UpdateWebhookEndpointInput, VerifyWebhookSignatureInput, WebhookEndpointActionInput };
|