curl --request PUT \
--url https://api.onepay.la/v1/webhooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"url": "<string>",
"events": [
{}
]
}
'{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Notificaciones Actualizadas",
"description": "Nueva descripción del webhook",
"url": "https://nuevo-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"payment.rejected",
"payment.expired"
],
"header": "wh_hdr_abc123...",
"is_test": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-02-09T16:20:00Z"
}
}
curl --request PUT \
--url https://api.onepay.la/v1/webhooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"url": "<string>",
"events": [
{}
]
}
'{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Notificaciones Actualizadas",
"description": "Nueva descripción del webhook",
"url": "https://nuevo-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"payment.rejected",
"payment.expired"
],
"header": "wh_hdr_abc123...",
"is_test": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-02-09T16:20:00Z"
}
}
null para eliminar la descripción.payment.created - Cobro creadopayment.approved - Cobro aprobadopayment.rejected - Cobro rechazadopayment.expired - Cobro expiradocharge.created - Cargo creadocharge.succeeded - Cargo exitosocharge.failed - Cargo fallidocashout.created - Dispersión creadacashout.approved - Dispersión aprobadacashout.rejected - Dispersión rechazadasubscription.created - Suscripción creadasubscription.active - Suscripción activasubscription.cancelled - Suscripción canceladaaccount.validated - Cuenta validadaaccount.failed - Validación de cuenta fallidaShow Propiedades del webhook
# Actualización completa
curl https://api.onepay.la/v1/webhooks/550e8400-e29b-41d4-a716-446655440000 \
-X PUT \
-H "Authorization: Bearer sk_test_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Notificaciones Actualizadas",
"description": "Nueva descripción del webhook",
"url": "https://nuevo-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"payment.rejected",
"payment.expired"
]
}'
# Actualización parcial (solo nombre)
curl https://api.onepay.la/v1/webhooks/550e8400-e29b-41d4-a716-446655440000 \
-X PUT \
-H "Authorization: Bearer sk_test_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Nuevo Nombre del Webhook"
}'
import fetch from 'node-fetch';
const webhookId = '550e8400-e29b-41d4-a716-446655440000';
// Actualización completa
const body = {
name: 'Notificaciones Actualizadas',
description: 'Nueva descripción del webhook',
url: 'https://nuevo-servidor.com/webhooks/onepay',
events: [
'payment.approved',
'payment.rejected',
'payment.expired'
]
};
const response = await fetch(`https://api.onepay.la/v1/webhooks/${webhookId}`, {
method: 'PUT',
headers: {
Authorization: 'Bearer sk_test_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
const data = await response.json();
console.log(data);
// Actualización parcial (solo URL)
const partialUpdate = {
url: 'https://nuevo-servidor.com/webhooks/onepay'
};
const response = await fetch(`https://api.onepay.la/v1/webhooks/${webhookId}`, {
method: 'PUT',
headers: {
Authorization: 'Bearer sk_test_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify(partialUpdate)
});
import requests
webhook_id = '550e8400-e29b-41d4-a716-446655440000'
# Actualización completa
body = {
'name': 'Notificaciones Actualizadas',
'description': 'Nueva descripción del webhook',
'url': 'https://nuevo-servidor.com/webhooks/onepay',
'events': [
'payment.approved',
'payment.rejected',
'payment.expired'
]
}
headers = {
'Authorization': 'Bearer sk_test_xxx',
'Content-Type': 'application/json'
}
response = requests.put(
f'https://api.onepay.la/v1/webhooks/{webhook_id}',
json=body,
headers=headers
)
data = response.json()
print(data)
# Actualización parcial (solo eventos)
partial_update = {
'events': ['charge.paid', 'charge.failed']
}
response = requests.put(
f'https://api.onepay.la/v1/webhooks/{webhook_id}',
json=partial_update,
headers=headers
)
{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Notificaciones Actualizadas",
"description": "Nueva descripción del webhook",
"url": "https://nuevo-servidor.com/webhooks/onepay",
"events": [
"payment.approved",
"payment.rejected",
"payment.expired"
],
"header": "wh_hdr_abc123...",
"is_test": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-02-09T16:20:00Z"
}
}
Was this page helpful?