Create Top-up Invoice
curl --request POST \
--url https://api.base39.com.br/v2/billing/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customAmount": 50000999.5
}
'import requests
url = "https://api.base39.com.br/v2/billing/invoices"
payload = { "customAmount": 50000999.5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customAmount: 50000999.5})
};
fetch('https://api.base39.com.br/v2/billing/invoices', 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.base39.com.br/v2/billing/invoices",
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([
'customAmount' => 50000999.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.base39.com.br/v2/billing/invoices"
payload := strings.NewReader("{\n \"customAmount\": 50000999.5\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.base39.com.br/v2/billing/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customAmount\": 50000999.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/billing/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customAmount\": 50000999.5\n}"
response = http.request(request)
puts response.read_body{
"invoiceId": "in_xxx",
"paymentMethods": [
{
"type": "pix",
"status": "ready",
"value": "<string>",
"pdfUrl": "<string>",
"unavailableReason": "<string>"
}
],
"paymentAction": {
"type": "hosted_page",
"url": "<string>"
},
"checkout": {
"sessionId": "pi_xxx",
"clientSecret": "<string>",
"publishableKey": "<string>",
"customPaymentMethodTypeId": "cpmt_xxx"
}
}Billing
Create Top-up Invoice
POST
/
v2
/
billing
/
invoices
Create Top-up Invoice
curl --request POST \
--url https://api.base39.com.br/v2/billing/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customAmount": 50000999.5
}
'import requests
url = "https://api.base39.com.br/v2/billing/invoices"
payload = { "customAmount": 50000999.5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customAmount: 50000999.5})
};
fetch('https://api.base39.com.br/v2/billing/invoices', 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.base39.com.br/v2/billing/invoices",
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([
'customAmount' => 50000999.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.base39.com.br/v2/billing/invoices"
payload := strings.NewReader("{\n \"customAmount\": 50000999.5\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.base39.com.br/v2/billing/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customAmount\": 50000999.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/billing/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customAmount\": 50000999.5\n}"
response = http.request(request)
puts response.read_body{
"invoiceId": "in_xxx",
"paymentMethods": [
{
"type": "pix",
"status": "ready",
"value": "<string>",
"pdfUrl": "<string>",
"unavailableReason": "<string>"
}
],
"paymentAction": {
"type": "hosted_page",
"url": "<string>"
},
"checkout": {
"sessionId": "pi_xxx",
"clientSecret": "<string>",
"publishableKey": "<string>",
"customPaymentMethodTypeId": "cpmt_xxx"
}
}Authorizations
OAuth2 Authorization Code flow
Body
application/json
Opção de recarga de saldo
Available options:
balance_100_90d, balance_500_90d, balance_1000_90d, balance_5000_90d, balance_custom_90d Valor personalizado da recarga em centavos
Required range:
2000 <= x <= 99999999Contexto WhatsApp para atualização de status do pedido quando a invoice for paga
Show child attributes
Show child attributes
Modo de checkout Stripe para recarga
Available options:
hosted, elements Meio de pagamento preferido para a recarga
Available options:
pix, stripe_checkout Response
201 - application/json
ID da invoice Stripe
Example:
"in_xxx"
Meios de pagamento gerados com sucesso
Show child attributes
Show child attributes
Ação hospedada para concluir o pagamento
Show child attributes
Show child attributes
Checkout Stripe Elements para pagamento no frontend
Show child attributes
Show child attributes
⌘I