I have a use-case to create the TaxRate objects with djstripe and have those sync back up to Stripe. From current tests and using TaxRate.objects.create() doesn't appear to talk to stripe at all. Is there a different route to TaxRate creation that I'm missing?
Thanks!
Hi, yes, what you need to do is create the objects using the python stripe SDK, and then sync them to dj-stripe.
See this example for creating a product - https://dj-stripe.readthedocs.io/en/stable/usage/manually_syncing_with_stripe.html?highlight=sync_from_stripe_data#in-code TaxRate.sync_from_stripe_data() is the classmethod you're looking for.
dj-stripe's strong point is in syncing data from stripe (eg via webhooks) - generally speaking the ORM doesn't sync to stripe.
Gotcha, okay! That's where I was heading next, just wanted to be certain that was the right approach. Appreciate the quick response :)
As a followup, here @therefromhere . If I want to attach a TaxRate to a Subscription, I'll need to do the same method. Stripe API call -> webhook -> djstripe db. There's no way to Subscription.default_tax_rates.add(taxrate_instance) and have that push up to Stripe. Just a sanity check. Thank you again!
Correct. We do have some helper functions on the models to do some stripe updates (eg Subscription.update(), but that doesn't have support for TaxRate updates).
see https://dj-stripe.readthedocs.io/en/stable/reference/models.html#djstripe.models.Subscription.update
okay -- thanks again for the speedy replies.
Most helpful comment
Hi, yes, what you need to do is create the objects using the python stripe SDK, and then sync them to dj-stripe.
See this example for creating a product - https://dj-stripe.readthedocs.io/en/stable/usage/manually_syncing_with_stripe.html?highlight=sync_from_stripe_data#in-code
TaxRate.sync_from_stripe_data()is the classmethod you're looking for.dj-stripe's strong point is in syncing data from stripe (eg via webhooks) - generally speaking the ORM doesn't sync to stripe.