Iniciar una recarga con tarjeta (Stripe Elements)
Crea una orden de recarga PENDIENTE y un PaymentIntent de tarjeta por amount (moneda del workspace, redondeado a centavos), para un formulario de tarjeta en tu propia página. Llama a stripe.confirmPayment() con clientSecret y luego a POST /v1/billing/payment-intents/{id}/sync. La billetera se acredita exactamente una vez, por sync o por nuestro webhook de Stripe. saveCard: true también guarda la tarjeta. Idempotency-Key opcional: misma clave y mismo cuerpo dentro de 24 h → el mismo intent, con Idempotent-Replayed: true; misma clave, otro cuerpo → 409 IDEMPOTENCY_KEY_REUSED; aún en ejecución → 409 IDEMPOTENCY_KEY_IN_USE. Solo Owner (billing:wallet:topup). Los datos de la tarjeta van del navegador del pagador directamente a Stripe (Payment Element) y nunca llegan a Pilot Status. El clientSecret permite a quien lo tenga confirmar el intent: no lo almacenes en caché ni lo registres en logs. Se envía con Cache-Control: no-store.
Requiere una clave con alcance de tenant: una clave de workspace, o una clave de cuenta con 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_..."
}Encabezados
Cuerpo
Respuesta
El intent
¿Esta página le ayudó?
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_..."
}