Crear clientes
curl --request POST \
--url https://api.onepay.la/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"user_type": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"document_type": "<string>",
"document_number": "<string>"
}
'import requests
url = "https://api.onepay.la/v1/customers"
payload = {
"user_type": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"document_type": "<string>",
"document_number": "<string>"
}
headers = {
"x-idempotency": "<x-idempotency>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency': '<x-idempotency>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_type: '<string>',
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
document_type: '<string>',
document_number: '<string>'
})
};
fetch('https://api.onepay.la/v1/customers', 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://api.onepay.la/v1/customers",
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([
'user_type' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'document_type' => '<string>',
'document_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-idempotency: <x-idempotency>"
],
]);
$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 := "https://api.onepay.la/v1/customers"
payload := strings.NewReader("{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency", "<x-idempotency>")
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("https://api.onepay.la/v1/customers")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency"] = '<x-idempotency>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id":"9da58912-101d-46f8-86c9-20a52119c0bf",
"first_name":"John",
"last_name":"Doe",
"email":"john.doe@example.com",
"phone":"+573100001020",
"document_type":"CC",
"document_number":"1060500333",
"created_at":"2024-12-04T20:09:08.000000Z"
}
{
"message":"El campo nombre es obligatorio. (y 6 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"first_name":[
"El campo nombre es obligatorio."
],
"last_name":[
"El campo apellido es obligatorio."
],
"phone":[
"El campo tel\u00e9fono es obligatorio."
],
"email":[
"El campo correo electr\u00f3nico es obligatorio."
],
"user_type":[
"El campo user type es obligatorio."
],
"document_type":[
"El campo document type es obligatorio."
],
"document_number":[
"El campo document number es obligatorio."
]
}
}
{
"message": "No se puede generar la operación, genera un token de idempotencia y envíelo en los headers como x-idempotency",
"code": 10003,
"code_name": "idempotency_error"
}
Crea un nuevo cliente en tu cuenta.
POST
/
customers
Crear clientes
curl --request POST \
--url https://api.onepay.la/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"user_type": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"document_type": "<string>",
"document_number": "<string>"
}
'import requests
url = "https://api.onepay.la/v1/customers"
payload = {
"user_type": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"document_type": "<string>",
"document_number": "<string>"
}
headers = {
"x-idempotency": "<x-idempotency>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency': '<x-idempotency>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_type: '<string>',
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
document_type: '<string>',
document_number: '<string>'
})
};
fetch('https://api.onepay.la/v1/customers', 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://api.onepay.la/v1/customers",
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([
'user_type' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'document_type' => '<string>',
'document_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-idempotency: <x-idempotency>"
],
]);
$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 := "https://api.onepay.la/v1/customers"
payload := strings.NewReader("{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency", "<x-idempotency>")
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("https://api.onepay.la/v1/customers")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency"] = '<x-idempotency>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_type\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"document_type\": \"<string>\",\n \"document_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id":"9da58912-101d-46f8-86c9-20a52119c0bf",
"first_name":"John",
"last_name":"Doe",
"email":"john.doe@example.com",
"phone":"+573100001020",
"document_type":"CC",
"document_number":"1060500333",
"created_at":"2024-12-04T20:09:08.000000Z"
}
{
"message":"El campo nombre es obligatorio. (y 6 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"first_name":[
"El campo nombre es obligatorio."
],
"last_name":[
"El campo apellido es obligatorio."
],
"phone":[
"El campo tel\u00e9fono es obligatorio."
],
"email":[
"El campo correo electr\u00f3nico es obligatorio."
],
"user_type":[
"El campo user type es obligatorio."
],
"document_type":[
"El campo document type es obligatorio."
],
"document_number":[
"El campo document number es obligatorio."
]
}
}
{
"message": "No se puede generar la operación, genera un token de idempotencia y envíelo en los headers como x-idempotency",
"code": 10003,
"code_name": "idempotency_error"
}
Headers
string
required
Token único para garantizar la idempotencia de la petición
Body
string
required
Tipo de usuario, valores permitidos: natural, company
string
required
Primer Nombre del cliente
string
required
Apellidos Nombre del cliente
string
required
Correo electrónico del cliente
string
required
Número de teléfono del cliente usa el prefijo de la región ejemplo: +57
string
required
Tipo de documento de identidad (CC, CE, NIT, PASSPORT)
string
required
Número de documento de identidad
Response
string
Identificador único del cliente en formato UUID
string
Nombre del cliente
string
Correo electrónico del cliente
string
Número de teléfono del cliente
string
Número de documento de identidad del cliente
string
Tipo de documento de identidad del cliente (ej. DNI, RUC, CE)
date
Fecha y hora de creación del cliente
{
"id":"9da58912-101d-46f8-86c9-20a52119c0bf",
"first_name":"John",
"last_name":"Doe",
"email":"john.doe@example.com",
"phone":"+573100001020",
"document_type":"CC",
"document_number":"1060500333",
"created_at":"2024-12-04T20:09:08.000000Z"
}
{
"message":"El campo nombre es obligatorio. (y 6 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"first_name":[
"El campo nombre es obligatorio."
],
"last_name":[
"El campo apellido es obligatorio."
],
"phone":[
"El campo tel\u00e9fono es obligatorio."
],
"email":[
"El campo correo electr\u00f3nico es obligatorio."
],
"user_type":[
"El campo user type es obligatorio."
],
"document_type":[
"El campo document type es obligatorio."
],
"document_number":[
"El campo document number es obligatorio."
]
}
}
{
"message": "No se puede generar la operación, genera un token de idempotencia y envíelo en los headers como x-idempotency",
"code": 10003,
"code_name": "idempotency_error"
}
Was this page helpful?
⌘I