Girar segredo
curl --request POST \
--url https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_in": 43200
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_in: 43200})
};
fetch('https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret"
payload = { "expires_in": 43200 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "webhook_endpoint",
"livemode": true,
"url": "<string>",
"events": [
"transaction.paid"
],
"status": "enabled",
"previous_secret_expires_at": "<string>",
"created_at": "<string>",
"secret": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Webhooks
Girar segredo
Gera um segredo novo. Enquanto o anterior vale, Pagstack-Signature leva as duas assinaturas: t=...,v1=<novo>,v1=<anterior>. Aceite a requisição se qualquer v1 conferir.
Girar segredo
curl --request POST \
--url https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_in": 43200
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_in: 43200})
};
fetch('https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/webhook-endpoints/{id}/rotate-secret"
payload = { "expires_in": 43200 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "webhook_endpoint",
"livemode": true,
"url": "<string>",
"events": [
"transaction.paid"
],
"status": "enabled",
"previous_secret_expires_at": "<string>",
"created_at": "<string>",
"secret": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Autorizações
Cabeçalhos
Corpo
application/json
Resposta
Sucesso.
Webhook: URL que recebe os eventos da conta.
Eventos assinados. Lista vazia recebe todos.
Opções disponíveis:
transaction.paid, transaction.expired, transaction.canceled, transaction.refunded, transaction.disputed, transaction.dispute_released, checkout.completed, checkout.expired, withdrawal.completed, withdrawal.failed, subscription.created, subscription.renewed, subscription.past_due, subscription.canceled