dodopayments 2.2.0 → 2.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +11 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +11 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +7 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +4 -2
  11. package/resources/index.d.mts +1 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +1 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js.map +1 -1
  16. package/resources/index.mjs.map +1 -1
  17. package/resources/payments.d.mts +9 -1
  18. package/resources/payments.d.mts.map +1 -1
  19. package/resources/payments.d.ts +9 -1
  20. package/resources/payments.d.ts.map +1 -1
  21. package/resources/webhooks/index.d.mts +1 -1
  22. package/resources/webhooks/index.d.mts.map +1 -1
  23. package/resources/webhooks/index.d.ts +1 -1
  24. package/resources/webhooks/index.d.ts.map +1 -1
  25. package/resources/webhooks/index.js.map +1 -1
  26. package/resources/webhooks/index.mjs.map +1 -1
  27. package/resources/webhooks/webhooks.d.mts +1231 -1
  28. package/resources/webhooks/webhooks.d.mts.map +1 -1
  29. package/resources/webhooks/webhooks.d.ts +1231 -1
  30. package/resources/webhooks/webhooks.d.ts.map +1 -1
  31. package/resources/webhooks/webhooks.js +14 -0
  32. package/resources/webhooks/webhooks.js.map +1 -1
  33. package/resources/webhooks/webhooks.mjs +14 -0
  34. package/resources/webhooks/webhooks.mjs.map +1 -1
  35. package/src/client.ts +65 -8
  36. package/src/resources/index.ts +23 -0
  37. package/src/resources/payments.ts +9 -1
  38. package/src/resources/webhooks/index.ts +23 -0
  39. package/src/resources/webhooks/webhooks.ts +1520 -0
  40. package/src/version.ts +1 -1
  41. package/version.d.mts +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/version.mjs +1 -1
@@ -1,9 +1,15 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as DisputesAPI from '../disputes';
5
+ import * as LicenseKeysAPI from '../license-keys';
6
+ import * as PaymentsAPI from '../payments';
7
+ import * as RefundsAPI from '../refunds';
8
+ import * as SubscriptionsAPI from '../subscriptions';
4
9
  import * as WebhookEventsAPI from '../webhook-events';
5
10
  import * as HeadersAPI from './headers';
6
11
  import { HeaderRetrieveResponse, HeaderUpdateParams, Headers } from './headers';
12
+ import { Webhook } from 'standardwebhooks';
7
13
  import { APIPromise } from '../../core/api-promise';
8
14
  import { CursorPagePagination, type CursorPagePaginationParams, PagePromise } from '../../core/pagination';
9
15
  import { buildHeaders } from '../../internal/headers';
@@ -60,6 +66,23 @@ export class Webhooks extends APIResource {
60
66
  retrieveSecret(webhookID: string, options?: RequestOptions): APIPromise<WebhookRetrieveSecretResponse> {
61
67
  return this._client.get(path`/webhooks/${webhookID}/secret`, options);
62
68
  }
69
+
70
+ unsafeUnwrap(body: string): UnsafeUnwrapWebhookEvent {
71
+ return JSON.parse(body) as UnsafeUnwrapWebhookEvent;
72
+ }
73
+
74
+ unwrap(
75
+ body: string,
76
+ { headers, key }: { headers: Record<string, string>; key?: string },
77
+ ): UnwrapWebhookEvent {
78
+ if (headers !== undefined) {
79
+ const keyStr: string | null = key === undefined ? this._client.webhookKey : key;
80
+ if (keyStr === null) throw new Error('Webhook key must not be null in order to unwrap');
81
+ const wh = new Webhook(keyStr);
82
+ wh.verify(body, headers);
83
+ }
84
+ return JSON.parse(body) as UnwrapWebhookEvent;
85
+ }
63
86
  }
64
87
 
65
88
  export type WebhookDetailsCursorPagePagination = CursorPagePagination<WebhookDetails>;
@@ -119,6 +142,1480 @@ export interface WebhookRetrieveSecretResponse {
119
142
  secret: string;
120
143
  }
121
144
 
145
+ export interface DisputeAcceptedWebhookEvent {
146
+ /**
147
+ * The business identifier
148
+ */
149
+ business_id: string;
150
+
151
+ /**
152
+ * Event-specific data
153
+ */
154
+ data: DisputeAcceptedWebhookEvent.Data;
155
+
156
+ /**
157
+ * The timestamp of when the event occurred
158
+ */
159
+ timestamp: string;
160
+
161
+ /**
162
+ * The event type
163
+ */
164
+ type: 'dispute.accepted';
165
+ }
166
+
167
+ export namespace DisputeAcceptedWebhookEvent {
168
+ /**
169
+ * Event-specific data
170
+ */
171
+ export interface Data extends DisputesAPI.Dispute {
172
+ /**
173
+ * The type of payload in the data field
174
+ */
175
+ payload_type?: 'Dispute';
176
+ }
177
+ }
178
+
179
+ export interface DisputeCancelledWebhookEvent {
180
+ /**
181
+ * The business identifier
182
+ */
183
+ business_id: string;
184
+
185
+ /**
186
+ * Event-specific data
187
+ */
188
+ data: DisputeCancelledWebhookEvent.Data;
189
+
190
+ /**
191
+ * The timestamp of when the event occurred
192
+ */
193
+ timestamp: string;
194
+
195
+ /**
196
+ * The event type
197
+ */
198
+ type: 'dispute.cancelled';
199
+ }
200
+
201
+ export namespace DisputeCancelledWebhookEvent {
202
+ /**
203
+ * Event-specific data
204
+ */
205
+ export interface Data extends DisputesAPI.Dispute {
206
+ /**
207
+ * The type of payload in the data field
208
+ */
209
+ payload_type?: 'Dispute';
210
+ }
211
+ }
212
+
213
+ export interface DisputeChallengedWebhookEvent {
214
+ /**
215
+ * The business identifier
216
+ */
217
+ business_id: string;
218
+
219
+ /**
220
+ * Event-specific data
221
+ */
222
+ data: DisputeChallengedWebhookEvent.Data;
223
+
224
+ /**
225
+ * The timestamp of when the event occurred
226
+ */
227
+ timestamp: string;
228
+
229
+ /**
230
+ * The event type
231
+ */
232
+ type: 'dispute.challenged';
233
+ }
234
+
235
+ export namespace DisputeChallengedWebhookEvent {
236
+ /**
237
+ * Event-specific data
238
+ */
239
+ export interface Data extends DisputesAPI.Dispute {
240
+ /**
241
+ * The type of payload in the data field
242
+ */
243
+ payload_type?: 'Dispute';
244
+ }
245
+ }
246
+
247
+ export interface DisputeExpiredWebhookEvent {
248
+ /**
249
+ * The business identifier
250
+ */
251
+ business_id: string;
252
+
253
+ /**
254
+ * Event-specific data
255
+ */
256
+ data: DisputeExpiredWebhookEvent.Data;
257
+
258
+ /**
259
+ * The timestamp of when the event occurred
260
+ */
261
+ timestamp: string;
262
+
263
+ /**
264
+ * The event type
265
+ */
266
+ type: 'dispute.expired';
267
+ }
268
+
269
+ export namespace DisputeExpiredWebhookEvent {
270
+ /**
271
+ * Event-specific data
272
+ */
273
+ export interface Data extends DisputesAPI.Dispute {
274
+ /**
275
+ * The type of payload in the data field
276
+ */
277
+ payload_type?: 'Dispute';
278
+ }
279
+ }
280
+
281
+ export interface DisputeLostWebhookEvent {
282
+ /**
283
+ * The business identifier
284
+ */
285
+ business_id: string;
286
+
287
+ /**
288
+ * Event-specific data
289
+ */
290
+ data: DisputeLostWebhookEvent.Data;
291
+
292
+ /**
293
+ * The timestamp of when the event occurred
294
+ */
295
+ timestamp: string;
296
+
297
+ /**
298
+ * The event type
299
+ */
300
+ type: 'dispute.lost';
301
+ }
302
+
303
+ export namespace DisputeLostWebhookEvent {
304
+ /**
305
+ * Event-specific data
306
+ */
307
+ export interface Data extends DisputesAPI.Dispute {
308
+ /**
309
+ * The type of payload in the data field
310
+ */
311
+ payload_type?: 'Dispute';
312
+ }
313
+ }
314
+
315
+ export interface DisputeOpenedWebhookEvent {
316
+ /**
317
+ * The business identifier
318
+ */
319
+ business_id: string;
320
+
321
+ /**
322
+ * Event-specific data
323
+ */
324
+ data: DisputeOpenedWebhookEvent.Data;
325
+
326
+ /**
327
+ * The timestamp of when the event occurred
328
+ */
329
+ timestamp: string;
330
+
331
+ /**
332
+ * The event type
333
+ */
334
+ type: 'dispute.opened';
335
+ }
336
+
337
+ export namespace DisputeOpenedWebhookEvent {
338
+ /**
339
+ * Event-specific data
340
+ */
341
+ export interface Data extends DisputesAPI.Dispute {
342
+ /**
343
+ * The type of payload in the data field
344
+ */
345
+ payload_type?: 'Dispute';
346
+ }
347
+ }
348
+
349
+ export interface DisputeWonWebhookEvent {
350
+ /**
351
+ * The business identifier
352
+ */
353
+ business_id: string;
354
+
355
+ /**
356
+ * Event-specific data
357
+ */
358
+ data: DisputeWonWebhookEvent.Data;
359
+
360
+ /**
361
+ * The timestamp of when the event occurred
362
+ */
363
+ timestamp: string;
364
+
365
+ /**
366
+ * The event type
367
+ */
368
+ type: 'dispute.won';
369
+ }
370
+
371
+ export namespace DisputeWonWebhookEvent {
372
+ /**
373
+ * Event-specific data
374
+ */
375
+ export interface Data extends DisputesAPI.Dispute {
376
+ /**
377
+ * The type of payload in the data field
378
+ */
379
+ payload_type?: 'Dispute';
380
+ }
381
+ }
382
+
383
+ export interface LicenseKeyCreatedWebhookEvent {
384
+ /**
385
+ * The business identifier
386
+ */
387
+ business_id: string;
388
+
389
+ /**
390
+ * Event-specific data
391
+ */
392
+ data: LicenseKeyCreatedWebhookEvent.Data;
393
+
394
+ /**
395
+ * The timestamp of when the event occurred
396
+ */
397
+ timestamp: string;
398
+
399
+ /**
400
+ * The event type
401
+ */
402
+ type: 'license_key.created';
403
+ }
404
+
405
+ export namespace LicenseKeyCreatedWebhookEvent {
406
+ /**
407
+ * Event-specific data
408
+ */
409
+ export interface Data extends LicenseKeysAPI.LicenseKey {
410
+ /**
411
+ * The type of payload in the data field
412
+ */
413
+ payload_type?: 'LicenseKey';
414
+ }
415
+ }
416
+
417
+ export interface PaymentCancelledWebhookEvent {
418
+ /**
419
+ * The business identifier
420
+ */
421
+ business_id: string;
422
+
423
+ /**
424
+ * Event-specific data
425
+ */
426
+ data: PaymentCancelledWebhookEvent.Data;
427
+
428
+ /**
429
+ * The timestamp of when the event occurred
430
+ */
431
+ timestamp: string;
432
+
433
+ /**
434
+ * The event type
435
+ */
436
+ type: 'payment.cancelled';
437
+ }
438
+
439
+ export namespace PaymentCancelledWebhookEvent {
440
+ /**
441
+ * Event-specific data
442
+ */
443
+ export interface Data extends PaymentsAPI.Payment {
444
+ /**
445
+ * The type of payload in the data field
446
+ */
447
+ payload_type?: 'Payment';
448
+ }
449
+ }
450
+
451
+ export interface PaymentFailedWebhookEvent {
452
+ /**
453
+ * The business identifier
454
+ */
455
+ business_id: string;
456
+
457
+ /**
458
+ * Event-specific data
459
+ */
460
+ data: PaymentFailedWebhookEvent.Data;
461
+
462
+ /**
463
+ * The timestamp of when the event occurred
464
+ */
465
+ timestamp: string;
466
+
467
+ /**
468
+ * The event type
469
+ */
470
+ type: 'payment.failed';
471
+ }
472
+
473
+ export namespace PaymentFailedWebhookEvent {
474
+ /**
475
+ * Event-specific data
476
+ */
477
+ export interface Data extends PaymentsAPI.Payment {
478
+ /**
479
+ * The type of payload in the data field
480
+ */
481
+ payload_type?: 'Payment';
482
+ }
483
+ }
484
+
485
+ export interface PaymentProcessingWebhookEvent {
486
+ /**
487
+ * The business identifier
488
+ */
489
+ business_id: string;
490
+
491
+ /**
492
+ * Event-specific data
493
+ */
494
+ data: PaymentProcessingWebhookEvent.Data;
495
+
496
+ /**
497
+ * The timestamp of when the event occurred
498
+ */
499
+ timestamp: string;
500
+
501
+ /**
502
+ * The event type
503
+ */
504
+ type: 'payment.processing';
505
+ }
506
+
507
+ export namespace PaymentProcessingWebhookEvent {
508
+ /**
509
+ * Event-specific data
510
+ */
511
+ export interface Data extends PaymentsAPI.Payment {
512
+ /**
513
+ * The type of payload in the data field
514
+ */
515
+ payload_type?: 'Payment';
516
+ }
517
+ }
518
+
519
+ export interface PaymentSucceededWebhookEvent {
520
+ /**
521
+ * The business identifier
522
+ */
523
+ business_id: string;
524
+
525
+ /**
526
+ * Event-specific data
527
+ */
528
+ data: PaymentSucceededWebhookEvent.Data;
529
+
530
+ /**
531
+ * The timestamp of when the event occurred
532
+ */
533
+ timestamp: string;
534
+
535
+ /**
536
+ * The event type
537
+ */
538
+ type: 'payment.succeeded';
539
+ }
540
+
541
+ export namespace PaymentSucceededWebhookEvent {
542
+ /**
543
+ * Event-specific data
544
+ */
545
+ export interface Data extends PaymentsAPI.Payment {
546
+ /**
547
+ * The type of payload in the data field
548
+ */
549
+ payload_type?: 'Payment';
550
+ }
551
+ }
552
+
553
+ export interface RefundFailedWebhookEvent {
554
+ /**
555
+ * The business identifier
556
+ */
557
+ business_id: string;
558
+
559
+ /**
560
+ * Event-specific data
561
+ */
562
+ data: RefundFailedWebhookEvent.Data;
563
+
564
+ /**
565
+ * The timestamp of when the event occurred
566
+ */
567
+ timestamp: string;
568
+
569
+ /**
570
+ * The event type
571
+ */
572
+ type: 'refund.failed';
573
+ }
574
+
575
+ export namespace RefundFailedWebhookEvent {
576
+ /**
577
+ * Event-specific data
578
+ */
579
+ export interface Data extends RefundsAPI.Refund {
580
+ /**
581
+ * The type of payload in the data field
582
+ */
583
+ payload_type?: 'Refund';
584
+ }
585
+ }
586
+
587
+ export interface RefundSucceededWebhookEvent {
588
+ /**
589
+ * The business identifier
590
+ */
591
+ business_id: string;
592
+
593
+ /**
594
+ * Event-specific data
595
+ */
596
+ data: RefundSucceededWebhookEvent.Data;
597
+
598
+ /**
599
+ * The timestamp of when the event occurred
600
+ */
601
+ timestamp: string;
602
+
603
+ /**
604
+ * The event type
605
+ */
606
+ type: 'refund.succeeded';
607
+ }
608
+
609
+ export namespace RefundSucceededWebhookEvent {
610
+ /**
611
+ * Event-specific data
612
+ */
613
+ export interface Data extends RefundsAPI.Refund {
614
+ /**
615
+ * The type of payload in the data field
616
+ */
617
+ payload_type?: 'Refund';
618
+ }
619
+ }
620
+
621
+ export interface SubscriptionActiveWebhookEvent {
622
+ /**
623
+ * The business identifier
624
+ */
625
+ business_id: string;
626
+
627
+ /**
628
+ * Event-specific data
629
+ */
630
+ data: SubscriptionActiveWebhookEvent.Data;
631
+
632
+ /**
633
+ * The timestamp of when the event occurred
634
+ */
635
+ timestamp: string;
636
+
637
+ /**
638
+ * The event type
639
+ */
640
+ type: 'subscription.active';
641
+ }
642
+
643
+ export namespace SubscriptionActiveWebhookEvent {
644
+ /**
645
+ * Event-specific data
646
+ */
647
+ export interface Data extends SubscriptionsAPI.Subscription {
648
+ /**
649
+ * The type of payload in the data field
650
+ */
651
+ payload_type?: 'Subscription';
652
+ }
653
+ }
654
+
655
+ export interface SubscriptionCancelledWebhookEvent {
656
+ /**
657
+ * The business identifier
658
+ */
659
+ business_id: string;
660
+
661
+ /**
662
+ * Event-specific data
663
+ */
664
+ data: SubscriptionCancelledWebhookEvent.Data;
665
+
666
+ /**
667
+ * The timestamp of when the event occurred
668
+ */
669
+ timestamp: string;
670
+
671
+ /**
672
+ * The event type
673
+ */
674
+ type: 'subscription.cancelled';
675
+ }
676
+
677
+ export namespace SubscriptionCancelledWebhookEvent {
678
+ /**
679
+ * Event-specific data
680
+ */
681
+ export interface Data extends SubscriptionsAPI.Subscription {
682
+ /**
683
+ * The type of payload in the data field
684
+ */
685
+ payload_type?: 'Subscription';
686
+ }
687
+ }
688
+
689
+ export interface SubscriptionExpiredWebhookEvent {
690
+ /**
691
+ * The business identifier
692
+ */
693
+ business_id: string;
694
+
695
+ /**
696
+ * Event-specific data
697
+ */
698
+ data: SubscriptionExpiredWebhookEvent.Data;
699
+
700
+ /**
701
+ * The timestamp of when the event occurred
702
+ */
703
+ timestamp: string;
704
+
705
+ /**
706
+ * The event type
707
+ */
708
+ type: 'subscription.expired';
709
+ }
710
+
711
+ export namespace SubscriptionExpiredWebhookEvent {
712
+ /**
713
+ * Event-specific data
714
+ */
715
+ export interface Data extends SubscriptionsAPI.Subscription {
716
+ /**
717
+ * The type of payload in the data field
718
+ */
719
+ payload_type?: 'Subscription';
720
+ }
721
+ }
722
+
723
+ export interface SubscriptionFailedWebhookEvent {
724
+ /**
725
+ * The business identifier
726
+ */
727
+ business_id: string;
728
+
729
+ /**
730
+ * Event-specific data
731
+ */
732
+ data: SubscriptionFailedWebhookEvent.Data;
733
+
734
+ /**
735
+ * The timestamp of when the event occurred
736
+ */
737
+ timestamp: string;
738
+
739
+ /**
740
+ * The event type
741
+ */
742
+ type: 'subscription.failed';
743
+ }
744
+
745
+ export namespace SubscriptionFailedWebhookEvent {
746
+ /**
747
+ * Event-specific data
748
+ */
749
+ export interface Data extends SubscriptionsAPI.Subscription {
750
+ /**
751
+ * The type of payload in the data field
752
+ */
753
+ payload_type?: 'Subscription';
754
+ }
755
+ }
756
+
757
+ export interface SubscriptionOnHoldWebhookEvent {
758
+ /**
759
+ * The business identifier
760
+ */
761
+ business_id: string;
762
+
763
+ /**
764
+ * Event-specific data
765
+ */
766
+ data: SubscriptionOnHoldWebhookEvent.Data;
767
+
768
+ /**
769
+ * The timestamp of when the event occurred
770
+ */
771
+ timestamp: string;
772
+
773
+ /**
774
+ * The event type
775
+ */
776
+ type: 'subscription.on_hold';
777
+ }
778
+
779
+ export namespace SubscriptionOnHoldWebhookEvent {
780
+ /**
781
+ * Event-specific data
782
+ */
783
+ export interface Data extends SubscriptionsAPI.Subscription {
784
+ /**
785
+ * The type of payload in the data field
786
+ */
787
+ payload_type?: 'Subscription';
788
+ }
789
+ }
790
+
791
+ export interface SubscriptionPlanChangedWebhookEvent {
792
+ /**
793
+ * The business identifier
794
+ */
795
+ business_id: string;
796
+
797
+ /**
798
+ * Event-specific data
799
+ */
800
+ data: SubscriptionPlanChangedWebhookEvent.Data;
801
+
802
+ /**
803
+ * The timestamp of when the event occurred
804
+ */
805
+ timestamp: string;
806
+
807
+ /**
808
+ * The event type
809
+ */
810
+ type: 'subscription.plan_changed';
811
+ }
812
+
813
+ export namespace SubscriptionPlanChangedWebhookEvent {
814
+ /**
815
+ * Event-specific data
816
+ */
817
+ export interface Data extends SubscriptionsAPI.Subscription {
818
+ /**
819
+ * The type of payload in the data field
820
+ */
821
+ payload_type?: 'Subscription';
822
+ }
823
+ }
824
+
825
+ export interface SubscriptionRenewedWebhookEvent {
826
+ /**
827
+ * The business identifier
828
+ */
829
+ business_id: string;
830
+
831
+ /**
832
+ * Event-specific data
833
+ */
834
+ data: SubscriptionRenewedWebhookEvent.Data;
835
+
836
+ /**
837
+ * The timestamp of when the event occurred
838
+ */
839
+ timestamp: string;
840
+
841
+ /**
842
+ * The event type
843
+ */
844
+ type: 'subscription.renewed';
845
+ }
846
+
847
+ export namespace SubscriptionRenewedWebhookEvent {
848
+ /**
849
+ * Event-specific data
850
+ */
851
+ export interface Data extends SubscriptionsAPI.Subscription {
852
+ /**
853
+ * The type of payload in the data field
854
+ */
855
+ payload_type?: 'Subscription';
856
+ }
857
+ }
858
+
859
+ export interface DisputeAcceptedWebhookEvent {
860
+ /**
861
+ * The business identifier
862
+ */
863
+ business_id: string;
864
+
865
+ /**
866
+ * Event-specific data
867
+ */
868
+ data: DisputeAcceptedWebhookEvent.Data;
869
+
870
+ /**
871
+ * The timestamp of when the event occurred
872
+ */
873
+ timestamp: string;
874
+
875
+ /**
876
+ * The event type
877
+ */
878
+ type: 'dispute.accepted';
879
+ }
880
+
881
+ export namespace DisputeAcceptedWebhookEvent {
882
+ /**
883
+ * Event-specific data
884
+ */
885
+ export interface Data extends DisputesAPI.Dispute {
886
+ /**
887
+ * The type of payload in the data field
888
+ */
889
+ payload_type?: 'Dispute';
890
+ }
891
+ }
892
+
893
+ export interface DisputeCancelledWebhookEvent {
894
+ /**
895
+ * The business identifier
896
+ */
897
+ business_id: string;
898
+
899
+ /**
900
+ * Event-specific data
901
+ */
902
+ data: DisputeCancelledWebhookEvent.Data;
903
+
904
+ /**
905
+ * The timestamp of when the event occurred
906
+ */
907
+ timestamp: string;
908
+
909
+ /**
910
+ * The event type
911
+ */
912
+ type: 'dispute.cancelled';
913
+ }
914
+
915
+ export namespace DisputeCancelledWebhookEvent {
916
+ /**
917
+ * Event-specific data
918
+ */
919
+ export interface Data extends DisputesAPI.Dispute {
920
+ /**
921
+ * The type of payload in the data field
922
+ */
923
+ payload_type?: 'Dispute';
924
+ }
925
+ }
926
+
927
+ export interface DisputeChallengedWebhookEvent {
928
+ /**
929
+ * The business identifier
930
+ */
931
+ business_id: string;
932
+
933
+ /**
934
+ * Event-specific data
935
+ */
936
+ data: DisputeChallengedWebhookEvent.Data;
937
+
938
+ /**
939
+ * The timestamp of when the event occurred
940
+ */
941
+ timestamp: string;
942
+
943
+ /**
944
+ * The event type
945
+ */
946
+ type: 'dispute.challenged';
947
+ }
948
+
949
+ export namespace DisputeChallengedWebhookEvent {
950
+ /**
951
+ * Event-specific data
952
+ */
953
+ export interface Data extends DisputesAPI.Dispute {
954
+ /**
955
+ * The type of payload in the data field
956
+ */
957
+ payload_type?: 'Dispute';
958
+ }
959
+ }
960
+
961
+ export interface DisputeExpiredWebhookEvent {
962
+ /**
963
+ * The business identifier
964
+ */
965
+ business_id: string;
966
+
967
+ /**
968
+ * Event-specific data
969
+ */
970
+ data: DisputeExpiredWebhookEvent.Data;
971
+
972
+ /**
973
+ * The timestamp of when the event occurred
974
+ */
975
+ timestamp: string;
976
+
977
+ /**
978
+ * The event type
979
+ */
980
+ type: 'dispute.expired';
981
+ }
982
+
983
+ export namespace DisputeExpiredWebhookEvent {
984
+ /**
985
+ * Event-specific data
986
+ */
987
+ export interface Data extends DisputesAPI.Dispute {
988
+ /**
989
+ * The type of payload in the data field
990
+ */
991
+ payload_type?: 'Dispute';
992
+ }
993
+ }
994
+
995
+ export interface DisputeLostWebhookEvent {
996
+ /**
997
+ * The business identifier
998
+ */
999
+ business_id: string;
1000
+
1001
+ /**
1002
+ * Event-specific data
1003
+ */
1004
+ data: DisputeLostWebhookEvent.Data;
1005
+
1006
+ /**
1007
+ * The timestamp of when the event occurred
1008
+ */
1009
+ timestamp: string;
1010
+
1011
+ /**
1012
+ * The event type
1013
+ */
1014
+ type: 'dispute.lost';
1015
+ }
1016
+
1017
+ export namespace DisputeLostWebhookEvent {
1018
+ /**
1019
+ * Event-specific data
1020
+ */
1021
+ export interface Data extends DisputesAPI.Dispute {
1022
+ /**
1023
+ * The type of payload in the data field
1024
+ */
1025
+ payload_type?: 'Dispute';
1026
+ }
1027
+ }
1028
+
1029
+ export interface DisputeOpenedWebhookEvent {
1030
+ /**
1031
+ * The business identifier
1032
+ */
1033
+ business_id: string;
1034
+
1035
+ /**
1036
+ * Event-specific data
1037
+ */
1038
+ data: DisputeOpenedWebhookEvent.Data;
1039
+
1040
+ /**
1041
+ * The timestamp of when the event occurred
1042
+ */
1043
+ timestamp: string;
1044
+
1045
+ /**
1046
+ * The event type
1047
+ */
1048
+ type: 'dispute.opened';
1049
+ }
1050
+
1051
+ export namespace DisputeOpenedWebhookEvent {
1052
+ /**
1053
+ * Event-specific data
1054
+ */
1055
+ export interface Data extends DisputesAPI.Dispute {
1056
+ /**
1057
+ * The type of payload in the data field
1058
+ */
1059
+ payload_type?: 'Dispute';
1060
+ }
1061
+ }
1062
+
1063
+ export interface DisputeWonWebhookEvent {
1064
+ /**
1065
+ * The business identifier
1066
+ */
1067
+ business_id: string;
1068
+
1069
+ /**
1070
+ * Event-specific data
1071
+ */
1072
+ data: DisputeWonWebhookEvent.Data;
1073
+
1074
+ /**
1075
+ * The timestamp of when the event occurred
1076
+ */
1077
+ timestamp: string;
1078
+
1079
+ /**
1080
+ * The event type
1081
+ */
1082
+ type: 'dispute.won';
1083
+ }
1084
+
1085
+ export namespace DisputeWonWebhookEvent {
1086
+ /**
1087
+ * Event-specific data
1088
+ */
1089
+ export interface Data extends DisputesAPI.Dispute {
1090
+ /**
1091
+ * The type of payload in the data field
1092
+ */
1093
+ payload_type?: 'Dispute';
1094
+ }
1095
+ }
1096
+
1097
+ export interface LicenseKeyCreatedWebhookEvent {
1098
+ /**
1099
+ * The business identifier
1100
+ */
1101
+ business_id: string;
1102
+
1103
+ /**
1104
+ * Event-specific data
1105
+ */
1106
+ data: LicenseKeyCreatedWebhookEvent.Data;
1107
+
1108
+ /**
1109
+ * The timestamp of when the event occurred
1110
+ */
1111
+ timestamp: string;
1112
+
1113
+ /**
1114
+ * The event type
1115
+ */
1116
+ type: 'license_key.created';
1117
+ }
1118
+
1119
+ export namespace LicenseKeyCreatedWebhookEvent {
1120
+ /**
1121
+ * Event-specific data
1122
+ */
1123
+ export interface Data extends LicenseKeysAPI.LicenseKey {
1124
+ /**
1125
+ * The type of payload in the data field
1126
+ */
1127
+ payload_type?: 'LicenseKey';
1128
+ }
1129
+ }
1130
+
1131
+ export interface PaymentCancelledWebhookEvent {
1132
+ /**
1133
+ * The business identifier
1134
+ */
1135
+ business_id: string;
1136
+
1137
+ /**
1138
+ * Event-specific data
1139
+ */
1140
+ data: PaymentCancelledWebhookEvent.Data;
1141
+
1142
+ /**
1143
+ * The timestamp of when the event occurred
1144
+ */
1145
+ timestamp: string;
1146
+
1147
+ /**
1148
+ * The event type
1149
+ */
1150
+ type: 'payment.cancelled';
1151
+ }
1152
+
1153
+ export namespace PaymentCancelledWebhookEvent {
1154
+ /**
1155
+ * Event-specific data
1156
+ */
1157
+ export interface Data extends PaymentsAPI.Payment {
1158
+ /**
1159
+ * The type of payload in the data field
1160
+ */
1161
+ payload_type?: 'Payment';
1162
+ }
1163
+ }
1164
+
1165
+ export interface PaymentFailedWebhookEvent {
1166
+ /**
1167
+ * The business identifier
1168
+ */
1169
+ business_id: string;
1170
+
1171
+ /**
1172
+ * Event-specific data
1173
+ */
1174
+ data: PaymentFailedWebhookEvent.Data;
1175
+
1176
+ /**
1177
+ * The timestamp of when the event occurred
1178
+ */
1179
+ timestamp: string;
1180
+
1181
+ /**
1182
+ * The event type
1183
+ */
1184
+ type: 'payment.failed';
1185
+ }
1186
+
1187
+ export namespace PaymentFailedWebhookEvent {
1188
+ /**
1189
+ * Event-specific data
1190
+ */
1191
+ export interface Data extends PaymentsAPI.Payment {
1192
+ /**
1193
+ * The type of payload in the data field
1194
+ */
1195
+ payload_type?: 'Payment';
1196
+ }
1197
+ }
1198
+
1199
+ export interface PaymentProcessingWebhookEvent {
1200
+ /**
1201
+ * The business identifier
1202
+ */
1203
+ business_id: string;
1204
+
1205
+ /**
1206
+ * Event-specific data
1207
+ */
1208
+ data: PaymentProcessingWebhookEvent.Data;
1209
+
1210
+ /**
1211
+ * The timestamp of when the event occurred
1212
+ */
1213
+ timestamp: string;
1214
+
1215
+ /**
1216
+ * The event type
1217
+ */
1218
+ type: 'payment.processing';
1219
+ }
1220
+
1221
+ export namespace PaymentProcessingWebhookEvent {
1222
+ /**
1223
+ * Event-specific data
1224
+ */
1225
+ export interface Data extends PaymentsAPI.Payment {
1226
+ /**
1227
+ * The type of payload in the data field
1228
+ */
1229
+ payload_type?: 'Payment';
1230
+ }
1231
+ }
1232
+
1233
+ export interface PaymentSucceededWebhookEvent {
1234
+ /**
1235
+ * The business identifier
1236
+ */
1237
+ business_id: string;
1238
+
1239
+ /**
1240
+ * Event-specific data
1241
+ */
1242
+ data: PaymentSucceededWebhookEvent.Data;
1243
+
1244
+ /**
1245
+ * The timestamp of when the event occurred
1246
+ */
1247
+ timestamp: string;
1248
+
1249
+ /**
1250
+ * The event type
1251
+ */
1252
+ type: 'payment.succeeded';
1253
+ }
1254
+
1255
+ export namespace PaymentSucceededWebhookEvent {
1256
+ /**
1257
+ * Event-specific data
1258
+ */
1259
+ export interface Data extends PaymentsAPI.Payment {
1260
+ /**
1261
+ * The type of payload in the data field
1262
+ */
1263
+ payload_type?: 'Payment';
1264
+ }
1265
+ }
1266
+
1267
+ export interface RefundFailedWebhookEvent {
1268
+ /**
1269
+ * The business identifier
1270
+ */
1271
+ business_id: string;
1272
+
1273
+ /**
1274
+ * Event-specific data
1275
+ */
1276
+ data: RefundFailedWebhookEvent.Data;
1277
+
1278
+ /**
1279
+ * The timestamp of when the event occurred
1280
+ */
1281
+ timestamp: string;
1282
+
1283
+ /**
1284
+ * The event type
1285
+ */
1286
+ type: 'refund.failed';
1287
+ }
1288
+
1289
+ export namespace RefundFailedWebhookEvent {
1290
+ /**
1291
+ * Event-specific data
1292
+ */
1293
+ export interface Data extends RefundsAPI.Refund {
1294
+ /**
1295
+ * The type of payload in the data field
1296
+ */
1297
+ payload_type?: 'Refund';
1298
+ }
1299
+ }
1300
+
1301
+ export interface RefundSucceededWebhookEvent {
1302
+ /**
1303
+ * The business identifier
1304
+ */
1305
+ business_id: string;
1306
+
1307
+ /**
1308
+ * Event-specific data
1309
+ */
1310
+ data: RefundSucceededWebhookEvent.Data;
1311
+
1312
+ /**
1313
+ * The timestamp of when the event occurred
1314
+ */
1315
+ timestamp: string;
1316
+
1317
+ /**
1318
+ * The event type
1319
+ */
1320
+ type: 'refund.succeeded';
1321
+ }
1322
+
1323
+ export namespace RefundSucceededWebhookEvent {
1324
+ /**
1325
+ * Event-specific data
1326
+ */
1327
+ export interface Data extends RefundsAPI.Refund {
1328
+ /**
1329
+ * The type of payload in the data field
1330
+ */
1331
+ payload_type?: 'Refund';
1332
+ }
1333
+ }
1334
+
1335
+ export interface SubscriptionActiveWebhookEvent {
1336
+ /**
1337
+ * The business identifier
1338
+ */
1339
+ business_id: string;
1340
+
1341
+ /**
1342
+ * Event-specific data
1343
+ */
1344
+ data: SubscriptionActiveWebhookEvent.Data;
1345
+
1346
+ /**
1347
+ * The timestamp of when the event occurred
1348
+ */
1349
+ timestamp: string;
1350
+
1351
+ /**
1352
+ * The event type
1353
+ */
1354
+ type: 'subscription.active';
1355
+ }
1356
+
1357
+ export namespace SubscriptionActiveWebhookEvent {
1358
+ /**
1359
+ * Event-specific data
1360
+ */
1361
+ export interface Data extends SubscriptionsAPI.Subscription {
1362
+ /**
1363
+ * The type of payload in the data field
1364
+ */
1365
+ payload_type?: 'Subscription';
1366
+ }
1367
+ }
1368
+
1369
+ export interface SubscriptionCancelledWebhookEvent {
1370
+ /**
1371
+ * The business identifier
1372
+ */
1373
+ business_id: string;
1374
+
1375
+ /**
1376
+ * Event-specific data
1377
+ */
1378
+ data: SubscriptionCancelledWebhookEvent.Data;
1379
+
1380
+ /**
1381
+ * The timestamp of when the event occurred
1382
+ */
1383
+ timestamp: string;
1384
+
1385
+ /**
1386
+ * The event type
1387
+ */
1388
+ type: 'subscription.cancelled';
1389
+ }
1390
+
1391
+ export namespace SubscriptionCancelledWebhookEvent {
1392
+ /**
1393
+ * Event-specific data
1394
+ */
1395
+ export interface Data extends SubscriptionsAPI.Subscription {
1396
+ /**
1397
+ * The type of payload in the data field
1398
+ */
1399
+ payload_type?: 'Subscription';
1400
+ }
1401
+ }
1402
+
1403
+ export interface SubscriptionExpiredWebhookEvent {
1404
+ /**
1405
+ * The business identifier
1406
+ */
1407
+ business_id: string;
1408
+
1409
+ /**
1410
+ * Event-specific data
1411
+ */
1412
+ data: SubscriptionExpiredWebhookEvent.Data;
1413
+
1414
+ /**
1415
+ * The timestamp of when the event occurred
1416
+ */
1417
+ timestamp: string;
1418
+
1419
+ /**
1420
+ * The event type
1421
+ */
1422
+ type: 'subscription.expired';
1423
+ }
1424
+
1425
+ export namespace SubscriptionExpiredWebhookEvent {
1426
+ /**
1427
+ * Event-specific data
1428
+ */
1429
+ export interface Data extends SubscriptionsAPI.Subscription {
1430
+ /**
1431
+ * The type of payload in the data field
1432
+ */
1433
+ payload_type?: 'Subscription';
1434
+ }
1435
+ }
1436
+
1437
+ export interface SubscriptionFailedWebhookEvent {
1438
+ /**
1439
+ * The business identifier
1440
+ */
1441
+ business_id: string;
1442
+
1443
+ /**
1444
+ * Event-specific data
1445
+ */
1446
+ data: SubscriptionFailedWebhookEvent.Data;
1447
+
1448
+ /**
1449
+ * The timestamp of when the event occurred
1450
+ */
1451
+ timestamp: string;
1452
+
1453
+ /**
1454
+ * The event type
1455
+ */
1456
+ type: 'subscription.failed';
1457
+ }
1458
+
1459
+ export namespace SubscriptionFailedWebhookEvent {
1460
+ /**
1461
+ * Event-specific data
1462
+ */
1463
+ export interface Data extends SubscriptionsAPI.Subscription {
1464
+ /**
1465
+ * The type of payload in the data field
1466
+ */
1467
+ payload_type?: 'Subscription';
1468
+ }
1469
+ }
1470
+
1471
+ export interface SubscriptionOnHoldWebhookEvent {
1472
+ /**
1473
+ * The business identifier
1474
+ */
1475
+ business_id: string;
1476
+
1477
+ /**
1478
+ * Event-specific data
1479
+ */
1480
+ data: SubscriptionOnHoldWebhookEvent.Data;
1481
+
1482
+ /**
1483
+ * The timestamp of when the event occurred
1484
+ */
1485
+ timestamp: string;
1486
+
1487
+ /**
1488
+ * The event type
1489
+ */
1490
+ type: 'subscription.on_hold';
1491
+ }
1492
+
1493
+ export namespace SubscriptionOnHoldWebhookEvent {
1494
+ /**
1495
+ * Event-specific data
1496
+ */
1497
+ export interface Data extends SubscriptionsAPI.Subscription {
1498
+ /**
1499
+ * The type of payload in the data field
1500
+ */
1501
+ payload_type?: 'Subscription';
1502
+ }
1503
+ }
1504
+
1505
+ export interface SubscriptionPlanChangedWebhookEvent {
1506
+ /**
1507
+ * The business identifier
1508
+ */
1509
+ business_id: string;
1510
+
1511
+ /**
1512
+ * Event-specific data
1513
+ */
1514
+ data: SubscriptionPlanChangedWebhookEvent.Data;
1515
+
1516
+ /**
1517
+ * The timestamp of when the event occurred
1518
+ */
1519
+ timestamp: string;
1520
+
1521
+ /**
1522
+ * The event type
1523
+ */
1524
+ type: 'subscription.plan_changed';
1525
+ }
1526
+
1527
+ export namespace SubscriptionPlanChangedWebhookEvent {
1528
+ /**
1529
+ * Event-specific data
1530
+ */
1531
+ export interface Data extends SubscriptionsAPI.Subscription {
1532
+ /**
1533
+ * The type of payload in the data field
1534
+ */
1535
+ payload_type?: 'Subscription';
1536
+ }
1537
+ }
1538
+
1539
+ export interface SubscriptionRenewedWebhookEvent {
1540
+ /**
1541
+ * The business identifier
1542
+ */
1543
+ business_id: string;
1544
+
1545
+ /**
1546
+ * Event-specific data
1547
+ */
1548
+ data: SubscriptionRenewedWebhookEvent.Data;
1549
+
1550
+ /**
1551
+ * The timestamp of when the event occurred
1552
+ */
1553
+ timestamp: string;
1554
+
1555
+ /**
1556
+ * The event type
1557
+ */
1558
+ type: 'subscription.renewed';
1559
+ }
1560
+
1561
+ export namespace SubscriptionRenewedWebhookEvent {
1562
+ /**
1563
+ * Event-specific data
1564
+ */
1565
+ export interface Data extends SubscriptionsAPI.Subscription {
1566
+ /**
1567
+ * The type of payload in the data field
1568
+ */
1569
+ payload_type?: 'Subscription';
1570
+ }
1571
+ }
1572
+
1573
+ export type UnsafeUnwrapWebhookEvent =
1574
+ | DisputeAcceptedWebhookEvent
1575
+ | DisputeCancelledWebhookEvent
1576
+ | DisputeChallengedWebhookEvent
1577
+ | DisputeExpiredWebhookEvent
1578
+ | DisputeLostWebhookEvent
1579
+ | DisputeOpenedWebhookEvent
1580
+ | DisputeWonWebhookEvent
1581
+ | LicenseKeyCreatedWebhookEvent
1582
+ | PaymentCancelledWebhookEvent
1583
+ | PaymentFailedWebhookEvent
1584
+ | PaymentProcessingWebhookEvent
1585
+ | PaymentSucceededWebhookEvent
1586
+ | RefundFailedWebhookEvent
1587
+ | RefundSucceededWebhookEvent
1588
+ | SubscriptionActiveWebhookEvent
1589
+ | SubscriptionCancelledWebhookEvent
1590
+ | SubscriptionExpiredWebhookEvent
1591
+ | SubscriptionFailedWebhookEvent
1592
+ | SubscriptionOnHoldWebhookEvent
1593
+ | SubscriptionPlanChangedWebhookEvent
1594
+ | SubscriptionRenewedWebhookEvent;
1595
+
1596
+ export type UnwrapWebhookEvent =
1597
+ | DisputeAcceptedWebhookEvent
1598
+ | DisputeCancelledWebhookEvent
1599
+ | DisputeChallengedWebhookEvent
1600
+ | DisputeExpiredWebhookEvent
1601
+ | DisputeLostWebhookEvent
1602
+ | DisputeOpenedWebhookEvent
1603
+ | DisputeWonWebhookEvent
1604
+ | LicenseKeyCreatedWebhookEvent
1605
+ | PaymentCancelledWebhookEvent
1606
+ | PaymentFailedWebhookEvent
1607
+ | PaymentProcessingWebhookEvent
1608
+ | PaymentSucceededWebhookEvent
1609
+ | RefundFailedWebhookEvent
1610
+ | RefundSucceededWebhookEvent
1611
+ | SubscriptionActiveWebhookEvent
1612
+ | SubscriptionCancelledWebhookEvent
1613
+ | SubscriptionExpiredWebhookEvent
1614
+ | SubscriptionFailedWebhookEvent
1615
+ | SubscriptionOnHoldWebhookEvent
1616
+ | SubscriptionPlanChangedWebhookEvent
1617
+ | SubscriptionRenewedWebhookEvent;
1618
+
122
1619
  export interface WebhookCreateParams {
123
1620
  /**
124
1621
  * Url of the webhook
@@ -201,6 +1698,29 @@ export declare namespace Webhooks {
201
1698
  export {
202
1699
  type WebhookDetails as WebhookDetails,
203
1700
  type WebhookRetrieveSecretResponse as WebhookRetrieveSecretResponse,
1701
+ type DisputeAcceptedWebhookEvent as DisputeAcceptedWebhookEvent,
1702
+ type DisputeCancelledWebhookEvent as DisputeCancelledWebhookEvent,
1703
+ type DisputeChallengedWebhookEvent as DisputeChallengedWebhookEvent,
1704
+ type DisputeExpiredWebhookEvent as DisputeExpiredWebhookEvent,
1705
+ type DisputeLostWebhookEvent as DisputeLostWebhookEvent,
1706
+ type DisputeOpenedWebhookEvent as DisputeOpenedWebhookEvent,
1707
+ type DisputeWonWebhookEvent as DisputeWonWebhookEvent,
1708
+ type LicenseKeyCreatedWebhookEvent as LicenseKeyCreatedWebhookEvent,
1709
+ type PaymentCancelledWebhookEvent as PaymentCancelledWebhookEvent,
1710
+ type PaymentFailedWebhookEvent as PaymentFailedWebhookEvent,
1711
+ type PaymentProcessingWebhookEvent as PaymentProcessingWebhookEvent,
1712
+ type PaymentSucceededWebhookEvent as PaymentSucceededWebhookEvent,
1713
+ type RefundFailedWebhookEvent as RefundFailedWebhookEvent,
1714
+ type RefundSucceededWebhookEvent as RefundSucceededWebhookEvent,
1715
+ type SubscriptionActiveWebhookEvent as SubscriptionActiveWebhookEvent,
1716
+ type SubscriptionCancelledWebhookEvent as SubscriptionCancelledWebhookEvent,
1717
+ type SubscriptionExpiredWebhookEvent as SubscriptionExpiredWebhookEvent,
1718
+ type SubscriptionFailedWebhookEvent as SubscriptionFailedWebhookEvent,
1719
+ type SubscriptionOnHoldWebhookEvent as SubscriptionOnHoldWebhookEvent,
1720
+ type SubscriptionPlanChangedWebhookEvent as SubscriptionPlanChangedWebhookEvent,
1721
+ type SubscriptionRenewedWebhookEvent as SubscriptionRenewedWebhookEvent,
1722
+ type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
1723
+ type UnwrapWebhookEvent as UnwrapWebhookEvent,
204
1724
  type WebhookDetailsCursorPagePagination as WebhookDetailsCursorPagePagination,
205
1725
  type WebhookCreateParams as WebhookCreateParams,
206
1726
  type WebhookUpdateParams as WebhookUpdateParams,