Iniciar uma recarga com cartão (Stripe Elements)
Cria um pedido de recarga PENDENTE e um PaymentIntent de cartão para o amount (na moeda do workspace, arredondado para centavos), para um formulário de cartão na sua própria página. Chame stripe.confirmPayment() com o clientSecret e depois POST /v1/billing/payment-intents/{id}/sync. A carteira é creditada uma única vez, pelo sync ou pelo nosso webhook do Stripe. saveCard: true também salva o cartão. Idempotency-Key opcional: mesma chave e mesmo corpo em 24 h → o mesmo intent, com Idempotent-Replayed: true; mesma chave, outro corpo → 409 IDEMPOTENCY_KEY_REUSED; ainda em processamento → 409 IDEMPOTENCY_KEY_IN_USE. Só Proprietário (billing:wallet:topup). Os dados do cartão vão do navegador de quem paga direto para o Stripe (Payment Element) e nunca chegam à Pilot Status. O clientSecret permite a quem o tiver confirmar o intent: não guarde em cache nem em log. Enviado com Cache-Control: no-store.
Requer uma chave com escopo de tenant — uma chave de workspace, ou uma chave de conta com x-workspace-id.
curl --request POST \
--url https://pilotstatus.com.br/v1/billing/payment-intents \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"purpose": "wallet_topup",
"amount": 150,
"saveCard": true
}
'import requests
url = "https://pilotstatus.com.br/v1/billing/payment-intents"
payload = {
"purpose": "wallet_topup",
"amount": 150,
"saveCard": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({purpose: 'wallet_topup', amount: 150, saveCard: true})
};
fetch('https://pilotstatus.com.br/v1/billing/payment-intents', 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://pilotstatus.com.br/v1/billing/payment-intents",
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([
'purpose' => 'wallet_topup',
'amount' => 150,
'saveCard' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://pilotstatus.com.br/v1/billing/payment-intents"
payload := strings.NewReader("{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://pilotstatus.com.br/v1/billing/payment-intents")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/billing/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}"
response = http.request(request)
puts response.read_body{
"clientSecret": "pi_3QabcDEF_secret_xyz",
"paymentIntentId": "pi_3QabcDEF",
"orderId": "cmh2b7q4s0003to8example8t",
"amount": 150,
"currency": "BRL",
"publishableKey": "pk_live_..."
}{
"error": "amount must be a positive number. | amount deve ser um número positivo.",
"code": "INVALID_AMOUNT"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires a tenant-scoped API key",
"code": "NUMBER_SCOPE_NOT_ALLOWED"
}{
"error": "This Idempotency-Key was already used with different parameters. Use a new key. | Esta Idempotency-Key já foi usada com outros parâmetros. Use uma nova chave.",
"code": "IDEMPOTENCY_KEY_REUSED"
}{
"error": "Card payments are not available right now. | Pagamentos com cartão não estão disponíveis no momento.",
"code": "PAYMENTS_NOT_CONFIGURED"
}Autorizações
Sua chave de API ps_
Cabeçalhos
Opcional. Até 255 caracteres, sem caracteres de controle.
255Só com chave de conta (ps_account_): o workspace em que agir, obtido em GET /v1/workspaces. Sem ele, uma chave de conta recebe 400 WORKSPACE_ID_REQUIRED.
Corpo
Resposta
O intent
Esta página foi útil?
curl --request POST \
--url https://pilotstatus.com.br/v1/billing/payment-intents \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"purpose": "wallet_topup",
"amount": 150,
"saveCard": true
}
'import requests
url = "https://pilotstatus.com.br/v1/billing/payment-intents"
payload = {
"purpose": "wallet_topup",
"amount": 150,
"saveCard": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({purpose: 'wallet_topup', amount: 150, saveCard: true})
};
fetch('https://pilotstatus.com.br/v1/billing/payment-intents', 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://pilotstatus.com.br/v1/billing/payment-intents",
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([
'purpose' => 'wallet_topup',
'amount' => 150,
'saveCard' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://pilotstatus.com.br/v1/billing/payment-intents"
payload := strings.NewReader("{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://pilotstatus.com.br/v1/billing/payment-intents")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/billing/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"purpose\": \"wallet_topup\",\n \"amount\": 150,\n \"saveCard\": true\n}"
response = http.request(request)
puts response.read_body{
"clientSecret": "pi_3QabcDEF_secret_xyz",
"paymentIntentId": "pi_3QabcDEF",
"orderId": "cmh2b7q4s0003to8example8t",
"amount": 150,
"currency": "BRL",
"publishableKey": "pk_live_..."
}{
"error": "amount must be a positive number. | amount deve ser um número positivo.",
"code": "INVALID_AMOUNT"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires a tenant-scoped API key",
"code": "NUMBER_SCOPE_NOT_ALLOWED"
}{
"error": "This Idempotency-Key was already used with different parameters. Use a new key. | Esta Idempotency-Key já foi usada com outros parâmetros. Use uma nova chave.",
"code": "IDEMPOTENCY_KEY_REUSED"
}{
"error": "Card payments are not available right now. | Pagamentos com cartão não estão disponíveis no momento.",
"code": "PAYMENTS_NOT_CONFIGURED"
}