Actualizar webhook
Modifica el nombre, URL o eventos de un webhook existente. Todos los campos son opcionales.
PUT
/
webhooks
/
{id}
curl https://api.onepay.la/v1/webhooks/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-X PUT \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "Content-Type: application/json" \
-d '{
"name": "Webhook actualizado",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
}'
const id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(`https://api.onepay.la/v1/webhooks/${id}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Webhook actualizado',
events: [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
})
});
const webhook = await response.json();
import requests
webhook_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.put(
f'https://api.onepay.la/v1/webhooks/{webhook_id}',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
json={
'name': 'Webhook actualizado',
'events': [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
}
)
webhook = response.json()
<?php
$id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onepay.la/v1/webhooks/{$id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Webhook actualizado",
"events" => [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
])
]);
$response = curl_exec($curl);
$webhook = json_decode($response, true);
?>
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Webhook actualizado",
"description": "Notificaciones de pagos y dispersiones",
"url": "https://mi-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
],
"header": null,
"is_test": false,
"created_at": "2025-01-20T14:30:00+00:00",
"updated_at": "2025-01-20T16:45:00+00:00"
}
}
{
"message": "El campo events debe ser un arreglo.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"events": ["El campo events debe ser un arreglo."]
}
}
{
"message": "Registro no encontrado, Webhook no existe",
"code": 10002,
"code_name": "record_not_found"
}
Puedes enviar solo los campos que quieres actualizar; los demás se mantienen sin cambios.
Path Parameters
Body
Nueva URL HTTPS de destino. Debe ser una URL válida.En producción (llave
sk_live_) la URL debe usar https://: una URL http:// se rechaza con un
error de validación, porque el cuerpo del evento lleva datos del beneficiario. En pruebas
(sk_test_) se acepta http:// para probar contra un servidor local.Nueva lista completa de eventos. Reemplaza los eventos existentes. Debe contener al menos un evento si se envía.
curl https://api.onepay.la/v1/webhooks/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-X PUT \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "Content-Type: application/json" \
-d '{
"name": "Webhook actualizado",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
}'
const id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(`https://api.onepay.la/v1/webhooks/${id}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Webhook actualizado',
events: [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
})
});
const webhook = await response.json();
import requests
webhook_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.put(
f'https://api.onepay.la/v1/webhooks/{webhook_id}',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
json={
'name': 'Webhook actualizado',
'events': [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
}
)
webhook = response.json()
<?php
$id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onepay.la/v1/webhooks/{$id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Webhook actualizado",
"events" => [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
])
]);
$response = curl_exec($curl);
$webhook = json_decode($response, true);
?>
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Webhook actualizado",
"description": "Notificaciones de pagos y dispersiones",
"url": "https://mi-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
],
"header": null,
"is_test": false,
"created_at": "2025-01-20T14:30:00+00:00",
"updated_at": "2025-01-20T16:45:00+00:00"
}
}
{
"message": "El campo events debe ser un arreglo.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"events": ["El campo events debe ser un arreglo."]
}
}
{
"message": "Registro no encontrado, Webhook no existe",
"code": 10002,
"code_name": "record_not_found"
}
Was this page helpful?
⌘I
curl https://api.onepay.la/v1/webhooks/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-X PUT \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "Content-Type: application/json" \
-d '{
"name": "Webhook actualizado",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
}'
const id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const response = await fetch(`https://api.onepay.la/v1/webhooks/${id}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Webhook actualizado',
events: [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
})
});
const webhook = await response.json();
import requests
webhook_id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
response = requests.put(
f'https://api.onepay.la/v1/webhooks/{webhook_id}',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'Content-Type': 'application/json'
},
json={
'name': 'Webhook actualizado',
'events': [
'payment.approved',
'charge.paid',
'cashout.completed',
'cashout.rejected'
]
}
)
webhook = response.json()
<?php
$id = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onepay.la/v1/webhooks/{$id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Webhook actualizado",
"events" => [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
]
])
]);
$response = curl_exec($curl);
$webhook = json_decode($response, true);
?>
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Webhook actualizado",
"description": "Notificaciones de pagos y dispersiones",
"url": "https://mi-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"charge.paid",
"cashout.completed",
"cashout.rejected"
],
"header": null,
"is_test": false,
"created_at": "2025-01-20T14:30:00+00:00",
"updated_at": "2025-01-20T16:45:00+00:00"
}
}
{
"message": "El campo events debe ser un arreglo.",
"code": 10001,
"code_name": "validation_error",
"errors": {
"events": ["El campo events debe ser un arreglo."]
}
}
{
"message": "Registro no encontrado, Webhook no existe",
"code": 10002,
"code_name": "record_not_found"
}