Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Feat unsubscribe#137

Open
ElSalvo96 wants to merge 2 commits intodevfrom
feat-unsubscribe
Open

Feat unsubscribe#137
ElSalvo96 wants to merge 2 commits intodevfrom
feat-unsubscribe

Conversation

@ElSalvo96
Copy link
Member

No description provided.

@ElSalvo96 ElSalvo96 linked an issue Oct 2, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-meadow-0269c6e03-137.westeurope.3.azurestaticapps.net

@ElSalvo96
Copy link
Member Author

ElSalvo96 commented Oct 2, 2023

@TouchySpidey, we have a problem with this feature.
When I click on unsubscribe, I successfully send a request to the unsubscribe service.

But after the response was OK, I sent another request to the User controller to refresh the isPremium variable.
Actually, there is no difference between:

  • Is premium
  • In premium but unsubscribed

image

What do you think about?

@ElSalvo96 ElSalvo96 self-assigned this Oct 2, 2023
@ElSalvo96 ElSalvo96 added Enhancement New feature or request Critical Solve or things goes bad labels Oct 2, 2023
@ElSalvo96 ElSalvo96 added this to the Payments and premium milestone Oct 2, 2023
@TouchySpidey
Copy link
Contributor

Unsubscribing basically means "I do not want to renew my subscription"
You paid for premium plan till October 10th, you can "unsubscribe" now, but you're still getting the premium plan till October 10th.
Stripe will issue a event "Subscription expire" or something like that when the cancelation's due.

image

@ElSalvo96
Copy link
Member Author

Okay but now, after the unsubscribe, the button to unsubscribe is still active. Because I use the isPremium variable to make the buttons subscribe and unsubscribe.

What I want to say is that we have a thirty-state which means have successfully unsubscribed but your actual subscription expires on 10 October.

Does it make sense?

If you gave me this state how do we manage the UI? On some websites, I see some links for "manage the subscription plan" that bring you to a page made by Stripe. There you have the renewal, the unsubscribe, and the bill.

Do you know this page or do you have other ideas?

@LorenzoBuongiorno what do you think about the UI scope?

@TouchySpidey
Copy link
Contributor

it should be no problem to let the user use the stripe subscription manager, i'll try tonight
you could GET /api/payments/manage-subscription, which will return a url, and redirect the user there
also as a GET Parameter you can pass referral: current location
so that when user is done watching their subscription, they are redirected back to where they left

@TouchySpidey
Copy link
Contributor

regarding the sub expiration, i can pass something along with isPremium:
like expiresOn: (date or null)
and autoRenew: (bool)

@ElSalvo96
Copy link
Member Author

it should be no problem to let the user use the stripe subscription manager, i'll try tonight
you could GET /api/payments/manage-subscription, which will return a url, and redirect the user there
also as a GET Parameter you can pass referral: current location
so that when the user is done watching their subscription, they are redirected back to where they left

I agree. One thing, don't take the url in input. I don't like to expose this for security issues. If you are 100% secure do it. If not set up the homepage as a go back url.

In the evening I'll create an issue for tracing this development!

@ElSalvo96
Copy link
Member Author

regarding the sub expiration, i can pass something along with isPremium:
like expiresOn: (date or null)
and autoRenew: (bool)

Ok, expiresOn in case of autoRenew false is the date of the end of subscription if it is true expiresOn is the value of next renew.
Also is null when isPremium is false.

AutoRenew is false when I have made the unsubscribe or when I want to make the subscription month by month.

So, the user should see the button unsubscribe when isPremium is true and autoRenew is also true.

If it's right I'll create another issue.
One last thing is about the name, I prefer to add the object subscription with the props:

  • expireDate
  • isAutoRenewActive

Let me know 💪

@TouchySpidey
Copy link
Contributor

TouchySpidey commented Oct 3, 2023

don't take the url in input. I don't like to expose this for security issues

umh ok i'll see what i can do
and also ok for everything else

@TouchySpidey
Copy link
Contributor

@EkimoCode
we didn't consider storing the cancel_at_period_end flag, gotta alter the table and tweak the webhook a little
i'm on it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Critical Solve or things goes bad Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: Manage unsubscribe

2 participants