Actualizar Método de Pago
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>"
}Referencia API
Actualizar Método de Pago
Actualizar una entidad de método de pago — en el modelo de entidades gu1 para tarjetas, cuentas y billeteras, con ejemplos para update.
PATCH
/
entities
/
{id}
Actualizar Método de Pago
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>"
}Descripción General
Actualiza una entidad de método de pago existente. Este endpoint permite actualizaciones parciales - solo necesita proporcionar los campos que desea cambiar.Endpoint
PATCH http://api.gu1.ai/entities/{id}
Autenticación
Requiere una clave API válida en el encabezado de Autorización:Authorization: Bearer YOUR_API_KEY
Parámetros de Ruta
string
required
UUID de la entidad de método de pago a actualizar
Cuerpo de la Solicitud
object
Contenedor para datos de método de pago a actualizar
array
Array de relaciones para agregar o actualizar
object
Metadatos adicionales para actualizar
Ejemplos de Solicitudes
Actualizar Fecha de Vencimiento de Tarjeta
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('Fecha de vencimiento actualizada');
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('Fecha de vencimiento actualizada')
Agregar Metadatos
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'
}
}
)
Respuesta
boolean
Si la operación fue exitosa
string
UUID de la entidad de método de pago actualizada
object
Los datos completos del método de pago actualizado
string
Marca de tiempo ISO 8601 de esta actualización
Ejemplo de Respuesta
{
"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 es un endpoint de actualización parcial - solo se actualizarán los campos proporcionados
- Otros campos permanecerán sin cambios
- Para eliminar un campo, establézcalo explícitamente en
null - Las actualizaciones de campos sensibles (como números de tarjeta) pueden estar restringidas
Ver También
Was this page helpful?
⌘I