Atualizar um produto
curl --request PATCH \
--url https://api.valorapayments.com.br/v1/products/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": "169.90"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: '169.90'})
};
fetch('https://api.valorapayments.com.br/v1/products/{product_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.valorapayments.com.br/v1/products/{product_id}"
payload = { "price": "169.90" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valorapayments.com.br/v1/products/{product_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => '169.90'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "prod_Xk2v9QeR7tLmN3bA",
"object": "product",
"name": "<string>",
"description": "<string>",
"type": "physical",
"status": "draft",
"images": [
"<string>"
],
"price": {
"amount": 14990,
"currency": "BRL"
},
"external_reference": "<string>",
"statement_description": "<string>",
"metadata": {
"order_id": "1001"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_api_key",
"message": "Chave de API inválida ou revogada."
}
}{
"error": {
"type": "missing_scope",
"message": "A chave não tem o escopo necessário."
}
}{
"error": {
"type": "not_found",
"message": "Não encontrado."
}
}{
"error": {
"type": "invalid_request",
"message": "Corpo inválido.",
"details": {
"amount": [
"Valor inválido."
]
}
}
}{
"error": {
"type": "rate_limited",
"message": "Muitas requisições. Tente novamente em instantes."
}
}Produtos
Atualizar um produto
Atualiza só os campos enviados. null limpa um campo opcional. Mudar o preço vale para as próximas compras; pagamentos já criados não mudam.
Escopo: products:write.
PATCH
/
v1
/
products
/
{product_id}
Atualizar um produto
curl --request PATCH \
--url https://api.valorapayments.com.br/v1/products/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": "169.90"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: '169.90'})
};
fetch('https://api.valorapayments.com.br/v1/products/{product_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.valorapayments.com.br/v1/products/{product_id}"
payload = { "price": "169.90" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.valorapayments.com.br/v1/products/{product_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => '169.90'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "prod_Xk2v9QeR7tLmN3bA",
"object": "product",
"name": "<string>",
"description": "<string>",
"type": "physical",
"status": "draft",
"images": [
"<string>"
],
"price": {
"amount": 14990,
"currency": "BRL"
},
"external_reference": "<string>",
"statement_description": "<string>",
"metadata": {
"order_id": "1001"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_api_key",
"message": "Chave de API inválida ou revogada."
}
}{
"error": {
"type": "missing_scope",
"message": "A chave não tem o escopo necessário."
}
}{
"error": {
"type": "not_found",
"message": "Não encontrado."
}
}{
"error": {
"type": "invalid_request",
"message": "Corpo inválido.",
"details": {
"amount": [
"Valor inválido."
]
}
}
}{
"error": {
"type": "rate_limited",
"message": "Muitas requisições. Tente novamente em instantes."
}
}Autorizações
Corpo
application/json
Resposta
Produto atualizado.