Skip to content

Commit

Permalink
fix fatal error when attempting to cancel a cancelled Stripe subscrip…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
ashutoshgngwr committed Sep 8, 2022
1 parent 50254ac commit d5ed79f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private void handleStripeCheckoutSessionEvent(@NonNull Session session) throws W
try {
stripeApi.refundSubscription(session.getSubscription());
} catch (StripeException e) {
throw new RuntimeException("failed to cancel stripe subscription", e);
throw new RuntimeException("failed to refund stripe subscription", e);
}
} else {
copySubscriptionDetailsFromStripeObject(subscription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ public void refundSubscription(@NonNull String id) throws StripeException {
}
}

subscription.cancel();
if (!"canceled".equals(subscription.getStatus())) {
subscription.cancel();
}
}

/**
Expand Down

0 comments on commit d5ed79f

Please sign in to comment.