Quote live freight for a payment link checkout
curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote \
--header 'Content-Type: application/json' \
--data '
{
"postalCode": "20040-020"
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote"
payload = { "postalCode": "20040-020" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({postalCode: '20040-020'})
};
fetch('https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote', 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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote",
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([
'postalCode' => '20040-020'
]),
CURLOPT_HTTPHEADER => [
"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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote"
payload := strings.NewReader("{\n \"postalCode\": \"20040-020\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote")
.header("Content-Type", "application/json")
.body("{\n \"postalCode\": \"20040-020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"postalCode\": \"20040-020\"\n}"
response = http.request(request)
puts response.read_body{
"options": [
{
"serviceId": 2,
"name": "SEDEX",
"company": "Correios",
"price": 42.9,
"deliveryTime": 2,
"currency": "BRL"
}
]
}Payment Links
Quote live freight for a payment link checkout
Public endpoint called by the payment link checkout to compute live
freight options for a destination postal code. Requires the link to be
configured with freight mode checkout, currency BRL, and at least
one physical product with dimensions and weight.
Only services in the merchant’s enabledServices list are returned.
Results are cached for 15 minutes per (link, postal code, items).
The buyer then sends the chosen serviceId as freightServiceId when
creating the charge. The server re-quotes the same combination to
validate the price (anti-fraud) — clients cannot send
freight_amount or freight_details directly.
POST
/
v1
/
payment-links
/
{id}
/
freight
/
quote
Quote live freight for a payment link checkout
curl --request POST \
--url https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote \
--header 'Content-Type: application/json' \
--data '
{
"postalCode": "20040-020"
}
'import requests
url = "https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote"
payload = { "postalCode": "20040-020" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({postalCode: '20040-020'})
};
fetch('https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote', 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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote",
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([
'postalCode' => '20040-020'
]),
CURLOPT_HTTPHEADER => [
"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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote"
payload := strings.NewReader("{\n \"postalCode\": \"20040-020\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote")
.header("Content-Type", "application/json")
.body("{\n \"postalCode\": \"20040-020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-global.fastpaybrasil.com/v1/payment-links/{id}/freight/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"postalCode\": \"20040-020\"\n}"
response = http.request(request)
puts response.read_body{
"options": [
{
"serviceId": 2,
"name": "SEDEX",
"company": "Correios",
"price": 42.9,
"deliveryTime": 2,
"currency": "BRL"
}
]
}