Crear un link de pago (PSE)
curl --request POST \
--url https://api.onepay.la/v1/charges/pse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"customer_id": "<string>",
"amount": 123,
"bank_id": "<string>",
"external_id": "<string>",
"redirect_url": "<string>"
}
'import requests
url = "https://api.onepay.la/v1/charges/pse"
payload = {
"customer_id": "<string>",
"amount": 123,
"bank_id": "<string>",
"external_id": "<string>",
"redirect_url": "<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({
customer_id: '<string>',
amount: 123,
bank_id: '<string>',
external_id: '<string>',
redirect_url: '<string>'
})
};
fetch('https://api.onepay.la/v1/charges/pse', 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/charges/pse",
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([
'customer_id' => '<string>',
'amount' => 123,
'bank_id' => '<string>',
'external_id' => '<string>',
'redirect_url' => '<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/charges/pse"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<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/charges/pse")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/charges/pse")
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 \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"url": "https://s.onepay.la/short/lxNKQp2je8"
}
{
"message":"El campo cantidad es obligatorio. (y 2 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"amount":[
"El campo cantidad es obligatorio."
],
"bank_id":[
"El campo bank id es obligatorio."
],
"customer_id":[
"El campo customer id 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"
}
{
"message": "Ya existe un pago PSE en proceso para esta misma operación. Espera a que el cliente complete el flujo actual o a que expire antes de reintentar.",
"code": 15005,
"code_name": "pse_payment_duplicate",
"previous_payment_id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"previous_payment_created_at": "2026-05-13T08:25:14-05:00",
"time_elapsed_seconds": 42
}
Crear un link de pago (PSE)
Endpoint para registrar un cargo en el sistema de OnePay.
POST
charges
/
pse
Crear un link de pago (PSE)
curl --request POST \
--url https://api.onepay.la/v1/charges/pse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"customer_id": "<string>",
"amount": 123,
"bank_id": "<string>",
"external_id": "<string>",
"redirect_url": "<string>"
}
'import requests
url = "https://api.onepay.la/v1/charges/pse"
payload = {
"customer_id": "<string>",
"amount": 123,
"bank_id": "<string>",
"external_id": "<string>",
"redirect_url": "<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({
customer_id: '<string>',
amount: 123,
bank_id: '<string>',
external_id: '<string>',
redirect_url: '<string>'
})
};
fetch('https://api.onepay.la/v1/charges/pse', 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/charges/pse",
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([
'customer_id' => '<string>',
'amount' => 123,
'bank_id' => '<string>',
'external_id' => '<string>',
'redirect_url' => '<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/charges/pse"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<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/charges/pse")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/charges/pse")
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 \"customer_id\": \"<string>\",\n \"amount\": 123,\n \"bank_id\": \"<string>\",\n \"external_id\": \"<string>\",\n \"redirect_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"url": "https://s.onepay.la/short/lxNKQp2je8"
}
{
"message":"El campo cantidad es obligatorio. (y 2 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"amount":[
"El campo cantidad es obligatorio."
],
"bank_id":[
"El campo bank id es obligatorio."
],
"customer_id":[
"El campo customer id 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"
}
{
"message": "Ya existe un pago PSE en proceso para esta misma operación. Espera a que el cliente complete el flujo actual o a que expire antes de reintentar.",
"code": 15005,
"code_name": "pse_payment_duplicate",
"previous_payment_id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"previous_payment_created_at": "2026-05-13T08:25:14-05:00",
"time_elapsed_seconds": 42
}
Headers
string
required
Token único para garantizar la idempotencia de la petición
Body
string
required
ID del cliente al que se enviará el link. Crear cliente.
number
required
Monto que vas a cobrar
string
required
Identificador único del banco.
string
Identificador único del pago.
string
URL de retorno.
Protección automática contra duplicados. Si envías la misma combinación de
customer_id, bank_id y amount dentro de los 2 minutos siguientes a un pago PSE anterior, recibirás HTTP 429 con el previous_payment_id del pago en curso para que puedas reusar ese flujo. Variar external_id, redirect_url o reference no esquiva la protección — los reintentos sobre la misma operación seguirán bloqueados.{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"url": "https://s.onepay.la/short/lxNKQp2je8"
}
{
"message":"El campo cantidad es obligatorio. (y 2 errores m\u00e1s)",
"code":10001,
"code_name":"validation_error",
"errors":{
"amount":[
"El campo cantidad es obligatorio."
],
"bank_id":[
"El campo bank id es obligatorio."
],
"customer_id":[
"El campo customer id 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"
}
{
"message": "Ya existe un pago PSE en proceso para esta misma operación. Espera a que el cliente complete el flujo actual o a que expire antes de reintentar.",
"code": 15005,
"code_name": "pse_payment_duplicate",
"previous_payment_id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"previous_payment_created_at": "2026-05-13T08:25:14-05:00",
"time_elapsed_seconds": 42
}
Was this page helpful?
⌘I