@whop/sdk 0.0.8 → 0.0.10

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 (152) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/client.d.mts +14 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +14 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +9 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +9 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/account-links.d.mts +59 -0
  12. package/resources/account-links.d.mts.map +1 -0
  13. package/resources/account-links.d.ts +59 -0
  14. package/resources/account-links.d.ts.map +1 -0
  15. package/resources/account-links.js +27 -0
  16. package/resources/account-links.js.map +1 -0
  17. package/resources/account-links.mjs +23 -0
  18. package/resources/account-links.mjs.map +1 -0
  19. package/resources/app-builds.d.mts +12 -0
  20. package/resources/app-builds.d.mts.map +1 -1
  21. package/resources/app-builds.d.ts +12 -0
  22. package/resources/app-builds.d.ts.map +1 -1
  23. package/resources/apps.d.mts +1 -1
  24. package/resources/apps.d.mts.map +1 -1
  25. package/resources/apps.d.ts +1 -1
  26. package/resources/apps.d.ts.map +1 -1
  27. package/resources/authorized-users.d.mts +8 -0
  28. package/resources/authorized-users.d.mts.map +1 -1
  29. package/resources/authorized-users.d.ts +8 -0
  30. package/resources/authorized-users.d.ts.map +1 -1
  31. package/resources/checkout-configurations.d.mts +8 -0
  32. package/resources/checkout-configurations.d.mts.map +1 -1
  33. package/resources/checkout-configurations.d.ts +8 -0
  34. package/resources/checkout-configurations.d.ts.map +1 -1
  35. package/resources/companies.d.mts +8 -0
  36. package/resources/companies.d.mts.map +1 -1
  37. package/resources/companies.d.ts +8 -0
  38. package/resources/companies.d.ts.map +1 -1
  39. package/resources/disputes.d.mts +8 -0
  40. package/resources/disputes.d.mts.map +1 -1
  41. package/resources/disputes.d.ts +8 -0
  42. package/resources/disputes.d.ts.map +1 -1
  43. package/resources/entries.d.mts +8 -0
  44. package/resources/entries.d.mts.map +1 -1
  45. package/resources/entries.d.ts +8 -0
  46. package/resources/entries.d.ts.map +1 -1
  47. package/resources/experiences.d.mts +8 -0
  48. package/resources/experiences.d.mts.map +1 -1
  49. package/resources/experiences.d.ts +8 -0
  50. package/resources/experiences.d.ts.map +1 -1
  51. package/resources/index.d.mts +5 -2
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +5 -2
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +7 -1
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +3 -0
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/invoices.d.mts +8 -0
  60. package/resources/invoices.d.mts.map +1 -1
  61. package/resources/invoices.d.ts +8 -0
  62. package/resources/invoices.d.ts.map +1 -1
  63. package/resources/payment-tokens.d.mts +157 -0
  64. package/resources/payment-tokens.d.mts.map +1 -0
  65. package/resources/payment-tokens.d.ts +157 -0
  66. package/resources/payment-tokens.d.ts.map +1 -0
  67. package/resources/payment-tokens.js +34 -0
  68. package/resources/payment-tokens.js.map +1 -0
  69. package/resources/payment-tokens.mjs +30 -0
  70. package/resources/payment-tokens.mjs.map +1 -0
  71. package/resources/payments.d.mts +256 -2
  72. package/resources/payments.d.mts.map +1 -1
  73. package/resources/payments.d.ts +256 -2
  74. package/resources/payments.d.ts.map +1 -1
  75. package/resources/payments.js +31 -0
  76. package/resources/payments.js.map +1 -1
  77. package/resources/payments.mjs +31 -0
  78. package/resources/payments.mjs.map +1 -1
  79. package/resources/plans.d.mts +9 -11
  80. package/resources/plans.d.mts.map +1 -1
  81. package/resources/plans.d.ts +9 -11
  82. package/resources/plans.d.ts.map +1 -1
  83. package/resources/products.d.mts +8 -26
  84. package/resources/products.d.mts.map +1 -1
  85. package/resources/products.d.ts +8 -26
  86. package/resources/products.d.ts.map +1 -1
  87. package/resources/promo-codes.d.mts +8 -0
  88. package/resources/promo-codes.d.mts.map +1 -1
  89. package/resources/promo-codes.d.ts +8 -0
  90. package/resources/promo-codes.d.ts.map +1 -1
  91. package/resources/refunds.d.mts +8 -0
  92. package/resources/refunds.d.mts.map +1 -1
  93. package/resources/refunds.d.ts +8 -0
  94. package/resources/refunds.d.ts.map +1 -1
  95. package/resources/reviews.d.mts +8 -0
  96. package/resources/reviews.d.mts.map +1 -1
  97. package/resources/reviews.d.ts +8 -0
  98. package/resources/reviews.d.ts.map +1 -1
  99. package/resources/setup-intents.d.mts +359 -0
  100. package/resources/setup-intents.d.mts.map +1 -0
  101. package/resources/setup-intents.d.ts +359 -0
  102. package/resources/setup-intents.d.ts.map +1 -0
  103. package/resources/setup-intents.js +38 -0
  104. package/resources/setup-intents.js.map +1 -0
  105. package/resources/setup-intents.mjs +34 -0
  106. package/resources/setup-intents.mjs.map +1 -0
  107. package/resources/shared.d.mts +50 -0
  108. package/resources/shared.d.mts.map +1 -1
  109. package/resources/shared.d.ts +50 -0
  110. package/resources/shared.d.ts.map +1 -1
  111. package/resources/transfers.d.mts +8 -0
  112. package/resources/transfers.d.mts.map +1 -1
  113. package/resources/transfers.d.ts +8 -0
  114. package/resources/transfers.d.ts.map +1 -1
  115. package/resources/webhooks.d.mts +72 -2
  116. package/resources/webhooks.d.mts.map +1 -1
  117. package/resources/webhooks.d.ts +72 -2
  118. package/resources/webhooks.d.ts.map +1 -1
  119. package/resources/webhooks.js.map +1 -1
  120. package/resources/webhooks.mjs.map +1 -1
  121. package/src/client.ts +56 -1
  122. package/src/resources/account-links.ts +73 -0
  123. package/src/resources/app-builds.ts +15 -0
  124. package/src/resources/apps.ts +1 -0
  125. package/src/resources/authorized-users.ts +10 -0
  126. package/src/resources/checkout-configurations.ts +10 -0
  127. package/src/resources/companies.ts +10 -0
  128. package/src/resources/disputes.ts +10 -0
  129. package/src/resources/entries.ts +10 -0
  130. package/src/resources/experiences.ts +10 -0
  131. package/src/resources/index.ts +21 -0
  132. package/src/resources/invoices.ts +10 -0
  133. package/src/resources/payment-tokens.ts +207 -0
  134. package/src/resources/payments.ts +307 -0
  135. package/src/resources/plans.ts +11 -13
  136. package/src/resources/products.ts +10 -32
  137. package/src/resources/promo-codes.ts +10 -0
  138. package/src/resources/refunds.ts +10 -0
  139. package/src/resources/reviews.ts +10 -0
  140. package/src/resources/setup-intents.ts +435 -0
  141. package/src/resources/shared.ts +59 -0
  142. package/src/resources/transfers.ts +10 -0
  143. package/src/resources/webhooks.ts +91 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.mts.map +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.d.ts.map +1 -1
  149. package/version.js +1 -1
  150. package/version.js.map +1 -1
  151. package/version.mjs +1 -1
  152. package/version.mjs.map +1 -1
@@ -1,6 +1,7 @@
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 PaymentsAPI from './payments';
4
5
  import * as Shared from './shared';
5
6
  import { APIPromise } from '../core/api-promise';
6
7
  import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
@@ -8,6 +9,38 @@ import { RequestOptions } from '../internal/request-options';
8
9
  import { path } from '../internal/utils/path';
9
10
 
10
11
  export class Payments extends APIResource {
12
+ /**
13
+ * Creates a payment. This endpoint will respond with a payment object immediately,
14
+ * but the payment is processed asynchronously in the background. Use webhooks to
15
+ * be notified when the payment succeeds or fails.
16
+ *
17
+ * Required permissions:
18
+ *
19
+ * - `payment:charge`
20
+ * - `plan:create`
21
+ * - `access_pass:create`
22
+ * - `access_pass:update`
23
+ * - `plan:basic:read`
24
+ * - `access_pass:basic:read`
25
+ * - `member:email:read`
26
+ * - `member:basic:read`
27
+ * - `member:phone:read`
28
+ * - `promo_code:basic:read`
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const payment = await client.payments.create({
33
+ * company_id: 'biz_xxxxxxxxxxxxxx',
34
+ * member_id: 'mber_xxxxxxxxxxxxx',
35
+ * payment_token_id: 'payt_xxxxxxxxxxxxx',
36
+ * plan: { currency: 'usd' },
37
+ * });
38
+ * ```
39
+ */
40
+ create(body: PaymentCreateParams, options?: RequestOptions): APIPromise<Shared.Payment> {
41
+ return this._client.post('/payments', { body, ...options });
42
+ }
43
+
11
44
  /**
12
45
  * Retrieves a payment by ID
13
46
  *
@@ -262,6 +295,7 @@ export type PaymentMethodTypes =
262
295
  | 'splitit'
263
296
  | 'platform_balance'
264
297
  | 'apple'
298
+ | 'venmo'
265
299
  | 'unknown';
266
300
 
267
301
  /**
@@ -359,6 +393,11 @@ export interface PaymentListResponse {
359
393
  */
360
394
  payment_method_type: PaymentMethodTypes | null;
361
395
 
396
+ /**
397
+ * The payment token used for the payment, if available.
398
+ */
399
+ payment_token: PaymentListResponse.PaymentToken | null;
400
+
362
401
  /**
363
402
  * The plan attached to this payment.
364
403
  */
@@ -525,6 +564,60 @@ export namespace PaymentListResponse {
525
564
  status: Shared.MembershipStatus;
526
565
  }
527
566
 
567
+ /**
568
+ * The payment token used for the payment, if available.
569
+ */
570
+ export interface PaymentToken {
571
+ /**
572
+ * The ID of the payment token
573
+ */
574
+ id: string;
575
+
576
+ /**
577
+ * The card data associated with the payment token, if its a debit or credit card
578
+ * token.
579
+ */
580
+ card: PaymentToken.Card | null;
581
+
582
+ /**
583
+ * The date and time the payment token was created
584
+ */
585
+ created_at: string;
586
+
587
+ /**
588
+ * The payment method type of the payment token
589
+ */
590
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
591
+ }
592
+
593
+ export namespace PaymentToken {
594
+ /**
595
+ * The card data associated with the payment token, if its a debit or credit card
596
+ * token.
597
+ */
598
+ export interface Card {
599
+ /**
600
+ * Possible card brands that a payment token can have
601
+ */
602
+ brand: PaymentsAPI.CardBrands | null;
603
+
604
+ /**
605
+ * Card expiration month, like 03 for March.
606
+ */
607
+ exp_month: number | null;
608
+
609
+ /**
610
+ * Card expiration year, like 27 for 2027.
611
+ */
612
+ exp_year: number | null;
613
+
614
+ /**
615
+ * Last four digits of the card.
616
+ */
617
+ last4: string | null;
618
+ }
619
+ }
620
+
528
621
  /**
529
622
  * The plan attached to this payment.
530
623
  */
@@ -616,6 +709,219 @@ export namespace PaymentListResponse {
616
709
  }
617
710
  }
618
711
 
712
+ export type PaymentCreateParams =
713
+ | PaymentCreateParams.CreatePaymentInputWithPlan
714
+ | PaymentCreateParams.CreatePaymentInputWithPlanID;
715
+
716
+ export declare namespace PaymentCreateParams {
717
+ export interface CreatePaymentInputWithPlan {
718
+ /**
719
+ * The ID of the company to create the payment for.
720
+ */
721
+ company_id: string;
722
+
723
+ /**
724
+ * The ID of the member to create the payment for.
725
+ */
726
+ member_id: string;
727
+
728
+ /**
729
+ * The ID of the payment token to use for the payment. It must be connected to the
730
+ * Member being charged.
731
+ */
732
+ payment_token_id: string;
733
+
734
+ /**
735
+ * Pass this object to create a new plan for this payment
736
+ */
737
+ plan: CreatePaymentInputWithPlan.Plan;
738
+ }
739
+
740
+ export namespace CreatePaymentInputWithPlan {
741
+ /**
742
+ * Pass this object to create a new plan for this payment
743
+ */
744
+ export interface Plan {
745
+ /**
746
+ * The respective currency identifier for the plan.
747
+ */
748
+ currency: Shared.Currency;
749
+
750
+ /**
751
+ * The interval at which the plan charges (renewal plans).
752
+ */
753
+ billing_period?: number | null;
754
+
755
+ /**
756
+ * The description of the plan.
757
+ */
758
+ description?: string | null;
759
+
760
+ /**
761
+ * The interval at which the plan charges (expiration plans).
762
+ */
763
+ expiration_days?: number | null;
764
+
765
+ /**
766
+ * Whether to force the creation of a new plan even if one with the same attributes
767
+ * already exists.
768
+ */
769
+ force_create_new_plan?: boolean | null;
770
+
771
+ /**
772
+ * An additional amount charged upon first purchase.
773
+ */
774
+ initial_price?: number | null;
775
+
776
+ /**
777
+ * A personal description or notes section for the business.
778
+ */
779
+ internal_notes?: string | null;
780
+
781
+ /**
782
+ * The type of plan that can be attached to a product
783
+ */
784
+ plan_type?: Shared.PlanType | null;
785
+
786
+ /**
787
+ * Pass this object to create a new product for this plan. We will use the product
788
+ * external identifier to find or create an existing product.
789
+ */
790
+ product?: Plan.Product | null;
791
+
792
+ /**
793
+ * The product the plan is related to. Either this or product is required.
794
+ */
795
+ product_id?: string | null;
796
+
797
+ /**
798
+ * The amount the customer is charged every billing period.
799
+ */
800
+ renewal_price?: number | null;
801
+
802
+ /**
803
+ * The title of the plan. This will be visible on the product page to customers.
804
+ */
805
+ title?: string | null;
806
+
807
+ /**
808
+ * The number of free trial days added before a renewal plan.
809
+ */
810
+ trial_period_days?: number | null;
811
+
812
+ /**
813
+ * Visibility of a resource
814
+ */
815
+ visibility?: Shared.Visibility | null;
816
+ }
817
+
818
+ export namespace Plan {
819
+ /**
820
+ * Pass this object to create a new product for this plan. We will use the product
821
+ * external identifier to find or create an existing product.
822
+ */
823
+ export interface Product {
824
+ /**
825
+ * A unique ID used to find or create a product. When provided during creation, we
826
+ * will look for an existing product with this external identifier — if found, it
827
+ * will be updated; otherwise, a new product will be created.
828
+ */
829
+ external_identifier: string;
830
+
831
+ /**
832
+ * The title of the product.
833
+ */
834
+ title: string;
835
+
836
+ /**
837
+ * The different business types a company can be.
838
+ */
839
+ business_type?: Shared.BusinessTypes | null;
840
+
841
+ /**
842
+ * Whether or not to collect shipping information at checkout from the customer.
843
+ */
844
+ collect_shipping_address?: boolean | null;
845
+
846
+ /**
847
+ * The custom statement descriptor for the product i.e. WHOP\*SPORTS, must be
848
+ * between 5 and 22 characters, contain at least one letter, and not contain any of
849
+ * the following characters: <, >, \, ', "
850
+ */
851
+ custom_statement_descriptor?: string | null;
852
+
853
+ /**
854
+ * A written description of the product.
855
+ */
856
+ description?: string | null;
857
+
858
+ /**
859
+ * The percentage of the revenue that goes to the global affiliate program.
860
+ */
861
+ global_affiliate_percentage?: number | null;
862
+
863
+ /**
864
+ * The different statuses of the global affiliate program for a product.
865
+ */
866
+ global_affiliate_status?: Shared.GlobalAffiliateStatus | null;
867
+
868
+ /**
869
+ * The headline of the product.
870
+ */
871
+ headline?: string | null;
872
+
873
+ /**
874
+ * The different industry types a company can be in.
875
+ */
876
+ industry_type?: Shared.IndustryTypes | null;
877
+
878
+ /**
879
+ * The ID of the product tax code to apply to this product.
880
+ */
881
+ product_tax_code_id?: string | null;
882
+
883
+ /**
884
+ * The URL to redirect the customer to after a purchase.
885
+ */
886
+ redirect_purchase_url?: string | null;
887
+
888
+ /**
889
+ * The route of the product.
890
+ */
891
+ route?: string | null;
892
+
893
+ /**
894
+ * Visibility of a resource
895
+ */
896
+ visibility?: Shared.Visibility | null;
897
+ }
898
+ }
899
+ }
900
+
901
+ export interface CreatePaymentInputWithPlanID {
902
+ /**
903
+ * The ID of the company to create the payment for.
904
+ */
905
+ company_id: string;
906
+
907
+ /**
908
+ * The ID of the member to create the payment for.
909
+ */
910
+ member_id: string;
911
+
912
+ /**
913
+ * The ID of the payment token to use for the payment. It must be connected to the
914
+ * Member being charged.
915
+ */
916
+ payment_token_id: string;
917
+
918
+ /**
919
+ * An ID of an existing plan to use for the payment.
920
+ */
921
+ plan_id: string;
922
+ }
923
+ }
924
+
619
925
  export interface PaymentListParams extends CursorPageParams {
620
926
  /**
621
927
  * The ID of the company to list payments for
@@ -707,6 +1013,7 @@ export declare namespace Payments {
707
1013
  type PaymentMethodTypes as PaymentMethodTypes,
708
1014
  type PaymentListResponse as PaymentListResponse,
709
1015
  type PaymentListResponsesCursorPage as PaymentListResponsesCursorPage,
1016
+ type PaymentCreateParams as PaymentCreateParams,
710
1017
  type PaymentListParams as PaymentListParams,
711
1018
  type PaymentRefundParams as PaymentRefundParams,
712
1019
  };
@@ -344,7 +344,7 @@ export interface PlanCreateParams {
344
344
  description?: string | null;
345
345
 
346
346
  /**
347
- * The interval at which the plan charges (expiration plans).
347
+ * The interval at which the plan expires and revokes access (expiration plans).
348
348
  */
349
349
  expiration_days?: number | null;
350
350
 
@@ -398,18 +398,6 @@ export interface PlanCreateParams {
398
398
  */
399
399
  stock?: number | null;
400
400
 
401
- /**
402
- * The price to display with a strikethrough for the initial price. Provided as a
403
- * number in dollars. Eg: 19.99 for $19.99
404
- */
405
- strike_through_initial_price?: number | null;
406
-
407
- /**
408
- * The price to display with a strikethrough for the renewal price. Provided as a
409
- * number in dollars. Eg: 19.99 for $19.99
410
- */
411
- strike_through_renewal_price?: number | null;
412
-
413
401
  /**
414
402
  * The title of the plan. This will be visible on the product page to customers.
415
403
  */
@@ -713,6 +701,16 @@ export interface PlanListParams extends CursorPageParams {
713
701
  */
714
702
  before?: string | null;
715
703
 
704
+ /**
705
+ * The minimum creation date to filter by
706
+ */
707
+ created_after?: string | null;
708
+
709
+ /**
710
+ * The maximum creation date to filter by
711
+ */
712
+ created_before?: string | null;
713
+
716
714
  /**
717
715
  * The direction of the sort.
718
716
  */
@@ -330,14 +330,6 @@ export namespace ProductCreateParams {
330
330
  }
331
331
 
332
332
  export interface ProductUpdateParams {
333
- /**
334
- * A banner image for the product in png, jpeg format
335
- */
336
- banner_image?:
337
- | ProductUpdateParams.AttachmentInputWithDirectUploadID
338
- | ProductUpdateParams.AttachmentInputWithID
339
- | null;
340
-
341
333
  /**
342
334
  * The different business types a company can be.
343
335
  */
@@ -432,30 +424,6 @@ export interface ProductUpdateParams {
432
424
  }
433
425
 
434
426
  export namespace ProductUpdateParams {
435
- /**
436
- * Input for an attachment
437
- */
438
- export interface AttachmentInputWithDirectUploadID {
439
- /**
440
- * This ID should be used the first time you upload an attachment. It is the ID of
441
- * the direct upload that was created when uploading the file to S3 via the
442
- * mediaDirectUpload mutation.
443
- */
444
- direct_upload_id: string;
445
- }
446
-
447
- /**
448
- * Input for an attachment
449
- */
450
- export interface AttachmentInputWithID {
451
- /**
452
- * The ID of an existing attachment object. Use this when updating a resource and
453
- * keeping a subset of the attachments. Don't use this unless you know what you're
454
- * doing.
455
- */
456
- id: string;
457
- }
458
-
459
427
  /**
460
428
  * Configuration for a product on the company's store page.
461
429
  */
@@ -483,6 +451,16 @@ export interface ProductListParams extends CursorPageParams {
483
451
  */
484
452
  before?: string | null;
485
453
 
454
+ /**
455
+ * The minimum creation date to filter by
456
+ */
457
+ created_after?: string | null;
458
+
459
+ /**
460
+ * The maximum creation date to filter by
461
+ */
462
+ created_before?: string | null;
463
+
486
464
  /**
487
465
  * The direction of the sort.
488
466
  */
@@ -450,6 +450,16 @@ export interface PromoCodeListParams extends CursorPageParams {
450
450
  */
451
451
  before?: string | null;
452
452
 
453
+ /**
454
+ * The minimum creation date to filter by
455
+ */
456
+ created_after?: string | null;
457
+
458
+ /**
459
+ * The maximum creation date to filter by
460
+ */
461
+ created_before?: string | null;
462
+
453
463
  /**
454
464
  * Returns the first _n_ elements from the list.
455
465
  */
@@ -353,6 +353,16 @@ export interface RefundListParams extends CursorPageParams {
353
353
  */
354
354
  before?: string | null;
355
355
 
356
+ /**
357
+ * The minimum creation date to filter by
358
+ */
359
+ created_after?: string | null;
360
+
361
+ /**
362
+ * The maximum creation date to filter by
363
+ */
364
+ created_before?: string | null;
365
+
356
366
  /**
357
367
  * The direction of the sort.
358
368
  */
@@ -316,6 +316,16 @@ export interface ReviewListParams extends CursorPageParams {
316
316
  */
317
317
  before?: string | null;
318
318
 
319
+ /**
320
+ * The minimum creation date to filter by
321
+ */
322
+ created_after?: string | null;
323
+
324
+ /**
325
+ * The maximum creation date to filter by
326
+ */
327
+ created_before?: string | null;
328
+
319
329
  /**
320
330
  * Returns the first _n_ elements from the list.
321
331
  */