Skip to main content
POST
/
sgct
/
jdpi
/
spi
/
api
/
v2
/
credito
/
devolucao
Register a MED inbound refund credit
curl --request POST \
  --url https://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao \
  --header 'Authorization: Bearer <token>' \
  --header 'Chave-Idempotencia: <chave-idempotencia>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "endToEndIdDevolucao": "<string>",
  "idReqJdPi": "<string>",
  "pagador": {
    "ispb": "<string>",
    "cpfCnpj": "<string>",
    "nome": "<string>",
    "nrAgencia": "<string>",
    "nrConta": "<string>"
  },
  "recebedor": {
    "ispb": "<string>",
    "cpfCnpj": "<string>",
    "nrAgencia": "<string>",
    "nrConta": "<string>",
    "tpConta": 123
  },
  "valor": 123,
  "codigoDevolucao": "<string>",
  "dtContabil": "<string>",
  "dtHrLiquidacao": "<string>",
  "dtHrOp": "<string>",
  "endToEndIdOriginal": "<string>",
  "motivoDevolucao": "<string>"
}
'
import requests

url = "https://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao"

payload = {
"endToEndIdDevolucao": "<string>",
"idReqJdPi": "<string>",
"pagador": {
"ispb": "<string>",
"cpfCnpj": "<string>",
"nome": "<string>",
"nrAgencia": "<string>",
"nrConta": "<string>"
},
"recebedor": {
"ispb": "<string>",
"cpfCnpj": "<string>",
"nrAgencia": "<string>",
"nrConta": "<string>",
"tpConta": 123
},
"valor": 123,
"codigoDevolucao": "<string>",
"dtContabil": "<string>",
"dtHrLiquidacao": "<string>",
"dtHrOp": "<string>",
"endToEndIdOriginal": "<string>",
"motivoDevolucao": "<string>"
}
headers = {
"Chave-Idempotencia": "<chave-idempotencia>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'Chave-Idempotencia': '<chave-idempotencia>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
endToEndIdDevolucao: '<string>',
idReqJdPi: '<string>',
pagador: {
ispb: '<string>',
cpfCnpj: '<string>',
nome: '<string>',
nrAgencia: '<string>',
nrConta: '<string>'
},
recebedor: {
ispb: '<string>',
cpfCnpj: '<string>',
nrAgencia: '<string>',
nrConta: '<string>',
tpConta: 123
},
valor: 123,
codigoDevolucao: '<string>',
dtContabil: '<string>',
dtHrLiquidacao: '<string>',
dtHrOp: '<string>',
endToEndIdOriginal: '<string>',
motivoDevolucao: '<string>'
})
};

fetch('https://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao', 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://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao",
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([
'endToEndIdDevolucao' => '<string>',
'idReqJdPi' => '<string>',
'pagador' => [
'ispb' => '<string>',
'cpfCnpj' => '<string>',
'nome' => '<string>',
'nrAgencia' => '<string>',
'nrConta' => '<string>'
],
'recebedor' => [
'ispb' => '<string>',
'cpfCnpj' => '<string>',
'nrAgencia' => '<string>',
'nrConta' => '<string>',
'tpConta' => 123
],
'valor' => 123,
'codigoDevolucao' => '<string>',
'dtContabil' => '<string>',
'dtHrLiquidacao' => '<string>',
'dtHrOp' => '<string>',
'endToEndIdOriginal' => '<string>',
'motivoDevolucao' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Chave-Idempotencia: <chave-idempotencia>",
"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://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao"

payload := strings.NewReader("{\n \"endToEndIdDevolucao\": \"<string>\",\n \"idReqJdPi\": \"<string>\",\n \"pagador\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nome\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\"\n },\n \"recebedor\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\",\n \"tpConta\": 123\n },\n \"valor\": 123,\n \"codigoDevolucao\": \"<string>\",\n \"dtContabil\": \"<string>\",\n \"dtHrLiquidacao\": \"<string>\",\n \"dtHrOp\": \"<string>\",\n \"endToEndIdOriginal\": \"<string>\",\n \"motivoDevolucao\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Chave-Idempotencia", "<chave-idempotencia>")
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://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao")
.header("Chave-Idempotencia", "<chave-idempotencia>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endToEndIdDevolucao\": \"<string>\",\n \"idReqJdPi\": \"<string>\",\n \"pagador\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nome\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\"\n },\n \"recebedor\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\",\n \"tpConta\": 123\n },\n \"valor\": 123,\n \"codigoDevolucao\": \"<string>\",\n \"dtContabil\": \"<string>\",\n \"dtHrLiquidacao\": \"<string>\",\n \"dtHrOp\": \"<string>\",\n \"endToEndIdOriginal\": \"<string>\",\n \"motivoDevolucao\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://plugin-pix-direct.api.lerian.net/sgct/jdpi/spi/api/v2/credito/devolucao")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Chave-Idempotencia"] = '<chave-idempotencia>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endToEndIdDevolucao\": \"<string>\",\n \"idReqJdPi\": \"<string>\",\n \"pagador\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nome\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\"\n },\n \"recebedor\": {\n \"ispb\": \"<string>\",\n \"cpfCnpj\": \"<string>\",\n \"nrAgencia\": \"<string>\",\n \"nrConta\": \"<string>\",\n \"tpConta\": 123\n },\n \"valor\": 123,\n \"codigoDevolucao\": \"<string>\",\n \"dtContabil\": \"<string>\",\n \"dtHrLiquidacao\": \"<string>\",\n \"dtHrOp\": \"<string>\",\n \"endToEndIdOriginal\": \"<string>\",\n \"motivoDevolucao\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "dtHrCreditoSgct": "<string>",
  "idCreditoSgct": "<string>",
  "idReqJdPi": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}

Authorizations

Authorization
string
header
required

JWT Bearer token authentication. Obtain token from /v1/login/oauth/access_token endpoint using client credentials (clientId and clientSecret).

Include token in Authorization header: Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Token expires after 3600 seconds (1 hour).

Headers

Authorization
string

Bearer access token (the financial-ingress gate; the handler fails closed with Pix-0082 when absent).

Chave-Idempotencia
string
required

Idempotency key (= the endToEndIdDevolucao). Mandatory per the MED SPI credit contract.

Body

application/json
endToEndIdDevolucao
string
required

EndToEndId of the devolucao (pacs.004; the natural key / idempotency anchor, 32-char).

idReqJdPi
string
required

The upstream request id of the credit notification.

pagador
object
required
recebedor
object
required
valor
number<double>
required

Credited refund amount, in reais.

codigoDevolucao
string

Refund reason code (BE08/FR01/MD06/SL02).

dtContabil
string

SPI accounting date.

dtHrLiquidacao
string

SPI settlement instant.

dtHrOp
string

Recebedor-informed original instant (UTC).

endToEndIdOriginal
string

EndToEndId of the original contested payment (32-char).

motivoDevolucao
string

Free-text refund detail.

Response

OK

dtHrCreditoSgct
string
required

The settlement-gateway credit-commit instant (UTC, RFC 3339).

idCreditoSgct
string
required

The service-minted credit-entry id (GUID).

idReqJdPi
string
required

The upstream request id (echoed).