File tree Expand file tree Collapse file tree
cloud/src/LrmCloud.Api/Services/Billing/Providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,6 +164,14 @@ public async Task CancelSubscriptionAsync(string subscriptionId)
164164 var response = await _httpClient . SendAsync ( request ) ;
165165 if ( ! response . IsSuccessStatusCode )
166166 {
167+ // If subscription doesn't exist in PayPal (e.g., incomplete/abandoned payment),
168+ // treat it as successfully cancelled - there's nothing to cancel
169+ if ( response . StatusCode == System . Net . HttpStatusCode . NotFound )
170+ {
171+ _logger . LogWarning ( "PayPal subscription {SubscriptionId} not found - treating as cancelled" , subscriptionId ) ;
172+ return ;
173+ }
174+
167175 var errorBody = await response . Content . ReadAsStringAsync ( ) ;
168176 _logger . LogError ( "PayPal cancel subscription failed: {StatusCode} - {Body}" ,
169177 response . StatusCode , errorBody ) ;
You can’t perform that action at this time.
0 commit comments