Facturación
Sincronizar el guardado de una tarjeta
Llama después de que stripe.confirmSetup() se resuelva. Lee el SetupIntent desde Stripe (nunca confía en el cliente) y, cuando está succeeded, convierte la tarjeta en la tarjeta guardada del workspace de inmediato, reemplazando la anterior. Si aún no está succeeded → saved: false. Idempotente. Nunca lee un cuerpo. Solo Owner.
Requiere una clave con alcance de tenant: una clave de workspace, o una clave de cuenta con x-workspace-id.
POST
/
v1
/
billing
/
card
/
setup-intent
/
{id}
/
sync
Sincronizar el guardado de una tarjeta
curl --request POST \
--url https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync', 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/card/setup-intent/{id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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/card/setup-intent/{id}/sync")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"setupIntentId": "seti_1QabcDEF",
"status": "succeeded",
"saved": true,
"card": {
"brand": "visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2030
}
}{
"error": "The id must be a Stripe SetupIntent id (seti_…). | O id deve ser o id de um SetupIntent do Stripe (seti_…).",
"code": "INVALID_SETUP_INTENT_ID"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires a tenant-scoped API key",
"code": "NUMBER_SCOPE_NOT_ALLOWED"
}{
"error": "Setup intent not found for this workspace. | Setup intent não encontrado neste workspace.",
"code": "SETUP_INTENT_NOT_FOUND"
}{
"error": "Could not process the billing request. | Não foi possível processar a solicitação de cobrança.",
"code": "BILLING_REQUEST_FAILED"
}Encabezados
Respuesta
Resultado
¿Esta página le ayudó?
⌘I
Sincronizar el guardado de una tarjeta
curl --request POST \
--url https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync', 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/card/setup-intent/{id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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/card/setup-intent/{id}/sync")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/billing/card/setup-intent/{id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"setupIntentId": "seti_1QabcDEF",
"status": "succeeded",
"saved": true,
"card": {
"brand": "visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2030
}
}{
"error": "The id must be a Stripe SetupIntent id (seti_…). | O id deve ser o id de um SetupIntent do Stripe (seti_…).",
"code": "INVALID_SETUP_INTENT_ID"
}{
"error": "Invalid API key"
}{
"error": "This endpoint requires a tenant-scoped API key",
"code": "NUMBER_SCOPE_NOT_ALLOWED"
}{
"error": "Setup intent not found for this workspace. | Setup intent não encontrado neste workspace.",
"code": "SETUP_INTENT_NOT_FOUND"
}{
"error": "Could not process the billing request. | Não foi possível processar a solicitação de cobrança.",
"code": "BILLING_REQUEST_FAILED"
}