Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stripe Cancellation Webhook #1682

Merged
merged 6 commits into from Feb 13, 2019

Conversation

jessleenyc
Copy link
Contributor

@jessleenyc jessleenyc commented Jan 29, 2019

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Documentation Update

Description

  • Should remove user membership if subscription is cancelled (through stripe aka card is declined)
  • Allows users to cancel memberships even if subscription has already been removed (by stripe)

After Deploying

  • Run script to remove memberships for users who do not have active subscriptions

users_with_no_stripe_sub = potentially_affected_users.select do |user|
  Stripe::Customer.retrieve(user.stripe_id_code).subscriptions.total_count.zero?
end

users_with_no_stripe_sub.each do |user|
  customer = Stripe::Customer.retrieve(user.stripe_id_code)
  MembershipService.new(customer, user, user.monthly_dues).unsubscribe_customer
end
  • Send email to these members that their memberships have been cancelled
  • Add email reminders for users who experience billing issues

@jessleenyc jessleenyc changed the title [WIP] Stripe Updates [WIP] Add Stripe Cancellation Webhook Feb 8, 2019
@jessleenyc jessleenyc changed the title [WIP] Add Stripe Cancellation Webhook Add Stripe Cancellation Webhook Feb 8, 2019
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Feb 8, 2019
Copy link
Contributor

@Zhao-Andy Zhao-Andy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like coupon codes were removed by accident 🙈

@pr-triage pr-triage bot added PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes and removed PR: unreviewed bot applied label for PR's with no review labels Feb 8, 2019
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes labels Feb 8, 2019
Copy link
Member

@maestromac maestromac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Feb 13, 2019
@maestromac maestromac merged commit 49e3878 into forem:master Feb 13, 2019
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants