Estornar cobrança
curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '{
"value": 5000
}'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}"
payload = { "value": 5000 }
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({value: 5000})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}', 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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}",
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([
'value' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}"
payload := strings.NewReader("{\n \"value\": 5000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"value\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 5000\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Cobrança chg_abc123 estornada com sucesso",
"erro": false,
"mensagenserro": [],
"codigoretorno": 200,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}Cobranças
Estornar Cobrança
Realiza o estorno (reembolso) de uma cobrança aprovada. O campo value no body é opcional; se não informado, o estorno é total. O valor deve ser enviado em centavos.
POST
/
v1
/
charge
/
refund
/
{code}
Estornar cobrança
curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '{
"value": 5000
}'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}"
payload = { "value": 5000 }
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({value: 5000})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}', 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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}",
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([
'value' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}"
payload := strings.NewReader("{\n \"value\": 5000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"value\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/charge/refund/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 5000\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Cobrança chg_abc123 estornada com sucesso",
"erro": false,
"mensagenserro": [],
"codigoretorno": 200,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}Requer o header
account. Apenas cobranças com status Approved podem ser estornadas.Para estorno parcial, informe o campo
value no body com o valor em centavos (inteiro). Ex: para estornar R$ 50,00, envie "value": 5000.
Para estorno total, omita o campo value ou não envie body.O prazo e as condições para estorno dependem do gateway de pagamento utilizado.
Authorizations
Token JWT obtido via POST /v1/login. Envie no header Authorization: Bearer <token>.
Headers
Código da conta à qual a operação se aplica
Example:
"acc_abc123xyz"
Path Parameters
Código único da cobrança a ser estornada
Example:
"chg_abc123"
Body
application/json
Valor a ser estornado em centavos (opcional). Se omitido, o estorno é total. Ex: para estornar R$ 50,00, envie 5000.
Example:
5000
Response
Estorno realizado com sucesso
