File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
api/src/modules/commerce/resolvers
commerce/src/stripe-billing Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ export const Organization: Pick<
60
60
organizationId : billingRecord . organizationId ,
61
61
} ) ;
62
62
63
+ const logger = injector . get ( Logger ) ;
64
+
63
65
if ( ! subscriptionInfo ) {
66
+ logger . info ( 'No active subscription for organization (id=%s)' , org . id ) ;
64
67
return {
65
68
hasActiveSubscription : false ,
66
69
canUpdateSubscription : true ,
@@ -85,6 +88,10 @@ export const Organization: Pick<
85
88
i => i . charge !== null && typeof i . charge === 'object' && i . charge ?. failure_code !== null ,
86
89
) ;
87
90
91
+ if ( ! subscriptionInfo . paymentMethod ) {
92
+ logger . warn ( 'Active subscription found but is missing a payment method (id=%s)' , org . id ) ;
93
+ }
94
+
88
95
return {
89
96
hasActiveSubscription : subscriptionInfo . subscription !== null ,
90
97
canUpdateSubscription : subscriptionInfo . subscription !== null ,
Original file line number Diff line number Diff line change @@ -92,10 +92,13 @@ export const stripeBillingRouter = router({
92
92
93
93
const actualSubscription = subscriptions [ 0 ] || null ;
94
94
95
- const paymentMethod = await ctx . stripeBilling . stripe . paymentMethods . list ( {
96
- customer : customer . id ,
97
- type : 'card' ,
98
- } ) ;
95
+ const paymentMethod = await ctx . stripeBilling . stripe . customers . listPaymentMethods (
96
+ customer . id ,
97
+ {
98
+ type : 'card' ,
99
+ limit : 1 ,
100
+ } ,
101
+ ) ;
99
102
100
103
return {
101
104
paymentMethod : paymentMethod . data [ 0 ] || null ,
You can’t perform that action at this time.
0 commit comments