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.

Creating and syncing TaxIDs does not propagate to Stripe

See original GitHub issue

Describe the bug Creating a tax ID for a customer persisted locally does not create a tax id for the customer on Stripe

To Reproduce I’ve tried to do this through the Django admin interface by adding (or changing) a tax ID for a customer. I’ve also tried doing the same through command line. Two things happen:

  • It creates a tax ID without the ID column filled in, which results in an error the next time I try to do it as the value must be unique. The ID is always null. Is this a field that gets written by a webhook? I imagine this shouldn’t be null.
  • The tax ID gets created locally but does not get created on Stripe.

Please let me know if this might be a configuration issue. I’m new to Django and at a new job and have been working in this code base for a whole week so far. But I did also notice that there’s no method for e.g. customer._sync_tax_ids() that would be called in djstripe/sync.py - there are method calls for syncing charges, cards, invoices and subscriptions there.

Software versions

  • Dj-Stripe version: 2.4.2
  • Python version: 3.7.2
  • Django version: 2.2.17
  • Stripe API version: 2.55.1
  • Database type and version: Postgres 13.1

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Tuulehcommented, Mar 19, 2021

Hi! I’m working on a ton of other things for my job right now so it would be good if you could implement this if it’s something you need. It may indeed be the only thing that’s missing but I wouldn’t be surprised if there were some other things that would need to be added to TaxIds to get them to parity with the other models (at least the ones that don’t require fetching the resources through the customer).

On Fri, Mar 19, 2021, 15:06 Pablo Castellano @.***> wrote:

Hey @Tuuleh https://github.com/Tuuleh. Thanks for your PR #1321 https://github.com/dj-stripe/dj-stripe/pull/1321 !

I have tested it and seems that the only missing part is deleting the TaxId from the database when customer.tax_id.deleted is received. At least it didn’t work for me after several tries.

Let me know if you are working on it or want me to give you a hand as this is a feature I need

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dj-stripe/dj-stripe/issues/1320#issuecomment-802858258, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRYZFE3GWAQR5BGFYAKPPDTENK4TANCNFSM4XUNRASA .

0reactions
stevereciocommented, Apr 14, 2021

In case this is helpful to anybody, here is a generic utility for updating and syncing dj-stripe models:

def update_djstripe_model(djstripe_obj, **kwargs):
    stripe_data = djstripe_obj.stripe_class.modify(djstripe_obj.id, **kwargs)
    djstripe_obj = djstripe_obj.__class__.sync_from_stripe_data(stripe_data)
    return djstripe_obj

# Usage
customer = Customer.objects.get(subscriber=user)
customer = update_djstripe_model(customer, name="Sample Name")

Would be great if the StripeModel had some sort of signal listener that would apply that to any changed fields 😎

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stripe Data Pipeline: Sync Stripe data to your data warehouse
Offload ongoing maintenance with a pipeline that's built into Stripe. No matter how much data you have, your data is always complete and...
Read more >
Set up Stripe Tax | Stripe Documentation
The final step in setting up Stripe Tax is to enable automatic tax on your Stripe integration. Here's how: No-code: If you're using...
Read more >
Andrew Chen on marketplaces - Stripe
We regularly invite leading entrepreneurs and investors to share their experience and expertise with the Stripe Atlas Community. Andrew Chen is a general ......
Read more >
Stripe API reference – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >
Get started with tax reporting | Stripe Documentation
Log in to your Stripe account and use the Tax forms view in the Dashboard to create, modify, file, and deliver 1099 tax...
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