Crear un QR (Bre-B)
curl --request POST \
--url https://api.onepay.la/v1/charges/bre-b \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"amount": 123,
"customer_id": "<string>",
"title": "<string>",
"description": "<string>",
"external_id": "<string>",
"expires_in": 123
}
'import requests
url = "https://api.onepay.la/v1/charges/bre-b"
payload = {
"amount": 123,
"customer_id": "<string>",
"title": "<string>",
"description": "<string>",
"external_id": "<string>",
"expires_in": 123
}
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({
amount: 123,
customer_id: '<string>',
title: '<string>',
description: '<string>',
external_id: '<string>',
expires_in: 123
})
};
fetch('https://api.onepay.la/v1/charges/bre-b', 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/bre-b",
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([
'amount' => 123,
'customer_id' => '<string>',
'title' => '<string>',
'description' => '<string>',
'external_id' => '<string>',
'expires_in' => 123
]),
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/bre-b"
payload := strings.NewReader("{\n \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\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/bre-b")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/charges/bre-b")
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 \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"source": "Pago BRE-B",
"currency": "COP",
"amount": 15000,
"amount_label": "$15.000",
"title": "Pago BRE-B",
"description": null,
"phone": null,
"expiration_at": null,
"due_date": null,
"document_link": null,
"external_id": "order-123",
"allows": null,
"status": "pending",
"is_test": false,
"created_at": "2026-01-30T15:30:00.000000Z",
"paid_at": null,
"payment_link": null,
"redirect_url": null,
"provider_id": null,
"qr": {
"image": "data:image/png;base64,iVBORw0KGgoAAAANS...",
"string": "00020101021226ABC123...",
"id": "ABC123DEF456789"
},
"key": {
"alias": "@A1B2C3D4",
"id": "9e184fda-1234-5678-9020-fa59f44f2b99"
},
"expires_at": "2026-01-30T15:45:00.000000Z",
"expires_in_seconds": 900,
"customer": {
"id": "9dd4158b-0e45-42bc-b56f-a4c1f856814d",
"first_name": "Juan",
"last_name": "Pérez",
"email": "juan@example.com",
"phone": "+573001234567",
"document_type": "CC",
"document_number": "1234567890",
"created_at": "2026-01-15T10:00:00.000000Z",
"is_test": false
}
}
{
"message": "El campo cantidad es obligatorio.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"amount": [
"El campo cantidad es obligatorio."
]
}
}
{
"message": "No se pudo generar el código QR. Intente nuevamente.",
"code": 90100,
"code_name": "qr_generation_failed"
}
{
"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"
}
Crear un QR (Bre-B)
Endpoint para crear un código QR para pagos con Bre-B.
POST
/
charges
/
bre-b
Crear un QR (Bre-B)
curl --request POST \
--url https://api.onepay.la/v1/charges/bre-b \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency: <x-idempotency>' \
--data '
{
"amount": 123,
"customer_id": "<string>",
"title": "<string>",
"description": "<string>",
"external_id": "<string>",
"expires_in": 123
}
'import requests
url = "https://api.onepay.la/v1/charges/bre-b"
payload = {
"amount": 123,
"customer_id": "<string>",
"title": "<string>",
"description": "<string>",
"external_id": "<string>",
"expires_in": 123
}
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({
amount: 123,
customer_id: '<string>',
title: '<string>',
description: '<string>',
external_id: '<string>',
expires_in: 123
})
};
fetch('https://api.onepay.la/v1/charges/bre-b', 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/bre-b",
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([
'amount' => 123,
'customer_id' => '<string>',
'title' => '<string>',
'description' => '<string>',
'external_id' => '<string>',
'expires_in' => 123
]),
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/bre-b"
payload := strings.NewReader("{\n \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\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/bre-b")
.header("x-idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onepay.la/v1/charges/bre-b")
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 \"amount\": 123,\n \"customer_id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"<string>\",\n \"expires_in\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"source": "Pago BRE-B",
"currency": "COP",
"amount": 15000,
"amount_label": "$15.000",
"title": "Pago BRE-B",
"description": null,
"phone": null,
"expiration_at": null,
"due_date": null,
"document_link": null,
"external_id": "order-123",
"allows": null,
"status": "pending",
"is_test": false,
"created_at": "2026-01-30T15:30:00.000000Z",
"paid_at": null,
"payment_link": null,
"redirect_url": null,
"provider_id": null,
"qr": {
"image": "data:image/png;base64,iVBORw0KGgoAAAANS...",
"string": "00020101021226ABC123...",
"id": "ABC123DEF456789"
},
"key": {
"alias": "@A1B2C3D4",
"id": "9e184fda-1234-5678-9020-fa59f44f2b99"
},
"expires_at": "2026-01-30T15:45:00.000000Z",
"expires_in_seconds": 900,
"customer": {
"id": "9dd4158b-0e45-42bc-b56f-a4c1f856814d",
"first_name": "Juan",
"last_name": "Pérez",
"email": "juan@example.com",
"phone": "+573001234567",
"document_type": "CC",
"document_number": "1234567890",
"created_at": "2026-01-15T10:00:00.000000Z",
"is_test": false
}
}
{
"message": "El campo cantidad es obligatorio.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"amount": [
"El campo cantidad es obligatorio."
]
}
}
{
"message": "No se pudo generar el código QR. Intente nuevamente.",
"code": 90100,
"code_name": "qr_generation_failed"
}
{
"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"
}
Este endpoint permite generar un código QR para recibir pagos a través del sistema BRE-B (Banco de la República). El cliente escanea el código QR desde su aplicación bancaria para completar el pago.
Headers
string
required
Token único para garantizar la idempotencia de la petición
Body
number
required
Monto a cobrar en pesos colombianos. Mínimo: 1000 COP.
string
ID del cliente que realizará el pago. Opcional. Crear cliente.
string
Título descriptivo del pago. Por defecto: “Pago BRE-B”.
string
Descripción detallada del pago.
string
Identificador único del pago en tu sistema.
integer
Tiempo de expiración del QR en minutos. Mínimo: 5, Máximo: 64800 (45 días). Por defecto: 15 minutos.
El campo
qr.image contiene la imagen del código QR en formato base64. Debes mostrarla al usuario para que la escanee desde su aplicación bancaria.<img src="data:image/png;base64,iVBORw0KGgoAAAANS..." />
{
"id": "9e184fda-62bb-477b-9020-fa59f44f2b99",
"source": "Pago BRE-B",
"currency": "COP",
"amount": 15000,
"amount_label": "$15.000",
"title": "Pago BRE-B",
"description": null,
"phone": null,
"expiration_at": null,
"due_date": null,
"document_link": null,
"external_id": "order-123",
"allows": null,
"status": "pending",
"is_test": false,
"created_at": "2026-01-30T15:30:00.000000Z",
"paid_at": null,
"payment_link": null,
"redirect_url": null,
"provider_id": null,
"qr": {
"image": "data:image/png;base64,iVBORw0KGgoAAAANS...",
"string": "00020101021226ABC123...",
"id": "ABC123DEF456789"
},
"key": {
"alias": "@A1B2C3D4",
"id": "9e184fda-1234-5678-9020-fa59f44f2b99"
},
"expires_at": "2026-01-30T15:45:00.000000Z",
"expires_in_seconds": 900,
"customer": {
"id": "9dd4158b-0e45-42bc-b56f-a4c1f856814d",
"first_name": "Juan",
"last_name": "Pérez",
"email": "juan@example.com",
"phone": "+573001234567",
"document_type": "CC",
"document_number": "1234567890",
"created_at": "2026-01-15T10:00:00.000000Z",
"is_test": false
}
}
{
"message": "El campo cantidad es obligatorio.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"amount": [
"El campo cantidad es obligatorio."
]
}
}
{
"message": "No se pudo generar el código QR. Intente nuevamente.",
"code": 90100,
"code_name": "qr_generation_failed"
}
{
"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"
}
Campos de respuesta
| Campo | Tipo | Descripción |
|---|---|---|
id | string | ID único del pago |
qr.image | string | Imagen del QR en base64 |
qr.string | string | Contenido del QR como texto |
qr.id | string | ID del QR en el sistema BRE-B |
key.alias | string | Alias de la llave BRE-B (ej: @A1B2C3D4) |
key.id | string | ID interno de la llave |
expires_at | string | Fecha y hora de expiración (ISO 8601) |
expires_in_seconds | integer | Segundos restantes hasta la expiración |
status | string | Estado del pago: pending, paid, failed |
Flujo de pago
- Tu sistema llama a este endpoint para generar el QR
- Muestra el QR al cliente
- El cliente escanea el QR desde su app bancaria
- El banco procesa el pago
- OnePay envía un webhook con el resultado
- Tu sistema actualiza el estado del pedido
Expiración
El QR tiene un tiempo de vida configurable mediante el parámetroexpires_in:
- Mínimo: 5 minutos
- Máximo: 64800 minutos (45 días)
- Por defecto: 15 minutos
failed.Was this page helpful?
⌘I