curl -X POST 'https://api.velan.app/v1/developer/orders/3f9423fb-4672-4880-aa0b-b0c537109eb6/refund' \
-H 'Authorization: Bearer $VELAN_KEY' \
-H 'Idempotency-Key: estorno-pedido-0001' \
-H 'Content-Type: application/json' \
-d '{"reason": "Pedido do cliente", "reason_code": "withdrawal"}'import requests
url = "https://api.velan.app/v1/developer/orders/{code}/refund"
payload = {
"reason": "Pedido do cliente",
"reason_code": "withdrawal"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'Pedido do cliente', reason_code: 'withdrawal'})
};
fetch('https://api.velan.app/v1/developer/orders/{code}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.velan.app/v1/developer/orders/{code}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'Pedido do cliente',
'reason_code' => 'withdrawal'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.velan.app/v1/developer/orders/{code}/refund"
payload := strings.NewReader("{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.velan.app/v1/developer/orders/{code}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.velan.app/v1/developer/orders/{code}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"errors": [],
"message": "Estorno realizado com sucesso.",
"order": {
"amount": "358.50",
"code": "3f9423fb-4672-4880-aa0b-b0c537109eb6",
"customer": {
"email": "joao@exemplo.com",
"name": "João Silva"
},
"offer": "Turma 2026",
"paid_at": "2026-11-22T03:14:41.523777+00:00",
"product": "Curso de Violão",
"status": "refunded"
},
"refunded": true,
"refunded_charges": [
"189200000005"
]
}
}{
"error": {
"type": "validation_error",
"message": "Campos não aceitos nesta rota.",
"fields": {
"confirmm": "Campo desconhecido."
}
}
}{
"error": {
"type": "authentication_error",
"message": "Envie Authorization: Bearer <chave de API>."
}
}{
"error": {
"type": "permission_error",
"message": "Esta chave não tem permissão de escrita em 'webhooks'. Crie uma chave com essa permissão."
}
}{
"error": {
"type": "not_found",
"message": "Assinatura não encontrada."
}
}{
"error": {
"type": "conflict",
"message": "Idempotency-Key já usada com outra requisição. Gere uma chave nova para uma operação nova."
}
}{
"error": {
"type": "unprocessable",
"message": "Descreva o motivo com pelo menos 5 caracteres."
}
}{
"error": {
"type": "rate_limited",
"message": "Limite de 30 alterações por minuto atingido."
}
}Estornar pedido (total ou parcial)
Estorna um pedido: o dinheiro volta ao comprador no gateway e não pode ser desfeito. Fluxo recomendado: 1) chame com "dry_run": true e leia eligible, blocked_reason e refundable_amount; 2) chame sem dry_run, com reason. Estorno total: o pedido vira refunded, o acesso do comprador é encerrado e os webhooks recebem order.refunded. Com amount o estorno é parcial e o pedido continua pago; parcial não está disponível em pagamento com dois cartões, com split ou com mais de uma cobrança. Se o comprador abriu uma solicitação na central de reembolso, prefira POST /refund-requests/{request_id}/decision, que também fecha a solicitação.
Permissão: write:refunds ou write. Idempotency-Key: obrigatório. Prévia: envie "dry_run": true.
curl -X POST 'https://api.velan.app/v1/developer/orders/3f9423fb-4672-4880-aa0b-b0c537109eb6/refund' \
-H 'Authorization: Bearer $VELAN_KEY' \
-H 'Idempotency-Key: estorno-pedido-0001' \
-H 'Content-Type: application/json' \
-d '{"reason": "Pedido do cliente", "reason_code": "withdrawal"}'import requests
url = "https://api.velan.app/v1/developer/orders/{code}/refund"
payload = {
"reason": "Pedido do cliente",
"reason_code": "withdrawal"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'Pedido do cliente', reason_code: 'withdrawal'})
};
fetch('https://api.velan.app/v1/developer/orders/{code}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.velan.app/v1/developer/orders/{code}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'Pedido do cliente',
'reason_code' => 'withdrawal'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.velan.app/v1/developer/orders/{code}/refund"
payload := strings.NewReader("{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.velan.app/v1/developer/orders/{code}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.velan.app/v1/developer/orders/{code}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"Pedido do cliente\",\n \"reason_code\": \"withdrawal\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"errors": [],
"message": "Estorno realizado com sucesso.",
"order": {
"amount": "358.50",
"code": "3f9423fb-4672-4880-aa0b-b0c537109eb6",
"customer": {
"email": "joao@exemplo.com",
"name": "João Silva"
},
"offer": "Turma 2026",
"paid_at": "2026-11-22T03:14:41.523777+00:00",
"product": "Curso de Violão",
"status": "refunded"
},
"refunded": true,
"refunded_charges": [
"189200000005"
]
}
}{
"error": {
"type": "validation_error",
"message": "Campos não aceitos nesta rota.",
"fields": {
"confirmm": "Campo desconhecido."
}
}
}{
"error": {
"type": "authentication_error",
"message": "Envie Authorization: Bearer <chave de API>."
}
}{
"error": {
"type": "permission_error",
"message": "Esta chave não tem permissão de escrita em 'webhooks'. Crie uma chave com essa permissão."
}
}{
"error": {
"type": "not_found",
"message": "Assinatura não encontrada."
}
}{
"error": {
"type": "conflict",
"message": "Idempotency-Key já usada com outra requisição. Gere uma chave nova para uma operação nova."
}
}{
"error": {
"type": "unprocessable",
"message": "Descreva o motivo com pelo menos 5 caracteres."
}
}{
"error": {
"type": "rate_limited",
"message": "Limite de 30 alterações por minuto atingido."
}
}Authorizations
Headers
Path Parameters
Body
Categoria do motivo (opcional, mas recomendada: alimenta o relatório de motivos). withdrawal = desistência/arrependimento; financial = problema financeiro; mistake = compra por engano/duplicada; content = não gostou do conteúdo; technical = problema técnico de acesso; unrecognized = não reconhece a compra; agreement = acordo comercial; other = outro (exige reason).
withdrawal, financial, mistake, content, technical, unrecognized, agreement, other 