Cobrança
Sincronizar o salvamento de cartão
Chame depois que o stripe.confirmSetup() resolver. Lê o SetupIntent no Stripe (nunca confia no cliente) e, quando está succeeded, torna o cartão o cartão salvo do workspace na hora, substituindo o anterior. Ainda não concluído → saved: false. Idempotente. Não lê corpo. Só Proprietário.
Requer uma chave com escopo de tenant — uma chave de workspace, ou uma chave de conta com x-workspace-id.
POST
/
v1
/
billing
/
card
/
setup-intent
/
{id}
/
sync
Sincronizar o salvamento de cartão
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"
}Autorizações
apiKeyapiKeyId
Sua chave de API ps_
Cabeçalhos
Só 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.
Parâmetros de caminho
O setupIntentId (seti_…).
Resposta
Resultado
Esta página foi útil?
⌘I
Sincronizar o salvamento de cartão
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"
}