Retrieve tax id if exists before creating a new one
This commit is contained in:
parent
ad52338653
commit
5ab0bf6993
1 changed files with 8 additions and 4 deletions
|
@ -437,9 +437,13 @@ class StripeUtils(object):
|
|||
|
||||
@handleStripeError
|
||||
def create_tax_id_for_user(self, stripe_customer_id, vat_number, type="eu_vat"):
|
||||
tax_id_obj = stripe.Customer.create_tax_id(
|
||||
stripe_customer_id,
|
||||
type=type,
|
||||
value=vat_number,
|
||||
tax_id_obj = stripe.Customer.retrieve(
|
||||
stripe_customer_id,type=type, value=vat_number
|
||||
)
|
||||
if tax_id_obj["response_object"]["error"]:
|
||||
tax_id_obj = stripe.Customer.create_tax_id(
|
||||
stripe_customer_id,
|
||||
type=type,
|
||||
value=vat_number,
|
||||
)
|
||||
return tax_id_obj
|
||||
|
|
Loading…
Reference in a new issue