@@ -69,6 +69,8 @@ export const ObjectType = {
69
69
CommercePaymentAttempt : 'commerce_payment_attempt' ,
70
70
CommerceSubscription : 'commerce_subscription' ,
71
71
CommerceSubscriptionItem : 'commerce_subscription_item' ,
72
+ CommercePlan : 'commerce_plan' ,
73
+ Feature : 'feature' ,
72
74
} as const ;
73
75
74
76
export type ObjectType = ( typeof ObjectType ) [ keyof typeof ObjectType ] ;
@@ -791,71 +793,65 @@ export interface CommercePayerJSON extends ClerkResourceJSON {
791
793
updated_at : number ;
792
794
}
793
795
794
- export interface CommercePayeeJSON {
796
+ interface CommercePayeeJSON {
795
797
id : string ;
796
798
gateway_type : string ;
797
799
gateway_external_id : string ;
798
800
gateway_status : 'active' | 'pending' | 'restricted' | 'disconnected' ;
799
801
}
800
802
801
- export interface CommerceAmountJSON {
803
+ interface CommerceFeeJSON {
802
804
amount : number ;
803
805
amount_formatted : string ;
804
806
currency : string ;
805
807
currency_symbol : string ;
806
808
}
807
809
808
- export interface CommerceTotalsJSON {
809
- subtotal : CommerceAmountJSON ;
810
- tax_total : CommerceAmountJSON ;
811
- grand_total : CommerceAmountJSON ;
810
+ interface CommerceTotalsJSON {
811
+ subtotal : CommerceFeeJSON ;
812
+ tax_total : CommerceFeeJSON ;
813
+ grand_total : CommerceFeeJSON ;
812
814
}
813
815
814
- export interface CommercePaymentSourceJSON {
815
- id : string ;
816
- gateway : string ;
817
- gateway_external_id : string ;
818
- gateway_external_account_id ?: string ;
819
- payment_method : string ;
820
- status : 'active' | 'disconnected' ;
821
- card_type ?: string ;
822
- last4 ?: string ;
823
- }
824
-
825
- export interface CommercePaymentFailedReasonJSON {
826
- code : string ;
827
- decline_code : string ;
828
- }
829
-
830
- export interface CommerceSubscriptionCreditJSON {
831
- amount : CommerceAmountJSON ;
832
- cycle_days_remaining : number ;
833
- cycle_days_total : number ;
834
- cycle_remaining_percent : number ;
816
+ export interface FeatureJSON extends ClerkResourceJSON {
817
+ object : typeof ObjectType . Feature ;
818
+ name : string ;
819
+ description : string ;
820
+ slug : string ;
821
+ avatar_url : string ;
835
822
}
836
823
837
- export interface CommercePlanJSON {
824
+ /**
825
+ * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
826
+ * It is advised to pin the SDK version to avoid breaking changes.
827
+ */
828
+ export interface CommercePlanJSON extends ClerkResourceJSON {
829
+ object : typeof ObjectType . CommercePlan ;
838
830
id : string ;
839
- instance_id : string ;
840
831
product_id : string ;
841
832
name : string ;
842
833
slug : string ;
843
834
description ?: string ;
844
835
is_default : boolean ;
845
836
is_recurring : boolean ;
846
- amount : number ;
847
- period : 'month' | 'annual' ;
848
- interval : number ;
849
837
has_base_fee : boolean ;
850
- currency : string ;
851
- annual_monthly_amount : number ;
852
838
publicly_visible : boolean ;
839
+ fee : CommerceFeeJSON ;
840
+ annual_fee : CommerceFeeJSON ;
841
+ annual_monthly_fee : CommerceFeeJSON ;
842
+ for_payer_type : 'org' | 'user' ;
843
+ features : FeatureJSON [ ] ;
853
844
}
854
845
855
846
export interface CommerceSubscriptionItemJSON extends ClerkResourceJSON {
856
847
object : typeof ObjectType . CommerceSubscriptionItem ;
857
848
status : 'abandoned' | 'active' | 'canceled' | 'ended' | 'expired' | 'incomplete' | 'past_due' | 'upcoming' ;
858
- credit : CommerceSubscriptionCreditJSON ;
849
+ credit : {
850
+ amount : CommerceFeeJSON ;
851
+ cycle_days_remaining : number ;
852
+ cycle_days_total : number ;
853
+ cycle_remaining_percent : number ;
854
+ } ;
859
855
proration_date : string ;
860
856
plan_period : 'month' | 'annual' ;
861
857
period_start : number ;
@@ -865,8 +861,24 @@ export interface CommerceSubscriptionItemJSON extends ClerkResourceJSON {
865
861
lifetime_paid : number ;
866
862
next_payment_amount : number ;
867
863
next_payment_date : number ;
868
- amount : CommerceAmountJSON ;
869
- plan : CommercePlanJSON ;
864
+ amount : CommerceFeeJSON ;
865
+ plan : {
866
+ id : string ;
867
+ instance_id : string ;
868
+ product_id : string ;
869
+ name : string ;
870
+ slug : string ;
871
+ description ?: string ;
872
+ is_default : boolean ;
873
+ is_recurring : boolean ;
874
+ amount : number ;
875
+ period : 'month' | 'annual' ;
876
+ interval : number ;
877
+ has_base_fee : boolean ;
878
+ currency : string ;
879
+ annual_monthly_amount : number ;
880
+ publicly_visible : boolean ;
881
+ } ;
870
882
plan_id : string ;
871
883
}
872
884
@@ -881,13 +893,25 @@ export interface CommercePaymentAttemptJSON extends ClerkResourceJSON {
881
893
updated_at : number ;
882
894
paid_at ?: number ;
883
895
failed_at ?: number ;
884
- failed_reason ?: CommercePaymentFailedReasonJSON ;
896
+ failed_reason ?: {
897
+ code : string ;
898
+ decline_code : string ;
899
+ } ;
885
900
billing_date : number ;
886
901
charge_type : 'checkout' | 'recurring' ;
887
902
payee : CommercePayeeJSON ;
888
903
payer : CommercePayerJSON ;
889
904
totals : CommerceTotalsJSON ;
890
- payment_source : CommercePaymentSourceJSON ;
905
+ payment_source : {
906
+ id : string ;
907
+ gateway : string ;
908
+ gateway_external_id : string ;
909
+ gateway_external_account_id ?: string ;
910
+ payment_method : string ;
911
+ status : 'active' | 'disconnected' ;
912
+ card_type ?: string ;
913
+ last4 ?: string ;
914
+ } ;
891
915
subscription_items : CommerceSubscriptionItemJSON [ ] ;
892
916
}
893
917
0 commit comments