Criar webhook
curl --request POST \
--url https://api.pagstack.com/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": []
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: []})
};
fetch('https://api.pagstack.com/v1/webhook-endpoints', 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"
payload = {
"url": "<string>",
"events": []
}
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>"
}
}Webhooks
Criar webhook
Cadastra uma URL HTTPS pública para receber eventos. O segredo para validar a assinatura aparece só nesta resposta.
Criar webhook
curl --request POST \
--url https://api.pagstack.com/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": []
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: []})
};
fetch('https://api.pagstack.com/v1/webhook-endpoints', 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"
payload = {
"url": "<string>",
"events": []
}
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>"
}
}Autorizações
Cabeçalhos
Corpo
application/json
Eventos a receber. Sem a lista, recebe todos.
Maximum array length:
17Opções disponíveis:
transaction.paid, transaction.expired, transaction.canceled, transaction.refunded, transaction.disputed, transaction.dispute_released, checkout.completed, checkout.expired, withdrawal.completed, withdrawal.failed, transfer.completed, bill_payment.completed, conversion.completed, subscription.created, subscription.renewed, subscription.past_due, subscription.canceled 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