diff --git a/product.go b/product.go index cd957641e1..5c3230e20f 100644 --- a/product.go +++ b/product.go @@ -14,7 +14,8 @@ type ProductParams struct { Caption string Desc string Attrs []string - Images []string `json:"images"` + Images []string + URL string Shippable *bool } @@ -33,6 +34,7 @@ type Product struct { Shippable bool `json:"shippable"` Images []string `json:"images"` Meta map[string]string `json:"metdata"` + URL string `json:"url"` Skus *SKUList `json:"skus"` } diff --git a/product/client.go b/product/client.go index 1d12130fa3..6807fa1a9f 100644 --- a/product/client.go +++ b/product/client.go @@ -57,6 +57,10 @@ func (c Client) New(params *stripe.ProductParams) (*stripe.Product, error) { } } + if len(params.URL) > 0 { + body.Add("url", params.URL) + } + if params.Shippable != nil { body.Add("shippable", strconv.FormatBool(*(params.Shippable))) } @@ -103,6 +107,10 @@ func (c Client) Update(id string, params *stripe.ProductParams) (*stripe.Product } } + if len(params.URL) > 0 { + body.Add("url", params.URL) + } + params.AppendTo(body) } diff --git a/product/client_test.go b/product/client_test.go index 7ca3ac9917..c05b82d874 100644 --- a/product/client_test.go +++ b/product/client_test.go @@ -25,6 +25,7 @@ func TestProduct(t *testing.T) { Desc: "This is a description", Caption: "This is a caption", Attrs: []string{"attr1", "attr2"}, + URL: "http://example.com", Shippable: &shippable, }) @@ -59,6 +60,10 @@ func TestProduct(t *testing.T) { if p.Desc != "This is a description" { t.Errorf("Description is invalid: %v", p.Desc) } + + if p.URL != "http://example.com" { + t.Errorf("URL is invalid: %v", p.URL) + } } func TestProductWithCustomID(t *testing.T) {