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.

Issue when attempting to sync tiered Price Model

See original GitHub issue

Describe the bug

The Price model does not include tiers information when the billing scheme is Tiered.

Software versions

  • dj-stripe version: 2.4.0
  • Python version: 3.8.6
  • Django version: 3.1
  • Stripe API version:
  • Database type and version: PSQL 11

Steps To Reproduce

  1. Create tiered Price and add tiers in Stripe Dashboard
  2. Sync Price models with manage command

Can you reproduce the issue with the latest version of master?

Yes

Expected Behavior

The Price Model should have the tiers JSONField object populated.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
martimarkovcommented, Nov 25, 2020

I’m not familiar with the internals of djstripe yet but i think

https://github.com/dj-stripe/dj-stripe/blob/d6a6b51eb1821eeb6ffc441c5c083ff6b51fc272/djstripe/models/core.py#L1904 might have something to do with it.

And

I have it uncommented, and the call to api_list still does not include it which I think is by design so I’m not quite sure how this should be fixed.

Maybe something like price.sync_from_stripe_data(price.api_retrieve()) and have an if statement in the sync function.

I also tried djstripe_sync_plans_from_stripe which gave the same result as it is also using the api_list method.

0reactions
hyshkacommented, Dec 10, 2020

Just in case someone else runs into this with v2.4.1. We had some older code still referencing subscription.plan.tiers and in this case, it will only return an empty string. To work around this, just get the whole Price object:

# before
>>> subscription.plan
<Plan: Standard pricing (USD)>
>>> subscription.plan.tiers
''

# after
>>> price = Price.objects.get(id=subscription.plan.id)
>>> price.tiers
{ <fully expended json> }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tiered Pricing – Pros and Cons and How to Implement It
Use tiered pricing to value your service​​ Tiered pricing helps you to validate your offer. If you aren't selling at your highest price...
Read more >
Troubleshoot Azure File Sync cloud tiering | Microsoft Learn
Troubleshoot common issues with cloud tiering in an Azure File Sync ... File Sync unsuccessfully attempts to tier a file to Azure Files....
Read more >
"An error has occurred" while savi… | Apple Developer Forums
In Appstore Connect I'm getting "An error has occurred. Try again later." when trying to set up a price tier (Free) for our...
Read more >
A win-win solution?: A critical analysis of tiered pricing ... - NCBI
Background. Tiered pricing - the concept of selling drugs and vaccines in developing countries at prices systematically lower than in industrialized ...
Read more >
SaaS Pricing Models Guide: Types, Examples and Top ...
Example: Chargebee is a subscription billing platform that charges the customer by directly syncing the price charged for the pricing tier with revenue....
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