Criar Método de Pagamento
curl --request POST \
--url http://api.gu1.ai/entities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityType": "<string>",
"entityData": {
"paymentMethod": {
"type": "<string>",
"last4": "<string>",
"brand": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"holderName": "<string>",
"issuerCountry": "<string>",
"bin": "<string>",
"pixKey": "<string>",
"pixKeyType": "<string>"
}
},
"relationships": [
{}
]
}
'import requests
url = "http://api.gu1.ai/entities"
payload = {
"entityType": "<string>",
"entityData": { "paymentMethod": {
"type": "<string>",
"last4": "<string>",
"brand": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"holderName": "<string>",
"issuerCountry": "<string>",
"bin": "<string>",
"pixKey": "<string>",
"pixKeyType": "<string>"
} },
"relationships": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entityType: '<string>',
entityData: {
paymentMethod: {
type: '<string>',
last4: '<string>',
brand: '<string>',
expiryMonth: '<string>',
expiryYear: '<string>',
holderName: '<string>',
issuerCountry: '<string>',
bin: '<string>',
pixKey: '<string>',
pixKeyType: '<string>'
}
},
relationships: [{}]
})
};
fetch('http://api.gu1.ai/entities', 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",
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([
'entityType' => '<string>',
'entityData' => [
'paymentMethod' => [
'type' => '<string>',
'last4' => '<string>',
'brand' => '<string>',
'expiryMonth' => '<string>',
'expiryYear' => '<string>',
'holderName' => '<string>',
'issuerCountry' => '<string>',
'bin' => '<string>',
'pixKey' => '<string>',
'pixKeyType' => '<string>'
]
],
'relationships' => [
[
]
]
]),
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"
payload := strings.NewReader("{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("http://api.gu1.ai/entities")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "<string>",
"entityType": "<string>",
"entityData": {},
"createdAt": "<string>"
}Referência API
Criar Método de Pagamento
Criar uma nova entidade de método de pagamento — no modelo de entidades gu1 para cartões, contas e carteiras, com exemplos para create.
POST
/
entities
Criar Método de Pagamento
curl --request POST \
--url http://api.gu1.ai/entities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityType": "<string>",
"entityData": {
"paymentMethod": {
"type": "<string>",
"last4": "<string>",
"brand": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"holderName": "<string>",
"issuerCountry": "<string>",
"bin": "<string>",
"pixKey": "<string>",
"pixKeyType": "<string>"
}
},
"relationships": [
{}
]
}
'import requests
url = "http://api.gu1.ai/entities"
payload = {
"entityType": "<string>",
"entityData": { "paymentMethod": {
"type": "<string>",
"last4": "<string>",
"brand": "<string>",
"expiryMonth": "<string>",
"expiryYear": "<string>",
"holderName": "<string>",
"issuerCountry": "<string>",
"bin": "<string>",
"pixKey": "<string>",
"pixKeyType": "<string>"
} },
"relationships": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entityType: '<string>',
entityData: {
paymentMethod: {
type: '<string>',
last4: '<string>',
brand: '<string>',
expiryMonth: '<string>',
expiryYear: '<string>',
holderName: '<string>',
issuerCountry: '<string>',
bin: '<string>',
pixKey: '<string>',
pixKeyType: '<string>'
}
},
relationships: [{}]
})
};
fetch('http://api.gu1.ai/entities', 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",
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([
'entityType' => '<string>',
'entityData' => [
'paymentMethod' => [
'type' => '<string>',
'last4' => '<string>',
'brand' => '<string>',
'expiryMonth' => '<string>',
'expiryYear' => '<string>',
'holderName' => '<string>',
'issuerCountry' => '<string>',
'bin' => '<string>',
'pixKey' => '<string>',
'pixKeyType' => '<string>'
]
],
'relationships' => [
[
]
]
]),
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"
payload := strings.NewReader("{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("http://api.gu1.ai/entities")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityType\": \"<string>\",\n \"entityData\": {\n \"paymentMethod\": {\n \"type\": \"<string>\",\n \"last4\": \"<string>\",\n \"brand\": \"<string>\",\n \"expiryMonth\": \"<string>\",\n \"expiryYear\": \"<string>\",\n \"holderName\": \"<string>\",\n \"issuerCountry\": \"<string>\",\n \"bin\": \"<string>\",\n \"pixKey\": \"<string>\",\n \"pixKeyType\": \"<string>\"\n }\n },\n \"relationships\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "<string>",
"entityType": "<string>",
"entityData": {},
"createdAt": "<string>"
}Visão Geral
Cria uma nova entidade de método de pagamento (cartão de crédito, conta bancária, carteira, etc.) no sistema. Os métodos de pagamento podem ser vinculados a entidades de pessoas ou empresas e usados para monitoramento de transações e detecção de fraude.Endpoint
POST http://api.gu1.ai/entities
Autenticação
Requer uma chave API válida no cabeçalho de Autorização:Authorization: Bearer YOUR_API_KEY
Corpo da Requisição
string
required
Deve ser
"payment_method" para entidades de método de pagamentoobject
required
Container para dados do método de pagamento
Show propriedades
Show propriedades
object
required
Detalhes do método de pagamento
Show propriedades
Show propriedades
string
required
Tipo de método de pagamento:
credit_card, debit_card, bank_account, digital_wallet, crypto_wallet, pixstring
Últimos 4 dígitos do número de cartão/conta
string
Marca do cartão (para cartões):
visa, mastercard, amex, elo, hipercard, etc.string
Mês de vencimento (para cartões):
01 a 12string
Ano de vencimento (para cartões): formato
YYYYstring
Nome no cartão/conta
string
Código do país emissor (ISO 3166-1 alpha-2)
string
Número de Identificação Bancária (primeiros 6 dígitos do cartão)
string
Chave PIX (para métodos de pagamento PIX no Brasil)
string
Tipo de chave PIX:
cpf, cnpj, email, phone, randomarray
Array de relacionamentos com outras entidades
Exemplos de Requisições
Criar Cartão de Crédito
curl -X POST http://api.gu1.ai/entities \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityType": "payment_method",
"entityData": {
"paymentMethod": {
"type": "credit_card",
"last4": "4242",
"brand": "visa",
"expiryMonth": "12",
"expiryYear": "2025",
"holderName": "John Doe",
"issuerCountry": "BR",
"bin": "424242",
"funding": "credit"
}
},
"relationships": [
{
"targetEntityId": "person-uuid-123",
"relationshipType": "owns",
"strength": 1.0
}
]
}'
const response = await fetch('http://api.gu1.ai/entities', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityType: 'payment_method',
entityData: {
paymentMethod: {
type: 'credit_card',
last4: '4242',
brand: 'visa',
expiryMonth: '12',
expiryYear: '2025',
holderName: 'John Doe',
issuerCountry: 'BR',
bin: '424242',
funding: 'credit'
}
},
relationships: [
{
targetEntityId: 'person-uuid-123',
relationshipType: 'owns',
strength: 1.0
}
]
})
});
const paymentMethod = await response.json();
console.log(paymentMethod.id);
import requests
response = requests.post(
'http://api.gu1.ai/entities',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityType': 'payment_method',
'entityData': {
'paymentMethod': {
'type': 'credit_card',
'last4': '4242',
'brand': 'visa',
'expiryMonth': '12',
'expiryYear': '2025',
'holderName': 'John Doe',
'issuerCountry': 'BR',
'bin': '424242',
'funding': 'credit'
}
},
'relationships': [
{
'targetEntityId': 'person-uuid-123',
'relationshipType': 'owns',
'strength': 1.0
}
]
}
)
payment_method = response.json()
print(payment_method['id'])
Criar Método de Pagamento PIX
curl -X POST http://api.gu1.ai/entities \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityType": "payment_method",
"entityData": {
"paymentMethod": {
"type": "pix",
"pixKey": "john.doe@example.com",
"pixKeyType": "email",
"holderName": "John Doe",
"currency": "BRL"
}
},
"relationships": [
{
"targetEntityId": "person-uuid-123",
"relationshipType": "owns",
"strength": 1.0
}
]
}'
const response = await fetch('http://api.gu1.ai/entities', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityType: 'payment_method',
entityData: {
paymentMethod: {
type: 'pix',
pixKey: 'john.doe@example.com',
pixKeyType: 'email',
holderName: 'John Doe',
currency: 'BRL'
}
},
relationships: [{
targetEntityId: 'person-uuid-123',
relationshipType: 'owns',
strength: 1.0
}]
})
});
response = requests.post(
'http://api.gu1.ai/entities',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'entityType': 'payment_method',
'entityData': {
'paymentMethod': {
'type': 'pix',
'pixKey': 'john.doe@example.com',
'pixKeyType': 'email',
'holderName': 'John Doe',
'currency': 'BRL'
}
},
'relationships': [{
'targetEntityId': 'person-uuid-123',
'relationshipType': 'owns',
'strength': 1.0
}]
}
)
Resposta
boolean
Se a operação foi bem-sucedida
string
UUID da entidade de método de pagamento criada
string
Sempre
"payment_method"object
Os dados do método de pagamento conforme armazenados
string
Timestamp ISO 8601 da criação
Exemplo de Resposta
{
"success": true,
"id": "payment-method-uuid-123",
"entityType": "payment_method",
"entityData": {
"paymentMethod": {
"type": "credit_card",
"last4": "4242",
"brand": "visa",
"expiryMonth": "12",
"expiryYear": "2025",
"holderName": "John Doe"
}
},
"createdAt": "2024-12-23T10:00:00.000Z"
}
Veja Também
Was this page helpful?
⌘I