Refund
curl --request POST \
--url https://gateway.astronpay.co/transaction/refund \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb"
}
'import requests
url = "https://gateway.astronpay.co/transaction/refund"
payload = { "transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb" }
headers = {
"api_key": "<api-key>",
"api_secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
api_key: '<api-key>',
api_secret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({transaction_id: 'aafee9f5-94b3-4e3d-ab6a-416d0a1218cb'})
};
fetch('https://gateway.astronpay.co/transaction/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://gateway.astronpay.co/transaction/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([
'transaction_id' => 'aafee9f5-94b3-4e3d-ab6a-416d0a1218cb'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>",
"api_secret: <api-key>"
],
]);
$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://gateway.astronpay.co/transaction/refund"
payload := strings.NewReader("{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("api_secret", "<api-key>")
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://gateway.astronpay.co/transaction/refund")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["api_secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb",
"status": "IN_PROCESSING",
"value": 100.5,
"e2e_id": "E23114447202304181826HJNwY577YDX",
"payer": {
"name": "<string>",
"document": "<string>",
"bankCode": "<string>",
"bankName": "<string>",
"bankIspb": "<string>"
}
}Transações
Devolução
Realiza o estorno de uma transação
POST
/
transaction
/
refund
Refund
curl --request POST \
--url https://gateway.astronpay.co/transaction/refund \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb"
}
'import requests
url = "https://gateway.astronpay.co/transaction/refund"
payload = { "transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb" }
headers = {
"api_key": "<api-key>",
"api_secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
api_key: '<api-key>',
api_secret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({transaction_id: 'aafee9f5-94b3-4e3d-ab6a-416d0a1218cb'})
};
fetch('https://gateway.astronpay.co/transaction/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://gateway.astronpay.co/transaction/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([
'transaction_id' => 'aafee9f5-94b3-4e3d-ab6a-416d0a1218cb'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>",
"api_secret: <api-key>"
],
]);
$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://gateway.astronpay.co/transaction/refund"
payload := strings.NewReader("{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("api_secret", "<api-key>")
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://gateway.astronpay.co/transaction/refund")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["api_secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transaction_id\": \"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "aafee9f5-94b3-4e3d-ab6a-416d0a1218cb",
"status": "IN_PROCESSING",
"value": 100.5,
"e2e_id": "E23114447202304181826HJNwY577YDX",
"payer": {
"name": "<string>",
"document": "<string>",
"bankCode": "<string>",
"bankName": "<string>",
"bankIspb": "<string>"
}
}Body
application/json
ID da transação a ser estornada
Example:
"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb"
Response
Estorno iniciado com sucesso
ID da transação de estorno
Example:
"aafee9f5-94b3-4e3d-ab6a-416d0a1218cb"
Status do estorno
Example:
"IN_PROCESSING"
Valor do estorno em reais
Example:
100.5
Identificador end-to-end da transação PIX
Example:
"E23114447202304181826HJNwY577YDX"
Dados do pagador
Show child attributes
Show child attributes
⌘I
