public async Task <PageResult> OnPost(string userId) { var EmailToUnsubscribe = await GetEmail(userId); try { await _paymentHandlerSubscription.CancelSubscriptionAtPeriodEnd(EmailToUnsubscribe); Message = $"{NameToUnsubscribe} has been unsubscribed from DevBetter. They will retain access until the end of their subscription period."; return(Page()); } catch { Message = "Attempt to cancel subscription failed."; return(Page()); } }
public async Task <PageResult> OnPost() { var user = await _userManager.GetUserAsync(User); var email = user.Email; try { await _paymentHandlerSubscription.CancelSubscriptionAtPeriodEnd(email); Message = "You have been unsubscribed from DevBetter. You will retain access until the end of your subscription period."; return(Page()); } catch { Message = "Attempt to cancel subscription failed."; return(Page()); } }