franckverrot / terraform-provider-stripe

A Terraform Provider for Stripe
https://registry.terraform.io/providers/franckverrot/stripe/latest
Mozilla Public License 2.0
242 stars 51 forks source link

Stripe Product - Add `tax_code` as a resource definition parameter #66

Open vschmidt-evo opened 2 years ago

vschmidt-evo commented 2 years ago

To help support the ability to automatically collect taxes from the prices of products that make up a description, it would be helpful if the resource definition of a stripe_product could include the tax_code property.

Sample request POST body that features a tax_code

{
  "description": "",
  "metadata": {
    "some_key": "some_value"
  },
  "statement_descriptor": "",
  "images": "",
  "tax_code": "txcd_10000000",
  "feature_list": "",
  "unit_label": "",
  "name": "My Test Product"
}

Updating the stripe/resource_stripe_product.go file with something like

            "tax_code": &schema.Schema{
                Type:     schema.TypeString,
                Optional: true,
            },

Then updating the create, read, and update functions accordingly.

The biggest challenge I see here is if a developer inputs an invalid tax code, Stripe might yell and give a 400 error, but that should be caught when the client calls to create a new product? It's kind of up to the developer to search Stripe and figure out the tax code they want to use.