CashOut
curl --request POST \
--url https://gateway.astronpay.co/transaction/cash-out \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '{}'import requests
url = "https://gateway.astronpay.co/transaction/cash-out"
payload = {}
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({})
};
fetch('https://gateway.astronpay.co/transaction/cash-out', 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/cash-out",
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([
]),
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/cash-out"
payload := strings.NewReader("{}")
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/cash-out")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction/cash-out")
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 = "{}"
response = http.request(request)
puts response.read_body{
"status": "success",
"payment": {
"status": "pending",
"transaction_id": "3b7abeda-205a-4439-a078-957e3f37c330",
"payment_code": "<string>",
"link": "<string>",
"total": 2
}
}{
"error": 400,
"message": "qrcode já expirado"
}Transações
CashOut
Cria uma nova transação de saída (cash-out). O usuário deve incluir uma assinatura RSA no cabeçalho signature para autenticar a requisição.
POST
/
transaction
/
cash-out
CashOut
curl --request POST \
--url https://gateway.astronpay.co/transaction/cash-out \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '{}'import requests
url = "https://gateway.astronpay.co/transaction/cash-out"
payload = {}
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({})
};
fetch('https://gateway.astronpay.co/transaction/cash-out', 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/cash-out",
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([
]),
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/cash-out"
payload := strings.NewReader("{}")
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/cash-out")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction/cash-out")
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 = "{}"
response = http.request(request)
puts response.read_body{
"status": "success",
"payment": {
"status": "pending",
"transaction_id": "3b7abeda-205a-4439-a078-957e3f37c330",
"payment_code": "<string>",
"link": "<string>",
"total": 2
}
}{
"error": 400,
"message": "qrcode já expirado"
}Cash-out (exposes)
Autenticação
ApiKeyGuard+SignatureGuard- Envie
api_key,api_secretesignaturenos headers
Body (CashOutDto)
{
"transaction": {
"amount": 123.45,
"key": "chave-pix-ou-qr",
"pixType": "CPF|CNPJ|EMAIL|PHONE|RANDOM|QRCODE",
"external_id": "id-externo-do-cliente",
"callback_url": "https://seu-callback.com/opcional"
}
}
Regras
- Para
pixType diferente de QRCODE:amounté obrigatório e > 0. - Para
pixType igual a QRCODE:amountvem do QRCODE, ou seja não precisa ser enviado na requisição.- Se o QR estiver expirado, retorna 400 com
"qrcode já expirado".
Exemplo – Chave Pix comum (CPF)
POST /transaction/cash-out
api_key: SEU_API_KEY
api_secret: SEU_API_SECRET
signature: <assinatura>
Content-Type: application/json
{
"transaction": {
"amount": 150.00,
"key": "12345678901",
"pixType": "CPF",
"external_id": "order-123",
"callback_url": "https://meu-callback.com/cashout"
}
}
Resposta (sucesso)
{
"status": "success",
"payment": {
"status": "pending",
"transaction_id": "generated-uuid",
"payment_code": null,
"link": null,
"total": 150
}
}
Exemplo – Pix via QR Code (EMV completo, sem amount)
POST /transaction/cash-out
api_key: SEU_API_KEY
api_secret: SEU_API_SECRET
signature: <assinatura>
Content-Type: application/json
{
"transaction": {
"key": "00020126780014br.gov.bcb.pix0136f4c6089a-bfde-4c00-a2d9-9eaa584b02190216CobrancaEstatica5204000053039865406546.285802BR5903Pix6008BRASILIA6229...6304ABCD",
"pixType": "QRCODE",
"external_id": "order-456",
"callback_url": "https://meu-callback.com/cashout"
}
}
Resposta (sucesso)
{
"status": "success",
"payment": {
"status": "pending",
"transaction_id": "generated-uuid",
"payment_code": null,
"link": null,
"total": 546.28
}
}
⌘I
