Atualizar Método de Pagamento
curl --request PATCH \
--url http://api.gu1.ai/entities/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityData": {},
"relationships": [
{}
],
"metadata": {}
}
'import requests
url = "http://api.gu1.ai/entities/{id}"
payload = {
"entityData": {},
"relationships": [{}],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({entityData: {}, relationships: [{}], metadata: {}})
};
fetch('http://api.gu1.ai/entities/{id}', 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 => "http://api.gu1.ai/entities/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'entityData' => [
],
'relationships' => [
[
]
],
'metadata' => [
]
]),
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 := "http://api.gu1.ai/entities/{id}"
payload := strings.NewReader("{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "<string>",
"entityData": {},
"updatedAt": "<string>"
}Referência API
Atualizar Método de Pagamento
Atualizar uma entidade de método de pagamento — no modelo de entidades gu1 para cartões, contas e carteiras, com exemplos para update.
PATCH
/
entities
/
{id}
Atualizar Método de Pagamento
curl --request PATCH \
--url http://api.gu1.ai/entities/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityData": {},
"relationships": [
{}
],
"metadata": {}
}
'import requests
url = "http://api.gu1.ai/entities/{id}"
payload = {
"entityData": {},
"relationships": [{}],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({entityData: {}, relationships: [{}], metadata: {}})
};
fetch('http://api.gu1.ai/entities/{id}', 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 => "http://api.gu1.ai/entities/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'entityData' => [
],
'relationships' => [
[
]
],
'metadata' => [
]
]),
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 := "http://api.gu1.ai/entities/{id}"
payload := strings.NewReader("{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityData\": {},\n \"relationships\": [\n {}\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "<string>",
"entityData": {},
"updatedAt": "<string>"
}Visão Geral
Atualiza uma entidade de método de pagamento existente. Este endpoint permite atualizações parciais - você só precisa fornecer os campos que deseja alterar.Endpoint
PATCH http://api.gu1.ai/entities/{id}
Autenticação
Requer uma chave API válida no cabeçalho de Autorização:Authorization: Bearer YOUR_API_KEY
Parâmetros de Rota
string
required
UUID da entidade de método de pagamento a atualizar
Corpo da Requisição
object
Container para dados do método de pagamento a atualizar
array
Array de relacionamentos para adicionar ou atualizar
object
Metadados adicionais para atualizar
Exemplos de Requisições
Atualizar Data de Vencimento do Cartão
curl -X PATCH "http://api.gu1.ai/entities/payment-method-uuid-123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityData": {
"paymentMethod": {
"expiryMonth": "06",
"expiryYear": "2026"
}
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/payment-method-uuid-123',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityData: {
paymentMethod: {
expiryMonth: '06',
expiryYear: '2026'
}
}
})
}
);
const updated = await response.json();
console.log('Data de vencimento atualizada');
import requests
response = requests.patch(
'http://api.gu1.ai/entities/payment-method-uuid-123',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityData': {
'paymentMethod': {
'expiryMonth': '06',
'expiryYear': '2026'
}
}
}
)
updated = response.json()
print('Data de vencimento atualizada')
Adicionar Metadados
curl -X PATCH "http://api.gu1.ai/entities/payment-method-uuid-123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"isDefault": true,
"addedVia": "mobile_app",
"verifiedAt": "2024-12-23T10:00:00Z"
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/payment-method-uuid-123',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
metadata: {
isDefault: true,
addedVia: 'mobile_app',
verifiedAt: new Date().toISOString()
}
})
}
);
from datetime import datetime
response = requests.patch(
'http://api.gu1.ai/entities/payment-method-uuid-123',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'metadata': {
'isDefault': True,
'addedVia': 'mobile_app',
'verifiedAt': datetime.utcnow().isoformat() + 'Z'
}
}
)
Resposta
boolean
Se a operação foi bem-sucedida
string
UUID da entidade de método de pagamento atualizada
object
Os dados completos do método de pagamento atualizado
string
Timestamp ISO 8601 desta atualização
Exemplo de Resposta
{
"success": true,
"id": "payment-method-uuid-123",
"entityType": "payment_method",
"entityData": {
"paymentMethod": {
"type": "credit_card",
"last4": "4242",
"brand": "visa",
"expiryMonth": "06",
"expiryYear": "2026",
"holderName": "John Doe"
}
},
"metadata": {
"isDefault": true,
"addedVia": "mobile_app",
"verifiedAt": "2024-12-23T10:00:00Z"
},
"updatedAt": "2024-12-23T10:15:00.000Z"
}
- Este é um endpoint de atualização parcial - apenas os campos fornecidos serão atualizados
- Outros campos permanecerão inalterados
- Para remover um campo, defina-o explicitamente como
null - Atualizações de campos sensíveis (como números de cartão) podem ser restritas
Veja Também
Was this page helpful?
⌘I