@whop/sdk 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/client.d.mts +11 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +11 -5
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/app-builds.d.mts +4 -0
- package/resources/app-builds.d.mts.map +1 -1
- package/resources/app-builds.d.ts +4 -0
- package/resources/app-builds.d.ts.map +1 -1
- package/resources/index.d.mts +4 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.mts +20 -0
- package/resources/invoices.d.mts.map +1 -1
- package/resources/invoices.d.ts +20 -0
- package/resources/invoices.d.ts.map +1 -1
- package/resources/payment-methods.d.mts +163 -0
- package/resources/payment-methods.d.mts.map +1 -0
- package/resources/payment-methods.d.ts +163 -0
- package/resources/payment-methods.d.ts.map +1 -0
- package/resources/payment-methods.js +42 -0
- package/resources/payment-methods.js.map +1 -0
- package/resources/payment-methods.mjs +38 -0
- package/resources/payment-methods.mjs.map +1 -0
- package/resources/payments.d.mts +255 -1
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +255 -1
- package/resources/payments.d.ts.map +1 -1
- package/resources/payments.js +33 -0
- package/resources/payments.js.map +1 -1
- package/resources/payments.mjs +33 -0
- package/resources/payments.mjs.map +1 -1
- package/resources/setup-intents.d.mts +363 -0
- package/resources/setup-intents.d.mts.map +1 -0
- package/resources/setup-intents.d.ts +363 -0
- package/resources/setup-intents.d.ts.map +1 -0
- package/resources/setup-intents.js +46 -0
- package/resources/setup-intents.js.map +1 -0
- package/resources/setup-intents.mjs +42 -0
- package/resources/setup-intents.mjs.map +1 -0
- package/resources/shared.d.mts +48 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +48 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/webhooks.d.mts +72 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +72 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs.map +1 -1
- package/src/client.ts +47 -1
- package/src/resources/app-builds.ts +5 -0
- package/src/resources/index.ts +20 -0
- package/src/resources/invoices.ts +24 -0
- package/src/resources/payment-methods.ts +213 -0
- package/src/resources/payments.ts +306 -0
- package/src/resources/setup-intents.ts +439 -0
- package/src/resources/shared.ts +57 -0
- package/src/resources/webhooks.ts +91 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- 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,40 @@ 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
|
+
* Charge an existing member off-session using one of their stored payment methods.
|
|
14
|
+
* You can provide an existing plan, or create a new one in-line. This endpoint
|
|
15
|
+
* will respond with a payment object immediately, but the payment is processed
|
|
16
|
+
* asynchronously in the background. Use webhooks to be notified when the payment
|
|
17
|
+
* succeeds or fails.
|
|
18
|
+
*
|
|
19
|
+
* Required permissions:
|
|
20
|
+
*
|
|
21
|
+
* - `payment:charge`
|
|
22
|
+
* - `plan:create`
|
|
23
|
+
* - `access_pass:create`
|
|
24
|
+
* - `access_pass:update`
|
|
25
|
+
* - `plan:basic:read`
|
|
26
|
+
* - `access_pass:basic:read`
|
|
27
|
+
* - `member:email:read`
|
|
28
|
+
* - `member:basic:read`
|
|
29
|
+
* - `member:phone:read`
|
|
30
|
+
* - `promo_code:basic:read`
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const payment = await client.payments.create({
|
|
35
|
+
* company_id: 'biz_xxxxxxxxxxxxxx',
|
|
36
|
+
* member_id: 'mber_xxxxxxxxxxxxx',
|
|
37
|
+
* payment_method_id: 'pmt_xxxxxxxxxxxxxx',
|
|
38
|
+
* plan: { currency: 'usd' },
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
create(body: PaymentCreateParams, options?: RequestOptions): APIPromise<Shared.Payment> {
|
|
43
|
+
return this._client.post('/payments', { body, ...options });
|
|
44
|
+
}
|
|
45
|
+
|
|
11
46
|
/**
|
|
12
47
|
* Retrieves a payment by ID
|
|
13
48
|
*
|
|
@@ -355,6 +390,11 @@ export interface PaymentListResponse {
|
|
|
355
390
|
*/
|
|
356
391
|
paid_at: string | null;
|
|
357
392
|
|
|
393
|
+
/**
|
|
394
|
+
* The payment method used for the payment, if available.
|
|
395
|
+
*/
|
|
396
|
+
payment_method: PaymentListResponse.PaymentMethod | null;
|
|
397
|
+
|
|
358
398
|
/**
|
|
359
399
|
* The different types of payment methods that can be used.
|
|
360
400
|
*/
|
|
@@ -526,6 +566,58 @@ export namespace PaymentListResponse {
|
|
|
526
566
|
status: Shared.MembershipStatus;
|
|
527
567
|
}
|
|
528
568
|
|
|
569
|
+
/**
|
|
570
|
+
* The payment method used for the payment, if available.
|
|
571
|
+
*/
|
|
572
|
+
export interface PaymentMethod {
|
|
573
|
+
/**
|
|
574
|
+
* The ID of the payment method
|
|
575
|
+
*/
|
|
576
|
+
id: string;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
580
|
+
*/
|
|
581
|
+
card: PaymentMethod.Card | null;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The date and time the payment method was created
|
|
585
|
+
*/
|
|
586
|
+
created_at: string;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* The payment method type of the payment method
|
|
590
|
+
*/
|
|
591
|
+
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export namespace PaymentMethod {
|
|
595
|
+
/**
|
|
596
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
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
|
+
|
|
529
621
|
/**
|
|
530
622
|
* The plan attached to this payment.
|
|
531
623
|
*/
|
|
@@ -617,6 +709,219 @@ export namespace PaymentListResponse {
|
|
|
617
709
|
}
|
|
618
710
|
}
|
|
619
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 method to use for the payment. It must be connected to the
|
|
730
|
+
* Member being charged.
|
|
731
|
+
*/
|
|
732
|
+
payment_method_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 method to use for the payment. It must be connected to the
|
|
914
|
+
* Member being charged.
|
|
915
|
+
*/
|
|
916
|
+
payment_method_id: string;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* An ID of an existing plan to use for the payment.
|
|
920
|
+
*/
|
|
921
|
+
plan_id: string;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
620
925
|
export interface PaymentListParams extends CursorPageParams {
|
|
621
926
|
/**
|
|
622
927
|
* The ID of the company to list payments for
|
|
@@ -708,6 +1013,7 @@ export declare namespace Payments {
|
|
|
708
1013
|
type PaymentMethodTypes as PaymentMethodTypes,
|
|
709
1014
|
type PaymentListResponse as PaymentListResponse,
|
|
710
1015
|
type PaymentListResponsesCursorPage as PaymentListResponsesCursorPage,
|
|
1016
|
+
type PaymentCreateParams as PaymentCreateParams,
|
|
711
1017
|
type PaymentListParams as PaymentListParams,
|
|
712
1018
|
type PaymentRefundParams as PaymentRefundParams,
|
|
713
1019
|
};
|