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 support for pausing a subscription when trial ends without a payment method #623

Open
krishsatya opened this issue May 3, 2024 · 4 comments

Comments

@krishsatya
Copy link

Feature request

  • Extension name: firestore-stripe-payments

Is your feature request related to a problem? Please describe.

I want to offer users the option to go through checkout without a payment option, which is already supported with payment_method_collection: "if_required". However, if their trial ends and they haven't provided a payment method, I'd like the subscription to be paused instead of cancelled.

Describe the solution you'd like

I believe the solution is to include the below map into subscription_data, similar to what's being done for trial_period_days. Could be as simple as exposing a field called trial_end_behavior that takes a string and defaults to "cancel".

trial_settings: {
  end_behavior: {
    missing_payment_method: "paused",
  },
}

Describe alternatives you've considered

I suppose I could wait for the subscription object to get created and then modify it after checkout. Not ideal though.

Additional context

n/a

@ibrahimbroachwala
Copy link

+1 with a need for this param.

@thetwentyseven
Copy link

+1 Yes please, I have updated the latest firebase extension to remove the stripe one, and replace it with the invertase, and downloaded the new package too and it seems it does not allow to add payment_method_collection: "if_required" in

import { createCheckoutSession } from "@invertase/firestore-stripe-payments";

const session = await createCheckoutSession(payments, {
  price: myPriceId,
  payment_method_collection: "if_required"
});
window.location.assign(session.url);

@thetwentyseven
Copy link

thetwentyseven commented Oct 12, 2024

This is actually working for me now in my local. I forgot to remove the extension in my local.

firebase ext:uninstall --local stripe/firestore-stripe-payments

and add the correct one

firebase ext:install --local invertase/firestore-stripe-payments

Make sure you do not install it along one another because the extension instance name will change and you will have to configure a new endpoint.

Then I just added the following:

import { createCheckoutSession } from "@invertase/firestore-stripe-payments";

const session = await createCheckoutSession(payments, {
  price: myPriceId,
  trial_period_days: 30,
  payment_method_collection: 'if_required',
  billing_address_collection: 'auto',
});
window.location.assign(session.url);

@chuaz97
Copy link

chuaz97 commented Oct 23, 2024

Any news about that? I'm using free trial with no credit card but pause at the end should be nice to have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants