> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.paymentkit.com/api-reference/api-reference/products/update-product/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paymentkit.com/_mcp/server. # Update Product PATCH https://app.paymentkit.com/api/{account_id}/products/{product_id} Content-Type: application/json Reference: https://docs.paymentkit.com/api-reference/api-reference/products/update-product ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://app.paymentkit.com` (Production, default) - `https://staging.paymentkit.com` (Staging) ## Request ### Path parameters - `product_id` (string, required) - `account_id` (string, required) ### Body (application/json) This endpoint expects a ProductPayload. - `name` (string, required) - `is_active` (boolean, optional, default: true) - `description` (string, optional, nullable) - `default_price_id` (string, optional, nullable) - `metadata` (map from string to any, optional, nullable) - `custom_fields` (map from string to any, optional, nullable) — Custom field values to set on this product. Keys must match defined field keys for the product entity type. Set a key to null to delete that field's value. ## Response ### 200 Successful Response - `id` (string, required) - `account_id` (string, required) - `name` (string, required) - `description` (string, required, nullable) - `is_active` (boolean, required) - `default_price_id` (string, required, nullable) - `metadata` (map from string to any, required, nullable) - `created_at` (datetime, required) - `updated_at` (datetime, required) - `custom_fields` (map from string to any, optional, nullable) — Custom field values. Only included when expand=custom_fields is specified. ## Errors ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItems ## Examples **Request** ```json { "name": "Premium Coffee Beans" } ``` **Response** ```json { "id": "prod_9876543210", "account_id": "acct_1234567890", "name": "Premium Coffee Beans", "description": "A selection of the finest Arabica coffee beans sourced from Colombia.", "is_active": true, "default_price_id": "price_123abc456def", "metadata": {}, "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "custom_fields": {} } ``` **SDK Code** ```python import requests url = "https://app.paymentkit.com/api/account_id/products/product_id" payload = { "name": "Premium Coffee Beans" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.paymentkit.com/api/account_id/products/product_id'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"name":"Premium Coffee Beans"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/products/product_id" payload := strings.NewReader("{\n \"name\": \"Premium Coffee Beans\"\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.paymentkit.com/api/account_id/products/product_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"Premium Coffee Beans\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://app.paymentkit.com/api/account_id/products/product_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"name\": \"Premium Coffee Beans\"\n}") .asString(); ``` ```php request('PATCH', 'https://app.paymentkit.com/api/account_id/products/product_id', [ 'body' => '{ "name": "Premium Coffee Beans" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.paymentkit.com/api/account_id/products/product_id"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Premium Coffee Beans\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["name": "Premium Coffee Beans"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/products/product_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```