@strimz/shared-types 0.12.3 → 0.13.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.
Files changed (47) hide show
  1. package/README.md +10 -8
  2. package/dist/analytics.cjs +26 -2
  3. package/dist/analytics.cjs.map +1 -1
  4. package/dist/analytics.d.cts +136 -136
  5. package/dist/analytics.d.ts +136 -136
  6. package/dist/analytics.js +26 -2
  7. package/dist/analytics.js.map +1 -1
  8. package/dist/api-keys.d.cts +20 -20
  9. package/dist/api-keys.d.ts +20 -20
  10. package/dist/compliance.d.cts +4 -4
  11. package/dist/compliance.d.ts +4 -4
  12. package/dist/customers.d.cts +6 -6
  13. package/dist/customers.d.ts +6 -6
  14. package/dist/events.cjs +26 -2
  15. package/dist/events.cjs.map +1 -1
  16. package/dist/events.d.cts +1435 -1435
  17. package/dist/events.d.ts +1435 -1435
  18. package/dist/events.js +26 -2
  19. package/dist/events.js.map +1 -1
  20. package/dist/index.cjs +29 -2
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +15 -15
  23. package/dist/index.d.ts +15 -15
  24. package/dist/index.js +27 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/invoices.d.cts +10 -10
  27. package/dist/invoices.d.ts +10 -10
  28. package/dist/merchants.d.cts +20 -20
  29. package/dist/merchants.d.ts +20 -20
  30. package/dist/payment-sessions.cjs +29 -2
  31. package/dist/payment-sessions.cjs.map +1 -1
  32. package/dist/payment-sessions.d.cts +60 -19
  33. package/dist/payment-sessions.d.ts +60 -19
  34. package/dist/payment-sessions.js +27 -3
  35. package/dist/payment-sessions.js.map +1 -1
  36. package/dist/refunds.d.cts +36 -36
  37. package/dist/refunds.d.ts +36 -36
  38. package/dist/storefronts.d.cts +27 -27
  39. package/dist/storefronts.d.ts +27 -27
  40. package/dist/subscriptions.d.cts +30 -30
  41. package/dist/subscriptions.d.ts +30 -30
  42. package/dist/transactions.d.cts +12 -12
  43. package/dist/transactions.d.ts +12 -12
  44. package/dist/webhooks.d.cts +22 -22
  45. package/dist/webhooks.d.ts +22 -22
  46. package/package.json +2 -2
  47. package/src/payment-sessions.ts +30 -2
@@ -53,10 +53,9 @@ declare const invoiceSchema: z.ZodObject<{
53
53
  }, "strip", z.ZodTypeAny, {
54
54
  number: string;
55
55
  status: "void" | "draft" | "sent" | "paid" | "overdue";
56
- total: string;
57
- currency: "USDC" | "EURC";
58
- merchantId: string;
59
56
  id: string;
57
+ merchantId: string;
58
+ createdAt: string;
60
59
  customerName: string | null;
61
60
  customerEmail: string | null;
62
61
  lineItems: [{
@@ -69,20 +68,20 @@ declare const invoiceSchema: z.ZodObject<{
69
68
  unitAmount: string;
70
69
  }[]];
71
70
  subtotal: string;
71
+ total: string;
72
+ currency: "USDC" | "EURC";
72
73
  note: string | null;
73
74
  sessionId: string | null;
74
75
  dueAt: string;
75
76
  paidAt: string | null;
76
77
  sentAt: string | null;
77
- createdAt: string;
78
78
  updatedAt: string;
79
79
  }, {
80
80
  number: string;
81
81
  status: "void" | "draft" | "sent" | "paid" | "overdue";
82
- total: string;
83
- currency: "USDC" | "EURC";
84
- merchantId: string;
85
82
  id: string;
83
+ merchantId: string;
84
+ createdAt: string;
86
85
  customerName: string | null;
87
86
  customerEmail: string | null;
88
87
  lineItems: [{
@@ -95,12 +94,13 @@ declare const invoiceSchema: z.ZodObject<{
95
94
  unitAmount: string;
96
95
  }[]];
97
96
  subtotal: string;
97
+ total: string;
98
+ currency: "USDC" | "EURC";
98
99
  note: string | null;
99
100
  sessionId: string | null;
100
101
  dueAt: string;
101
102
  paidAt: string | null;
102
103
  sentAt: string | null;
103
- createdAt: string;
104
104
  updatedAt: string;
105
105
  }>;
106
106
  type Invoice = z.infer<typeof invoiceSchema>;
@@ -124,7 +124,6 @@ declare const createInvoiceInputSchema: z.ZodObject<{
124
124
  note: z.ZodOptional<z.ZodString>;
125
125
  dueInDays: z.ZodDefault<z.ZodNumber>;
126
126
  }, "strip", z.ZodTypeAny, {
127
- currency: "USDC" | "EURC";
128
127
  lineItems: [{
129
128
  description: string;
130
129
  quantity: number;
@@ -134,12 +133,12 @@ declare const createInvoiceInputSchema: z.ZodObject<{
134
133
  quantity: number;
135
134
  unitAmount: string;
136
135
  }[]];
136
+ currency: "USDC" | "EURC";
137
137
  dueInDays: number;
138
138
  customerName?: string | undefined;
139
139
  customerEmail?: string | undefined;
140
140
  note?: string | undefined;
141
141
  }, {
142
- currency: "USDC" | "EURC";
143
142
  lineItems: [{
144
143
  description: string;
145
144
  quantity: number;
@@ -149,6 +148,7 @@ declare const createInvoiceInputSchema: z.ZodObject<{
149
148
  quantity: number;
150
149
  unitAmount: string;
151
150
  }[]];
151
+ currency: "USDC" | "EURC";
152
152
  customerName?: string | undefined;
153
153
  customerEmail?: string | undefined;
154
154
  note?: string | undefined;
@@ -53,10 +53,9 @@ declare const invoiceSchema: z.ZodObject<{
53
53
  }, "strip", z.ZodTypeAny, {
54
54
  number: string;
55
55
  status: "void" | "draft" | "sent" | "paid" | "overdue";
56
- total: string;
57
- currency: "USDC" | "EURC";
58
- merchantId: string;
59
56
  id: string;
57
+ merchantId: string;
58
+ createdAt: string;
60
59
  customerName: string | null;
61
60
  customerEmail: string | null;
62
61
  lineItems: [{
@@ -69,20 +68,20 @@ declare const invoiceSchema: z.ZodObject<{
69
68
  unitAmount: string;
70
69
  }[]];
71
70
  subtotal: string;
71
+ total: string;
72
+ currency: "USDC" | "EURC";
72
73
  note: string | null;
73
74
  sessionId: string | null;
74
75
  dueAt: string;
75
76
  paidAt: string | null;
76
77
  sentAt: string | null;
77
- createdAt: string;
78
78
  updatedAt: string;
79
79
  }, {
80
80
  number: string;
81
81
  status: "void" | "draft" | "sent" | "paid" | "overdue";
82
- total: string;
83
- currency: "USDC" | "EURC";
84
- merchantId: string;
85
82
  id: string;
83
+ merchantId: string;
84
+ createdAt: string;
86
85
  customerName: string | null;
87
86
  customerEmail: string | null;
88
87
  lineItems: [{
@@ -95,12 +94,13 @@ declare const invoiceSchema: z.ZodObject<{
95
94
  unitAmount: string;
96
95
  }[]];
97
96
  subtotal: string;
97
+ total: string;
98
+ currency: "USDC" | "EURC";
98
99
  note: string | null;
99
100
  sessionId: string | null;
100
101
  dueAt: string;
101
102
  paidAt: string | null;
102
103
  sentAt: string | null;
103
- createdAt: string;
104
104
  updatedAt: string;
105
105
  }>;
106
106
  type Invoice = z.infer<typeof invoiceSchema>;
@@ -124,7 +124,6 @@ declare const createInvoiceInputSchema: z.ZodObject<{
124
124
  note: z.ZodOptional<z.ZodString>;
125
125
  dueInDays: z.ZodDefault<z.ZodNumber>;
126
126
  }, "strip", z.ZodTypeAny, {
127
- currency: "USDC" | "EURC";
128
127
  lineItems: [{
129
128
  description: string;
130
129
  quantity: number;
@@ -134,12 +133,12 @@ declare const createInvoiceInputSchema: z.ZodObject<{
134
133
  quantity: number;
135
134
  unitAmount: string;
136
135
  }[]];
136
+ currency: "USDC" | "EURC";
137
137
  dueInDays: number;
138
138
  customerName?: string | undefined;
139
139
  customerEmail?: string | undefined;
140
140
  note?: string | undefined;
141
141
  }, {
142
- currency: "USDC" | "EURC";
143
142
  lineItems: [{
144
143
  description: string;
145
144
  quantity: number;
@@ -149,6 +148,7 @@ declare const createInvoiceInputSchema: z.ZodObject<{
149
148
  quantity: number;
150
149
  unitAmount: string;
151
150
  }[]];
151
+ currency: "USDC" | "EURC";
152
152
  customerName?: string | undefined;
153
153
  customerEmail?: string | undefined;
154
154
  note?: string | undefined;
@@ -32,13 +32,13 @@ declare const merchantSchema: z.ZodObject<{
32
32
  updatedAt: z.ZodString;
33
33
  }, "strip", z.ZodTypeAny, {
34
34
  status: "active" | "suspended" | "closed";
35
- businessName: string;
36
- email: string;
37
35
  id: string;
38
36
  createdAt: string;
39
37
  updatedAt: string;
40
38
  metadata: Record<string, string | number | boolean | null>;
41
39
  walletAddress: string | null;
40
+ email: string;
41
+ businessName: string;
42
42
  onchainMerchantId: number | null;
43
43
  tier: "free" | "starter" | "growth" | "enterprise";
44
44
  payoutAddress: string | null;
@@ -50,12 +50,12 @@ declare const merchantSchema: z.ZodObject<{
50
50
  whitelabelEnabled: boolean;
51
51
  }, {
52
52
  status: "active" | "suspended" | "closed";
53
- businessName: string;
54
- email: string;
55
53
  id: string;
56
54
  createdAt: string;
57
55
  updatedAt: string;
58
56
  walletAddress: string | null;
57
+ email: string;
58
+ businessName: string;
59
59
  onchainMerchantId: number | null;
60
60
  tier: "free" | "starter" | "growth" | "enterprise";
61
61
  payoutAddress: string | null;
@@ -75,14 +75,14 @@ declare const createMerchantInputSchema: z.ZodObject<{
75
75
  countryCode: z.ZodOptional<z.ZodString>;
76
76
  websiteUrl: z.ZodOptional<z.ZodString>;
77
77
  }, "strip", z.ZodTypeAny, {
78
- businessName: string;
79
78
  email: string;
79
+ businessName: string;
80
80
  password: string;
81
81
  countryCode?: string | undefined;
82
82
  websiteUrl?: string | undefined;
83
83
  }, {
84
- businessName: string;
85
84
  email: string;
85
+ businessName: string;
86
86
  password: string;
87
87
  countryCode?: string | undefined;
88
88
  websiteUrl?: string | undefined;
@@ -126,8 +126,8 @@ declare const updateMerchantInputSchema: z.ZodObject<{
126
126
  subscriptionCharged?: boolean | undefined;
127
127
  }>>;
128
128
  }, "strip", z.ZodTypeAny, {
129
- businessName?: string | undefined;
130
129
  metadata?: Record<string, string | number | boolean | null> | undefined;
130
+ businessName?: string | undefined;
131
131
  payoutAddress?: string | undefined;
132
132
  defaultCurrency?: "USDC" | "EURC" | undefined;
133
133
  countryCode?: string | null | undefined;
@@ -138,8 +138,8 @@ declare const updateMerchantInputSchema: z.ZodObject<{
138
138
  subscriptionCharged?: boolean | undefined;
139
139
  } | undefined;
140
140
  }, {
141
- businessName?: string | undefined;
142
141
  metadata?: Record<string, string | number | boolean | null> | undefined;
142
+ businessName?: string | undefined;
143
143
  payoutAddress?: string | undefined;
144
144
  defaultCurrency?: "USDC" | "EURC" | undefined;
145
145
  countryCode?: string | null | undefined;
@@ -204,14 +204,14 @@ declare const merchantPublicBrandSchema: z.ZodObject<{
204
204
  logoUrl: z.ZodNullable<z.ZodString>;
205
205
  walletAddress: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
206
206
  }, "strip", z.ZodTypeAny, {
207
- businessName: string;
208
207
  id: string;
209
208
  walletAddress: string | null;
209
+ businessName: string;
210
210
  logoUrl: string | null;
211
211
  }, {
212
- businessName: string;
213
212
  id: string;
214
213
  walletAddress: string | null;
214
+ businessName: string;
215
215
  logoUrl: string | null;
216
216
  }>;
217
217
  type MerchantPublicBrand = z.infer<typeof merchantPublicBrandSchema>;
@@ -288,16 +288,16 @@ declare const merchantMemberSchema: z.ZodObject<{
288
288
  invitedAt: z.ZodString;
289
289
  acceptedAt: z.ZodNullable<z.ZodString>;
290
290
  }, "strip", z.ZodTypeAny, {
291
+ id: string;
291
292
  merchantId: string;
292
293
  email: string;
293
- id: string;
294
294
  role: "owner" | "admin" | "developer" | "read_only";
295
295
  invitedAt: string;
296
296
  acceptedAt: string | null;
297
297
  }, {
298
+ id: string;
298
299
  merchantId: string;
299
300
  email: string;
300
- id: string;
301
301
  role: "owner" | "admin" | "developer" | "read_only";
302
302
  invitedAt: string;
303
303
  acceptedAt: string | null;
@@ -350,13 +350,13 @@ declare const loginOutputSchema: z.ZodObject<{
350
350
  updatedAt: z.ZodString;
351
351
  }, "strip", z.ZodTypeAny, {
352
352
  status: "active" | "suspended" | "closed";
353
- businessName: string;
354
- email: string;
355
353
  id: string;
356
354
  createdAt: string;
357
355
  updatedAt: string;
358
356
  metadata: Record<string, string | number | boolean | null>;
359
357
  walletAddress: string | null;
358
+ email: string;
359
+ businessName: string;
360
360
  onchainMerchantId: number | null;
361
361
  tier: "free" | "starter" | "growth" | "enterprise";
362
362
  payoutAddress: string | null;
@@ -368,12 +368,12 @@ declare const loginOutputSchema: z.ZodObject<{
368
368
  whitelabelEnabled: boolean;
369
369
  }, {
370
370
  status: "active" | "suspended" | "closed";
371
- businessName: string;
372
- email: string;
373
371
  id: string;
374
372
  createdAt: string;
375
373
  updatedAt: string;
376
374
  walletAddress: string | null;
375
+ email: string;
376
+ businessName: string;
377
377
  onchainMerchantId: number | null;
378
378
  tier: "free" | "starter" | "growth" | "enterprise";
379
379
  payoutAddress: string | null;
@@ -390,13 +390,13 @@ declare const loginOutputSchema: z.ZodObject<{
390
390
  refreshToken: string;
391
391
  merchant: {
392
392
  status: "active" | "suspended" | "closed";
393
- businessName: string;
394
- email: string;
395
393
  id: string;
396
394
  createdAt: string;
397
395
  updatedAt: string;
398
396
  metadata: Record<string, string | number | boolean | null>;
399
397
  walletAddress: string | null;
398
+ email: string;
399
+ businessName: string;
400
400
  onchainMerchantId: number | null;
401
401
  tier: "free" | "starter" | "growth" | "enterprise";
402
402
  payoutAddress: string | null;
@@ -412,12 +412,12 @@ declare const loginOutputSchema: z.ZodObject<{
412
412
  refreshToken: string;
413
413
  merchant: {
414
414
  status: "active" | "suspended" | "closed";
415
- businessName: string;
416
- email: string;
417
415
  id: string;
418
416
  createdAt: string;
419
417
  updatedAt: string;
420
418
  walletAddress: string | null;
419
+ email: string;
420
+ businessName: string;
421
421
  onchainMerchantId: number | null;
422
422
  tier: "free" | "starter" | "growth" | "enterprise";
423
423
  payoutAddress: string | null;
@@ -32,13 +32,13 @@ declare const merchantSchema: z.ZodObject<{
32
32
  updatedAt: z.ZodString;
33
33
  }, "strip", z.ZodTypeAny, {
34
34
  status: "active" | "suspended" | "closed";
35
- businessName: string;
36
- email: string;
37
35
  id: string;
38
36
  createdAt: string;
39
37
  updatedAt: string;
40
38
  metadata: Record<string, string | number | boolean | null>;
41
39
  walletAddress: string | null;
40
+ email: string;
41
+ businessName: string;
42
42
  onchainMerchantId: number | null;
43
43
  tier: "free" | "starter" | "growth" | "enterprise";
44
44
  payoutAddress: string | null;
@@ -50,12 +50,12 @@ declare const merchantSchema: z.ZodObject<{
50
50
  whitelabelEnabled: boolean;
51
51
  }, {
52
52
  status: "active" | "suspended" | "closed";
53
- businessName: string;
54
- email: string;
55
53
  id: string;
56
54
  createdAt: string;
57
55
  updatedAt: string;
58
56
  walletAddress: string | null;
57
+ email: string;
58
+ businessName: string;
59
59
  onchainMerchantId: number | null;
60
60
  tier: "free" | "starter" | "growth" | "enterprise";
61
61
  payoutAddress: string | null;
@@ -75,14 +75,14 @@ declare const createMerchantInputSchema: z.ZodObject<{
75
75
  countryCode: z.ZodOptional<z.ZodString>;
76
76
  websiteUrl: z.ZodOptional<z.ZodString>;
77
77
  }, "strip", z.ZodTypeAny, {
78
- businessName: string;
79
78
  email: string;
79
+ businessName: string;
80
80
  password: string;
81
81
  countryCode?: string | undefined;
82
82
  websiteUrl?: string | undefined;
83
83
  }, {
84
- businessName: string;
85
84
  email: string;
85
+ businessName: string;
86
86
  password: string;
87
87
  countryCode?: string | undefined;
88
88
  websiteUrl?: string | undefined;
@@ -126,8 +126,8 @@ declare const updateMerchantInputSchema: z.ZodObject<{
126
126
  subscriptionCharged?: boolean | undefined;
127
127
  }>>;
128
128
  }, "strip", z.ZodTypeAny, {
129
- businessName?: string | undefined;
130
129
  metadata?: Record<string, string | number | boolean | null> | undefined;
130
+ businessName?: string | undefined;
131
131
  payoutAddress?: string | undefined;
132
132
  defaultCurrency?: "USDC" | "EURC" | undefined;
133
133
  countryCode?: string | null | undefined;
@@ -138,8 +138,8 @@ declare const updateMerchantInputSchema: z.ZodObject<{
138
138
  subscriptionCharged?: boolean | undefined;
139
139
  } | undefined;
140
140
  }, {
141
- businessName?: string | undefined;
142
141
  metadata?: Record<string, string | number | boolean | null> | undefined;
142
+ businessName?: string | undefined;
143
143
  payoutAddress?: string | undefined;
144
144
  defaultCurrency?: "USDC" | "EURC" | undefined;
145
145
  countryCode?: string | null | undefined;
@@ -204,14 +204,14 @@ declare const merchantPublicBrandSchema: z.ZodObject<{
204
204
  logoUrl: z.ZodNullable<z.ZodString>;
205
205
  walletAddress: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
206
206
  }, "strip", z.ZodTypeAny, {
207
- businessName: string;
208
207
  id: string;
209
208
  walletAddress: string | null;
209
+ businessName: string;
210
210
  logoUrl: string | null;
211
211
  }, {
212
- businessName: string;
213
212
  id: string;
214
213
  walletAddress: string | null;
214
+ businessName: string;
215
215
  logoUrl: string | null;
216
216
  }>;
217
217
  type MerchantPublicBrand = z.infer<typeof merchantPublicBrandSchema>;
@@ -288,16 +288,16 @@ declare const merchantMemberSchema: z.ZodObject<{
288
288
  invitedAt: z.ZodString;
289
289
  acceptedAt: z.ZodNullable<z.ZodString>;
290
290
  }, "strip", z.ZodTypeAny, {
291
+ id: string;
291
292
  merchantId: string;
292
293
  email: string;
293
- id: string;
294
294
  role: "owner" | "admin" | "developer" | "read_only";
295
295
  invitedAt: string;
296
296
  acceptedAt: string | null;
297
297
  }, {
298
+ id: string;
298
299
  merchantId: string;
299
300
  email: string;
300
- id: string;
301
301
  role: "owner" | "admin" | "developer" | "read_only";
302
302
  invitedAt: string;
303
303
  acceptedAt: string | null;
@@ -350,13 +350,13 @@ declare const loginOutputSchema: z.ZodObject<{
350
350
  updatedAt: z.ZodString;
351
351
  }, "strip", z.ZodTypeAny, {
352
352
  status: "active" | "suspended" | "closed";
353
- businessName: string;
354
- email: string;
355
353
  id: string;
356
354
  createdAt: string;
357
355
  updatedAt: string;
358
356
  metadata: Record<string, string | number | boolean | null>;
359
357
  walletAddress: string | null;
358
+ email: string;
359
+ businessName: string;
360
360
  onchainMerchantId: number | null;
361
361
  tier: "free" | "starter" | "growth" | "enterprise";
362
362
  payoutAddress: string | null;
@@ -368,12 +368,12 @@ declare const loginOutputSchema: z.ZodObject<{
368
368
  whitelabelEnabled: boolean;
369
369
  }, {
370
370
  status: "active" | "suspended" | "closed";
371
- businessName: string;
372
- email: string;
373
371
  id: string;
374
372
  createdAt: string;
375
373
  updatedAt: string;
376
374
  walletAddress: string | null;
375
+ email: string;
376
+ businessName: string;
377
377
  onchainMerchantId: number | null;
378
378
  tier: "free" | "starter" | "growth" | "enterprise";
379
379
  payoutAddress: string | null;
@@ -390,13 +390,13 @@ declare const loginOutputSchema: z.ZodObject<{
390
390
  refreshToken: string;
391
391
  merchant: {
392
392
  status: "active" | "suspended" | "closed";
393
- businessName: string;
394
- email: string;
395
393
  id: string;
396
394
  createdAt: string;
397
395
  updatedAt: string;
398
396
  metadata: Record<string, string | number | boolean | null>;
399
397
  walletAddress: string | null;
398
+ email: string;
399
+ businessName: string;
400
400
  onchainMerchantId: number | null;
401
401
  tier: "free" | "starter" | "growth" | "enterprise";
402
402
  payoutAddress: string | null;
@@ -412,12 +412,12 @@ declare const loginOutputSchema: z.ZodObject<{
412
412
  refreshToken: string;
413
413
  merchant: {
414
414
  status: "active" | "suspended" | "closed";
415
- businessName: string;
416
- email: string;
417
415
  id: string;
418
416
  createdAt: string;
419
417
  updatedAt: string;
420
418
  walletAddress: string | null;
419
+ email: string;
420
+ businessName: string;
421
421
  onchainMerchantId: number | null;
422
422
  tier: "free" | "starter" | "growth" | "enterprise";
423
423
  payoutAddress: string | null;
@@ -91,8 +91,8 @@ var createPaymentSessionInputSchema = zod.z.object({
91
91
  email: zod.z.string().email().optional(),
92
92
  externalRef: zod.z.string().max(120).optional()
93
93
  }).optional(),
94
- successUrl: zod.z.string().url().optional(),
95
- cancelUrl: zod.z.string().url().optional(),
94
+ successUrl: callbackUrlSchema.optional(),
95
+ cancelUrl: callbackUrlSchema.optional(),
96
96
  /** Minutes until the session expires. Default 30, max 60*24 (one day). */
97
97
  expiresInMinutes: zod.z.number().int().min(1).max(60 * 24).default(30),
98
98
  /**
@@ -119,8 +119,35 @@ var submitPaymentSessionInputSchema = zod.z.object({
119
119
  bridgeTxHash: evmTxHashSchema.optional(),
120
120
  payerWalletAddress: evmAddressSchema
121
121
  });
122
+ var checkoutResultErrorCodes = [
123
+ "load_failed",
124
+ "merchant_not_ready",
125
+ "payment_reverted",
126
+ "unsupported_wallet"
127
+ ];
128
+ var checkoutResultErrorCodeSchema = zod.z.enum(checkoutResultErrorCodes);
129
+ var checkoutResultMessageSchema = zod.z.discriminatedUnion("type", [
130
+ zod.z.object({
131
+ type: zod.z.literal("strimz:checkout:success"),
132
+ sessionId: idSchema,
133
+ txHash: evmTxHashSchema
134
+ }),
135
+ zod.z.object({
136
+ type: zod.z.literal("strimz:checkout:cancel"),
137
+ sessionId: idSchema
138
+ }),
139
+ zod.z.object({
140
+ type: zod.z.literal("strimz:checkout:error"),
141
+ sessionId: idSchema,
142
+ code: checkoutResultErrorCodeSchema,
143
+ message: zod.z.string().min(1).max(500)
144
+ })
145
+ ]);
122
146
 
123
147
  exports.callbackUrlSchema = callbackUrlSchema;
148
+ exports.checkoutResultErrorCodeSchema = checkoutResultErrorCodeSchema;
149
+ exports.checkoutResultErrorCodes = checkoutResultErrorCodes;
150
+ exports.checkoutResultMessageSchema = checkoutResultMessageSchema;
124
151
  exports.createPaymentSessionInputSchema = createPaymentSessionInputSchema;
125
152
  exports.paymentSessionSchema = paymentSessionSchema;
126
153
  exports.paymentSessionStatusSchema = paymentSessionStatusSchema;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/payment-sessions.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO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,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,IACnC,aAAaA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAAS,GAC3C,EACA,QAAA,EAAS;AAAA,EACZ,YAAYA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACtC,WAAWA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA;AAAA,EAErC,gBAAA,EAAkBA,KAAAA,CACf,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAA,GAAK,EAAE,CAAA,CACX,QAAQ,EAAE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,uBAAuBA,KAAAA,CACpB,KAAA;AAAA,IACCA,KAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,UAAA,EAAY,WAAA,EAAa,QAAQ,CAAC;AAAA,IAE7F,QAAA,EAAS;AAAA,EACZ,QAAA,EAAU,eAAe,QAAA;AAC3B,CAAC;AAIM,IAAM,+BAAA,GAAkCA,MAAE,MAAA,CAAO;AAAA,EACtD,WAAA,EAAaA,MAAE,IAAA,CAAK;AAAA,IAClB,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAAA,EACD,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,kBAAA,EAAoB;AACtB,CAAC","file":"payment-sessions.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'starter', 'growth', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Payment session. A one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\n/**\n * Merchant-supplied callback URL. The hosted checkout dispatches with\n * `window.location.href = redirectUrl` on completion / cancellation,\n * so we MUST reject anything other than `http://` and `https://`.\n *\n * Why this is a real risk: Zod's `.url()` validates RFC syntax, which\n * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.\n * A compromised merchant integration or an XSS upstream could ship a\n * session whose redirect URL executes script (or exfiltrates session\n * tokens) on every payer's browser. The damage is per-payer, but the\n * blast radius is \"every checkout the merchant runs.\"\n *\n * Mailto / tel and other handler protocols are also rejected — there\n * is no legitimate flow on a payment checkout that would benefit.\n */\nexport const callbackUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://') || v.startsWith('http://'), {\n message: 'must be an http:// or https:// URL',\n })\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: callbackUrlSchema.nullable(),\n cancelUrl: callbackUrlSchema.nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: z.string().url().optional(),\n cancelUrl: z.string().url().optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.input<typeof createPaymentSessionInputSchema>\nexport type CreatePaymentSessionParsed = z.output<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.input<typeof submitPaymentSessionInputSchema>\nexport type SubmitPaymentSessionParsed = z.output<typeof submitPaymentSessionInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/payment-sessions.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,oBAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,YAAY,iDAAiD,CAAA;AAG5CA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,IAAM,kBAAA,GAAqBA,KAAA,CAC/B,MAAA,EAAO,CACP,QAAA,CAAS,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,+BAAA,EAAiC,CAAA;AAGrCA,MAC9B,MAAA,EAAO,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,CAAE,IAAI,GAAG;AAAA,GACnC;AACH,CAAC","file":"payment-sessions.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'starter', 'growth', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Payment session. A one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\n/**\n * Merchant-supplied callback URL. The hosted checkout dispatches with\n * `window.location.href = redirectUrl` on completion / cancellation,\n * so we MUST reject anything other than `http://` and `https://`.\n *\n * Why this is a real risk: Zod's `.url()` validates RFC syntax, which\n * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.\n * A compromised merchant integration or an XSS upstream could ship a\n * session whose redirect URL executes script (or exfiltrates session\n * tokens) on every payer's browser. The damage is per-payer, but the\n * blast radius is \"every checkout the merchant runs.\"\n *\n * Mailto / tel and other handler protocols are also rejected — there\n * is no legitimate flow on a payment checkout that would benefit.\n */\nexport const callbackUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://') || v.startsWith('http://'), {\n message: 'must be an http:// or https:// URL',\n })\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: callbackUrlSchema.nullable(),\n cancelUrl: callbackUrlSchema.nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: callbackUrlSchema.optional(),\n cancelUrl: callbackUrlSchema.optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.input<typeof createPaymentSessionInputSchema>\nexport type CreatePaymentSessionParsed = z.output<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.input<typeof submitPaymentSessionInputSchema>\nexport type SubmitPaymentSessionParsed = z.output<typeof submitPaymentSessionInputSchema>\n\nexport const checkoutResultErrorCodes = [\n 'load_failed',\n 'merchant_not_ready',\n 'payment_reverted',\n 'unsupported_wallet',\n] as const\nexport const checkoutResultErrorCodeSchema = z.enum(checkoutResultErrorCodes)\nexport type CheckoutResultErrorCode = z.infer<typeof checkoutResultErrorCodeSchema>\n\nexport const checkoutResultMessageSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('strimz:checkout:success'),\n sessionId: idSchema,\n txHash: evmTxHashSchema,\n }),\n z.object({\n type: z.literal('strimz:checkout:cancel'),\n sessionId: idSchema,\n }),\n z.object({\n type: z.literal('strimz:checkout:error'),\n sessionId: idSchema,\n code: checkoutResultErrorCodeSchema,\n message: z.string().min(1).max(500),\n }),\n])\nexport type CheckoutResultMessage = z.infer<typeof checkoutResultMessageSchema>\n"]}