@@ -63,6 +63,10 @@ export const ObjectType = {
6363 TestingToken : 'testing_token' ,
6464 Role : 'role' ,
6565 Permission : 'permission' ,
66+ CommercePayer : 'commerce_payer' ,
67+ CommercePaymentAttempt : 'commerce_payment_attempt' ,
68+ CommerceSubscription : 'commerce_subscription' ,
69+ CommerceSubscriptionItem : 'commerce_subscription_item' ,
6670} as const ;
6771
6872export type ObjectType = ( typeof ObjectType ) [ keyof typeof ObjectType ] ;
@@ -757,6 +761,136 @@ export interface IdPOAuthAccessTokenJSON extends ClerkResourceJSON {
757761 updated_at : number ;
758762}
759763
764+ export interface CommercePayerJSON extends ClerkResourceJSON {
765+ object : typeof ObjectType . CommercePayer ;
766+ instance_id : string ;
767+ user_id ?: string ;
768+ first_name ?: string ;
769+ last_name ?: string ;
770+ email : string ;
771+ organization_id ?: string ;
772+ organization_name ?: string ;
773+ image_url : string ;
774+ created_at : number ;
775+ updated_at : number ;
776+ }
777+
778+ export interface CommercePayeeJSON {
779+ id : string ;
780+ gateway_type : string ;
781+ gateway_external_id : string ;
782+ gateway_status : 'active' | 'pending' | 'restricted' | 'disconnected' ;
783+ }
784+
785+ export interface CommerceAmountJSON {
786+ amount : number ;
787+ amount_formatted : string ;
788+ currency : string ;
789+ currency_symbol : string ;
790+ }
791+
792+ export interface CommerceTotalsJSON {
793+ subtotal : CommerceAmountJSON ;
794+ tax_total : CommerceAmountJSON ;
795+ grand_total : CommerceAmountJSON ;
796+ }
797+
798+ export interface CommercePaymentSourceJSON {
799+ id : string ;
800+ gateway : string ;
801+ gateway_external_id : string ;
802+ gateway_external_account_id ?: string ;
803+ payment_method : string ;
804+ status : 'active' | 'disconnected' ;
805+ card_type ?: string ;
806+ last4 ?: string ;
807+ }
808+
809+ export interface CommercePaymentFailedReasonJSON {
810+ code : string ;
811+ decline_code : string ;
812+ }
813+
814+ export interface CommerceSubscriptionCreditJSON {
815+ amount : CommerceAmountJSON ;
816+ cycle_days_remaining : number ;
817+ cycle_days_total : number ;
818+ cycle_remaining_percent : number ;
819+ }
820+
821+ export interface CommercePlanJSON {
822+ id : string ;
823+ instance_id : string ;
824+ product_id : string ;
825+ name : string ;
826+ slug : string ;
827+ description ?: string ;
828+ is_default : boolean ;
829+ is_recurring : boolean ;
830+ amount : number ;
831+ period : 'month' | 'annual' ;
832+ interval : number ;
833+ has_base_fee : boolean ;
834+ currency : string ;
835+ annual_monthly_amount : number ;
836+ publicly_visible : boolean ;
837+ }
838+
839+ export interface CommerceSubscriptionItemJSON extends ClerkResourceJSON {
840+ object : typeof ObjectType . CommerceSubscriptionItem ;
841+ status : 'abandoned' | 'active' | 'canceled' | 'ended' | 'expired' | 'incomplete' | 'past_due' | 'upcoming' ;
842+ credit : CommerceSubscriptionCreditJSON ;
843+ proration_date : string ;
844+ plan_period : 'month' | 'annual' ;
845+ period_start : number ;
846+ period_end ?: number ;
847+ canceled_at ?: number ;
848+ past_due_at ?: number ;
849+ lifetime_paid : number ;
850+ next_payment_amount : number ;
851+ next_payment_date : number ;
852+ amount : CommerceAmountJSON ;
853+ plan : CommercePlanJSON ;
854+ plan_id : string ;
855+ }
856+
857+ export interface CommercePaymentAttemptJSON extends ClerkResourceJSON {
858+ object : typeof ObjectType . CommercePaymentAttempt ;
859+ instance_id : string ;
860+ payment_id : string ;
861+ statement_id : string ;
862+ gateway_external_id : string ;
863+ status : 'pending' | 'paid' | 'failed' ;
864+ created_at : number ;
865+ updated_at : number ;
866+ paid_at ?: number ;
867+ failed_at ?: number ;
868+ failed_reason ?: CommercePaymentFailedReasonJSON ;
869+ billing_date : number ;
870+ charge_type : 'checkout' | 'recurring' ;
871+ payee : CommercePayeeJSON ;
872+ payer : CommercePayerJSON ;
873+ totals : CommerceTotalsJSON ;
874+ payment_source : CommercePaymentSourceJSON ;
875+ subscription_items : CommerceSubscriptionItemJSON [ ] ;
876+ }
877+
878+ export interface CommerceSubscriptionJSON extends ClerkResourceJSON {
879+ object : typeof ObjectType . CommerceSubscription ;
880+ status : 'abandoned' | 'active' | 'canceled' | 'ended' | 'expired' | 'incomplete' | 'past_due' | 'upcoming' ;
881+ active_at ?: number ;
882+ canceled_at ?: number ;
883+ created_at : number ;
884+ ended_at ?: number ;
885+ past_due_at ?: number ;
886+ updated_at : number ;
887+ latest_payment_id : string ;
888+ payer_id : string ;
889+ payer : CommercePayerJSON ;
890+ payment_source_id : string ;
891+ items : CommerceSubscriptionItemJSON [ ] ;
892+ }
893+
760894export interface WebhooksSvixJSON {
761895 svix_url : string ;
762896}
0 commit comments