Restore Webhook Event

The Restore Webhook Event endpoint provides merchants with the ability to recover previously deleted webhook events. This functionality is crucial for scenarios where events may have been deleted accidentally or where historical event data is needed for auditing or troubleshooting purposes. Restoring a webhook event reinstates all associated data, making it available for retrieval and analysis once again.

Restoring deleted events can be particularly useful for compliance and record-keeping requirements. By bringing back events that were removed, merchants can ensure that their logs remain comprehensive and that no critical information is permanently lost. This capability adds an extra layer of security and flexibility to the webhook event management system, allowing merchants to correct mistakes and retain important data as needed.

PUT/webhooks/webhook_events/{id}/restore
Sandbox: https://api.payiano.dev/v1/webhooks/webhook_events/{id}/restore
Live: https://api.payiano.com/v1/webhooks/webhook_events/{id}/restore
Security
  • Authorization header with access token is required to access this endpoint: Bearer ACCESS-TOKEN
  • Your access token should be associated to this permission webhook_events_restore
Request
Request body schema:
application/json
Path parameters:
id
required
Type: ulid
Length: 26

The unique ID assigned to each webhook event which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every webhook event. This ULID is automatically created by our system and is used to uniquely identify and track each webhook event in our database.

Query parameters:
includes
Type: array_of_enums|null
Possible values:
[
"webhook_event.attempts_count", "webhook_event.failed_attempts_count", "webhook_event.success_attempts_count", "webhook_event.latest_attempt" ]

A list of additional webhook event relations to return, if available. Feel free to send the relations you would like to return with every item. See Including Resources to better understand how this is working.

Response
200
Response schema:
application/json
Response body:
webhook_event
Type: object

The webhook event model details.

id
Type: ulid
Length: 26

The unique ID assigned to each webhook event which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every webhook event. This ULID is automatically created by our system and is used to uniquely identify and track each webhook event in our database.

url
Type: url
Max: 1000

This attribute specifies the endpoint where the webhook notifications will be sent. It points to the server or service that will handle the incoming webhook requests allowing the merchant to handle these events programmatically.

type
Type: enum
Max: 1000
Possible values:
[
"payment_link.created", "checkout.created" ]

This attribute specifies the nature of the webhook event. It helps to identify the kind of event that triggered the webhook notification (e.g., payment_link.created, checkout.created). It categorizes the events for better organization and processing, enabling merchants to understand and handle different types of events ppropriately.

version
Type: enum
Possible values:
[
"v1" ]

This attribute specifies the version of the webhook event. This helps in identifying and managing different versions of events, ensuring compatibility and consistency in the handling of webhook notifications. Versions like v1, v2, etc., indicate updates or changes in the event structure or payload, allowing merchants to adapt to the latest event formats.

signature_secret
Type: string

This attribute holds the secret key used to generate the HMAC signature for the webhook event payload. This key is unique to each webhook URL and is used to ensure the integrity and authenticity of the webhook event. It should be kept private and secure and only known to the receiving server and authorized parties. This secret key is important for verifying that the payload has not been tampered with and that it indeed comes from Payiano. Please note this value is retrievable in the sandbox environment only, and it will be masked in the production environment.

details
Type: mixed

This attribute contains the payload associated with the webhook event. The structure and content of this data vary based on the type attribute, reflecting the specific details relevant to the event type (e.g., payment_link.created, checkout.created). This attribute provides the essential information needed to process and respond to the event appropriately.

attempts_count
Type: integer

This attribute shows the number of attempts associated with the webhook event.

failed_attempts_count
Type: integer

This attribute shows the number of failed attempts associated with the webhook event.

success_attempts_count
Type: integer

This attribute shows the number of success attempts associated with the webhook event.

latest_attempt
Type: object|null

The webhook event latest try model details.

id
Type: ulid
Length: 26

The unique ID assigned to each webhook event attempt which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every webhook event attempt. This ULID is automatically created by our system and is used to uniquely identify and track each webhook event attempt in our database.

request_body
Type: object

This attribute contains the original payload sent with the webhook event. It holds all the data included in the webhook notification, providing all the details necessary to understand and process the event. The structure of this attribute varies based on the webhook event type attribute, ensuring that all relevant information specific to the event type is included.

webhook_event
Type: object

The webhook event model basic details.

id
Type: ulid
Length: 26

The unique ID assigned to each webhook event which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every webhook event. This ULID is automatically created by our system and is used to uniquely identify and track each webhook event in our database.

type
Type: enum
Max: 1000
Possible values:
[
"payment_link.created", "checkout.created" ]

This attribute specifies the nature of the webhook event. It helps to identify the kind of event that triggered the webhook notification (e.g., payment_link.created, checkout.created). It categorizes the events for better organization and processing, enabling merchants to understand and handle different types of events ppropriately.

version
Type: enum
Possible values:
[
"v1" ]

This attribute specifies the version of the webhook event. This helps in identifying and managing different versions of events, ensuring compatibility and consistency in the handling of webhook notifications. Versions like v1, v2, etc., indicate updates or changes in the event structure or payload, allowing merchants to adapt to the latest event formats.

fired_at
Type: datetime

This attribute records the timestamp when the webhook event was triggered. It provides a precise log of when the webhook notification was sent, which is useful for tracking and debugging purposes. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

webhook_event_attempt
Type: object

The webhook event attempt model basic details.

id
Type: ulid
Length: 26

The unique ID assigned to each webhook event attempt which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every webhook event attempt. This ULID is automatically created by our system and is used to uniquely identify and track each webhook event attempt in our database.

sent_at
Type: datetime

This attribute records the exact timestamp when the webhook notification was sent. This timestamp helps in tracking the timing of the notification and correlating it with other events or logs. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

details
Type: mixed

This attribute holds the various details and information relevant to the event type. It encapsulates all the data required to understand and process the event, ensuring that the webhook endpoint receives comprehensive information.

request_headers
Type: object

This attribute contains the HTTP headers sent with the webhook event attempt request. It ensures that the receiving server has all the necessary information to correctly parse and validate the incoming webhook event.

Content-Type
Type: string

This header specifies the media type of the resource. It indicates that the payload is in JSON format. It's essential for the receiving server to correctly parse the JSON payload of the webhook event.

X-Payiano-Webhook-Event-Id
Type: string

This header contains a unique identifier for the webhook event. Each webhook request includes this header to help you track and correlate events in your system. The event ID is generated by Payiano and is unique to each webhook event, allowing for precise identification and troubleshooting. It can be used to verify the webhook signature using verify webhook signature endpoint.

X-Payiano-Webhook-Event-Attempt-Id
Type: string

This header contains a unique identifier for the specific attempt to deliver the webhook event. Since a webhook event can have multiple delivery attempts if the initial delivery fails, this ID helps to track each individual attempt. It can be used to verify the webhook signature using verify webhook signature endpoint.

X-Payiano-Webhook-Signature
Type: string

This header contains the HMAC signature of the webhook event. The signature is generated using a signature secret shared between Payiano and the merchant. It is used to verify the integrity and authenticity of the webhook event. The receiving server can use this signature to ensure that the payload has not been tampered with and that it indeed comes from Payiano.

response_time
Type: integer

This attribute indicates the duration, in milliseconds, that the webhook endpoint took to respond to the notification request. This metric helps in evaluating the performance and responsiveness of the webhook URL.

response_code
Type: integer

This attribute attribute records the HTTP status code returned by the webhook endpoint. It provides insight into the success or failure of the notification delivery (e.g., 200 for success, 404 for not found, 500 for server error).

response_body
Type: mixed|null

This attribute contains the actual content returned by the webhook endpoint. This can include any data or message provided by the server, which can be useful for debugging and validation purposes. To manage storage efficiently and maintain performance, the response body is truncated to a maximum of 5000 characters. This ensures that excessively large responses do not impact the system's performance or storage capacity.

response_headers
Type: mixed|null

This attribute contains the HTTP headers returned by the webhook endpoint. These headers can provide additional context about the response, such as content type, server details, and caching information.

is_error
Type: boolean

This attribute indicates whether the webhook notification failed to be delivered or processed correctly. It will be true if the response code is 400 or higher, indicating an error, and false otherwise.

is_success
Type: boolean

This attribute indicates whether the webhook notification was successfully delivered and processed. It will be true if the response code is in the range of 2xx indicating success, and false otherwise.

webhook_event_id
Type: ulid

This attribute serves as a foreign key linking the try to the corresponding webhook event model. This association ensures referential integrity and allows for precise tracking and correlation of the notification with its originating event.

sent_at
Type: datetime

This attribute records the exact timestamp when the webhook notification was sent. This timestamp helps in tracking the timing of the notification and correlating it with other events or logs. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

created_at
Type: datetime

The created datetime of the webhook event attempt. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

updated_at
Type: datetime

The updated datetime of the webhook event attempt. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

is_deleted
Type: boolean
Default: false

This value indicates whether the webhook event is deleted or not. This flag can be used to control the webhook event's availability in runtime without actual deleting or removing the webhook event from records. A true value means the webhook event is deleted, while a false value implies that the webhook event is not deleted and functioning.

fired_at
Type: datetime

This attribute records the timestamp when the webhook event was triggered. It provides a precise log of when the webhook notification was sent, which is useful for tracking and debugging purposes. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

created_at
Type: datetime

The created datetime of the webhook event. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

updated_at
Type: datetime

The updated datetime of the webhook event. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

deleted_at
Type: datetime|null

The deleted datetime of the webhook event. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

Response sample:
1
{
2
"webhook_event": {
3 "id": "01j3521znn3b6wderr4vbyq18n", 4 "url": "https://api.pyngy.dev/webhook/payment", 5 "type": "payment_link.created", 6 "version": "v1", 7 "signature_secret": "OWlPF9plag9KEtYvw3EM+7UDrgXb84xjZPR2TvzJM1I=", 8
"details": {
9
"data": {
10
"payment_link": {
11 "id": "01hqjmrh1hjg315bhnytk0k7ne", 12 "title": "Office accessories for Gawaab corporate", 13
"payment_details": {
14 "currency_code": "EGP", 15 "amount": 1000, 16 "tax_strategy": null, 17 "exclusive_tax_amount": 140, 18 "inclusive_tax_amount": 100, 19 "total_tax_amount": 240, 20 "amount_after_tax": 1140, 21 "total_amount": 1140, 22 "paid_amount": 0, 23 "remaining_amount": 1140, 24 "status": "UNPAID", 25 "is_completed": false, 26 "paid_at": null 27 }, 28 "reference_id": "e07ac088-4cb3-3797-bfae-bc4ddca71648", 29 "customer_id": "01hqjp3f48879znt9v4dysrk2r", 30 "description": "Stylish, comfortable sofas, modern furniture, whiteboards and desks.", 31 "due_date": "2023-12-20", 32 "expires_at": "1722572118554", 33 "created_at": "1722572118554", 34 "updated_at": "1722572118554" 35 } 36 } 37 }, 38 "attempts_count": 1, 39 "failed_attempts_count": 0, 40 "success_attempts_count": 1, 41
"latest_attempt": {
42 "id": "01j354j6nkwh3mdvhs6dsmswt8", 43
"request_body": {
44
"webhook_event": {
45 "id": "01j3521znn3b6wderr4vbyq18n", 46 "type": "payment_link.created", 47 "version": "v1", 48 "fired_at": "1722572118554" 49 }, 50
"webhook_event_attempt": {
51 "id": "01j354j6nkwh3mdvhs6dsmswt8", 52 "sent_at": "1722572118554" 53 }, 54
"details": {
55
"data": {
56
"payment_link": {
57 "id": "01hqjmrh1hjg315bhnytk0k7ne", 58 "title": "Office accessories for Gawaab corporate", 59
"payment_details": {
60 "currency_code": "EGP", 61 "amount": 1000, 62 "tax_strategy": null, 63 "exclusive_tax_amount": 140, 64 "inclusive_tax_amount": 100, 65 "total_tax_amount": 240, 66 "amount_after_tax": 1140, 67 "total_amount": 1140, 68 "paid_amount": 0, 69 "remaining_amount": 1140, 70 "status": "UNPAID", 71 "is_completed": false, 72 "paid_at": null 73 }, 74 "reference_id": "e07ac088-4cb3-3797-bfae-bc4ddca71648", 75 "customer_id": "01hqjp3f48879znt9v4dysrk2r", 76 "description": "Stylish, comfortable sofas, modern furniture, whiteboards and desks.", 77 "due_date": "2023-12-20", 78 "expires_at": "1722572118554", 79 "created_at": "1722572118554", 80 "updated_at": "1722572118554" 81 } 82 } 83 } 84 }, 85
"request_headers": {
86 "Content-Type": "application/json", 87 "X-Payiano-Webhook-Event-Id": "01j3521znn3b6wderr4vbyq18n", 88 "X-Payiano-Webhook-Event-Attempt-Id": "01j354j6nkwh3mdvhs6dsmswt8", 89 "X-Payiano-Webhook-Signature": "b3924d021e7f092c06a03c1309a12fad5e56c78381229c8cabb4a4335e6c1a18" 90 }, 91 "response_time": 25, 92 "response_code": 200, 93
"response_body": {
94 "message": "OK" 95 }, 96
"response_headers": {
97
"Content-Type": [
98 "application/json" 99 ] 100 }, 101 "is_error": true, 102 "is_success": false, 103 "webhook_event_id": "01j3521znn3b6wderr4vbyq18n", 104 "sent_at": "1722572118554", 105 "created_at": "1722572118554", 106 "updated_at": "1722572118554" 107 }, 108 "is_deleted": false, 109 "fired_at": "1722572118554", 110 "created_at": "1722572118554", 111 "updated_at": "1722572118554", 112 "deleted_at": null 113 } 114}