Checkout Transparente
curl --request POST \
--url https://gateway.astronpay.co/transaction \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"transaction": {
"customer_infos": {
"name": "<string>",
"email": "<string>",
"document": "<string>",
"phone": "<string>"
},
"address": {
"zipcode": "<string>",
"street": "<string>",
"number": "<string>",
"district": "<string>",
"city": "<string>",
"state": "<string>",
"adjunct": "<string>"
},
"callback_url": "<string>",
"products": [
{
"name": "<string>",
"price": 123,
"quantity": 123
}
],
"installments": 123,
"card_payment_method_id": "<string>",
"card_number": "<string>",
"expiration_date": "<string>",
"cvv": "<string>",
"holder_name": "<string>"
}
}
'import requests
url = "https://gateway.astronpay.co/transaction"
payload = { "transaction": {
"customer_infos": {
"name": "<string>",
"email": "<string>",
"document": "<string>",
"phone": "<string>"
},
"address": {
"zipcode": "<string>",
"street": "<string>",
"number": "<string>",
"district": "<string>",
"city": "<string>",
"state": "<string>",
"adjunct": "<string>"
},
"callback_url": "<string>",
"products": [
{
"name": "<string>",
"price": 123,
"quantity": 123
}
],
"installments": 123,
"card_payment_method_id": "<string>",
"card_number": "<string>",
"expiration_date": "<string>",
"cvv": "<string>",
"holder_name": "<string>"
} }
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: {
customer_infos: {name: '<string>', email: '<string>', document: '<string>', phone: '<string>'},
address: {
zipcode: '<string>',
street: '<string>',
number: '<string>',
district: '<string>',
city: '<string>',
state: '<string>',
adjunct: '<string>'
},
callback_url: '<string>',
products: [{name: '<string>', price: 123, quantity: 123}],
installments: 123,
card_payment_method_id: '<string>',
card_number: '<string>',
expiration_date: '<string>',
cvv: '<string>',
holder_name: '<string>'
}
})
};
fetch('https://gateway.astronpay.co/transaction', 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",
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' => [
'customer_infos' => [
'name' => '<string>',
'email' => '<string>',
'document' => '<string>',
'phone' => '<string>'
],
'address' => [
'zipcode' => '<string>',
'street' => '<string>',
'number' => '<string>',
'district' => '<string>',
'city' => '<string>',
'state' => '<string>',
'adjunct' => '<string>'
],
'callback_url' => '<string>',
'products' => [
[
'name' => '<string>',
'price' => 123,
'quantity' => 123
]
],
'installments' => 123,
'card_payment_method_id' => '<string>',
'card_number' => '<string>',
'expiration_date' => '<string>',
'cvv' => '<string>',
'holder_name' => '<string>'
]
]),
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"
payload := strings.NewReader("{\n \"transaction\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\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")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transaction\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction")
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\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"payment": {
"status": "PROCESSING",
"transaction_id": "ScEEPm9jzOgL1FbU2J673JDaNMqMV7S",
"payment_code": "<string>",
"link": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"total": 123
}
}Transações
Checkout Transparente
Cria uma nova transação de checkout transparente
POST
/
transaction
Checkout Transparente
curl --request POST \
--url https://gateway.astronpay.co/transaction \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"transaction": {
"customer_infos": {
"name": "<string>",
"email": "<string>",
"document": "<string>",
"phone": "<string>"
},
"address": {
"zipcode": "<string>",
"street": "<string>",
"number": "<string>",
"district": "<string>",
"city": "<string>",
"state": "<string>",
"adjunct": "<string>"
},
"callback_url": "<string>",
"products": [
{
"name": "<string>",
"price": 123,
"quantity": 123
}
],
"installments": 123,
"card_payment_method_id": "<string>",
"card_number": "<string>",
"expiration_date": "<string>",
"cvv": "<string>",
"holder_name": "<string>"
}
}
'import requests
url = "https://gateway.astronpay.co/transaction"
payload = { "transaction": {
"customer_infos": {
"name": "<string>",
"email": "<string>",
"document": "<string>",
"phone": "<string>"
},
"address": {
"zipcode": "<string>",
"street": "<string>",
"number": "<string>",
"district": "<string>",
"city": "<string>",
"state": "<string>",
"adjunct": "<string>"
},
"callback_url": "<string>",
"products": [
{
"name": "<string>",
"price": 123,
"quantity": 123
}
],
"installments": 123,
"card_payment_method_id": "<string>",
"card_number": "<string>",
"expiration_date": "<string>",
"cvv": "<string>",
"holder_name": "<string>"
} }
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: {
customer_infos: {name: '<string>', email: '<string>', document: '<string>', phone: '<string>'},
address: {
zipcode: '<string>',
street: '<string>',
number: '<string>',
district: '<string>',
city: '<string>',
state: '<string>',
adjunct: '<string>'
},
callback_url: '<string>',
products: [{name: '<string>', price: 123, quantity: 123}],
installments: 123,
card_payment_method_id: '<string>',
card_number: '<string>',
expiration_date: '<string>',
cvv: '<string>',
holder_name: '<string>'
}
})
};
fetch('https://gateway.astronpay.co/transaction', 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",
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' => [
'customer_infos' => [
'name' => '<string>',
'email' => '<string>',
'document' => '<string>',
'phone' => '<string>'
],
'address' => [
'zipcode' => '<string>',
'street' => '<string>',
'number' => '<string>',
'district' => '<string>',
'city' => '<string>',
'state' => '<string>',
'adjunct' => '<string>'
],
'callback_url' => '<string>',
'products' => [
[
'name' => '<string>',
'price' => 123,
'quantity' => 123
]
],
'installments' => 123,
'card_payment_method_id' => '<string>',
'card_number' => '<string>',
'expiration_date' => '<string>',
'cvv' => '<string>',
'holder_name' => '<string>'
]
]),
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"
payload := strings.NewReader("{\n \"transaction\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\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")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transaction\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/transaction")
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\": {\n \"customer_infos\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"document\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"address\": {\n \"zipcode\": \"<string>\",\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"district\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"adjunct\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": 123,\n \"quantity\": 123\n }\n ],\n \"installments\": 123,\n \"card_payment_method_id\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiration_date\": \"<string>\",\n \"cvv\": \"<string>\",\n \"holder_name\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"payment": {
"status": "PROCESSING",
"transaction_id": "ScEEPm9jzOgL1FbU2J673JDaNMqMV7S",
"payment_code": "<string>",
"link": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"total": 123
}
}⌘I
