question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customer.valid_subscriptions should exclude SubscriptionStatus.incomplete

See original GitHub issue

If people use Payment Elements to sell subscription by following this guide https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#install-setup

People will create subscription using code below:

        subscription = stripe.Subscription.create(
            customer=customer_id,
            items=[{
                'price': price_id,
            }],
            payment_behavior='default_incomplete',
            expand=['latest_invoice.payment_intent'],
        )

This will create Subscription which has incomplete status (before we confirm the payment), and I do not think it is valid_subscriptions

    @property
    def valid_subscriptions(self):
        """
        Returns this customer's valid subscriptions
        (subscriptions that aren't canceled or incomplete_expired).
        """
        return self.subscriptions.exclude(
            status__in=[
                enums.SubscriptionStatus.canceled,
                enums.SubscriptionStatus.incomplete_expired,
            ]
        )

I think we should update Customer.valid_subscriptions to exclude enums.SubscriptionStatus.incomplete as well.

Thx.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
arnav13081994commented, Jun 17, 2022

@kavdev Fair enough I will look at the Subscription Lifecycle and report back.

0reactions
jleclanchecommented, Jun 28, 2022

I’m a strong +1 on keeping these helper methods around.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove subscription valid/active/current inconsistencies #490
Calling this method with no plan and multiple valid subscriptions for this customer will throw an exception. :type plan: Plan or string ...
Read more >
Subscription status explained—incomplete, past_due, unpaid…
incomplete_expired - if the subscription is in incomplete for 23 hours, then the customer is not billed and the subscription is effectively ...
Read more >
How subscriptions work | Stripe Documentation
The subscription status may be incomplete if customer authentication is required to complete the payment or if you set payment_behavior to default_incomplete ....
Read more >
Stripe Create subscription returns Status - Incomplete
The subscription will be incomplete if the initial payment failed or required authentication. What is the value of subscription.latest_invoice.
Read more >
Laravel Cashier (Stripe) - The PHP Framework For Web Artisans
Retrieving Customers. You can retrieve a customer by their Stripe ID using the Cashier::findBillable method. This method will return an instance of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found