# 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 ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: Core API version: 1.0.0 paths: /api/{account_id}/products/{product_id}: patch: operationId: update-product summary: Update Product tags: - subpackage_products parameters: - name: product_id in: path required: true schema: type: string - name: account_id in: path required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/Product' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/ProductPayload' servers: - url: https://app.paymentkit.com - url: https://staging.paymentkit.com components: schemas: ProductPayload: type: object properties: name: type: string is_active: type: boolean default: true description: type: - string - 'null' default_price_id: type: - string - 'null' metadata: type: - object - 'null' additionalProperties: description: Any type custom_fields: type: - object - 'null' additionalProperties: description: Any type description: >- 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. required: - name title: ProductPayload Product: type: object properties: id: type: string account_id: type: string name: type: string description: type: - string - 'null' is_active: type: boolean default_price_id: type: - string - 'null' metadata: type: - object - 'null' additionalProperties: description: Any type custom_fields: type: - object - 'null' additionalProperties: description: Any type description: >- Custom field values. Only included when expand=custom_fields is specified. created_at: type: string format: date-time updated_at: type: string format: date-time required: - id - account_id - name - description - is_active - default_price_id - metadata - created_at - updated_at title: Product ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError securitySchemes: HTTPBearer: type: http scheme: bearer ``` ## SDK Code Examples ```python from payment_kit import PaymentKit client = PaymentKit( token="YOUR_TOKEN_HERE", ) client.products.update_product( product_id="product_id", account_id="account_id", name="Premium Coffee Beans", ) ``` ```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() ```