{
    "paths": {
        "/api/v1/stores/{storeId}/webhooks": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/StoreId"
                }
            ],
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get webhooks of a store",
                "description": "View webhooks of a store",
                "operationId": "Webhooks_GetWebhooks",
                "responses": {
                    "200": {
                        "description": "List of webhooks",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDataList"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The key is not found for this list of webhooks"
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            },
            "post": {
                "operationId": "Webhooks_CreateWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Create a new webhook",
                "description": "Create a new webhook",
                "requestBody": {
                    "x-name": "request",
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDataCreate"
                            }
                        }
                    },
                    "required": true,
                    "x-position": 1
                },
                "responses": {
                    "200": {
                        "description": "Information about the new webhook",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDataCreateResult"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "A list of errors that occurred when creating the webhook",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationProblemDetails"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        },
        "/api/v1/webhooks/{webhookId}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get a webhook",
                "description": "View webhook",
                "operationId": "Webhooks_GetWebhook",
                "responses": {
                    "200": {
                        "description": "A webhook",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookData"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The webhook has not been found"
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            },
            "put": {
                "operationId": "Webhooks_UpdateWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Update a webhook",
                "description": "Update a webhook",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDataUpdate"
                            }
                        }
                    },
                    "required": true,
                    "x-position": 1
                },
                "responses": {
                    "200": {
                        "description": "Information about the updated webhook",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookData"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "A list of errors that occurred when creating the webhook",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationProblemDetails"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            },
            "delete": {
                "operationId": "Webhooks_DeleteWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Delete a webhook",
                "description": "Delete a webhook",
                "responses": {
                    "200": {
                        "description": "The webhook has been deleted"
                    },
                    "404": {
                        "description": "The webhook does not exist"
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        },
        "/api/v1/webhooks/{webhookId}/deliveries": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "get": {
                "operationId": "Webhooks_GetWebhookDeliveries",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get latest deliveries",
                "description": "List the latest deliveries to the webhook, ordered from the most recent",
                "parameters": [
                    {
                        "name": "count",
                        "in": "query",
                        "description": "The number of latest deliveries to fetch",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of deliveries",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDeliveryList"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The key is not found for this list of deliveries"
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        },
        "/api/v1/webhooks/{webhookId}/deliveries/{deliveryId}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                },
                {
                    "$ref": "#/components/parameters/DeliveryId"
                }
            ],
            "get": {
                "operationId": "Webhooks_GetWebhookDelivery",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get a webhook delivery",
                "description": "Information about a webhook delivery",
                "responses": {
                    "200": {
                        "description": "Information about a delivery",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDeliveryData"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The delivery does not exist."
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        },
        "/api/v1/webhooks/{webhookId}/deliveries/{deliveryId}/request": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                },
                {
                    "$ref": "#/components/parameters/DeliveryId"
                }
            ],
            "get": {
                "operationId": "Webhooks_GetWebhookDeliveryRequests",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get the delivery's request",
                "description": "The delivery's JSON request sent to the endpoint",
                "responses": {
                    "200": {
                        "description": "The delivery's JSON Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The delivery does not exist."
                    },
                    "409": {
                        "description": "`webhookdelivery-pruned`: This webhook delivery has been pruned, so it can't be redelivered."
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        },
        "/api/v1/webhooks/{webhookId}/deliveries/{deliveryId}/redeliver": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                },
                {
                    "$ref": "#/components/parameters/DeliveryId"
                }
            ],
            "post": {
                "operationId": "Webhooks_RedeliverWebhookDelivery",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Redeliver the delivery",
                "description": "Redeliver the delivery",
                "responses": {
                    "200": {
                        "description": "The new delivery id being broadcasted. (Broadcast happens asynchronously with this call)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The delivery does not exist."
                    },
                    "409": {
                        "description": "`webhookdelivery-pruned`: This webhook delivery has been pruned, so it can't be redelivered."
                    }
                },
                "security": [
                    {
                        "API_Key": [
                            "btcpay.store.webhooks.canmodifywebhooks"
                        ],
                        "Basic": []
                    }
                ]
            }
        }
    },
    "components": {
        "parameters": {
            "WebhookId": {
                "name": "webhookId",
                "in": "path",
                "required": true,
                "description": "The webhook id",
                "schema": {
                    "type": "string"
                }
            },
            "DeliveryId": {
                "name": "deliveryId",
                "in": "path",
                "required": true,
                "description": "The id of the delivery",
                "schema": {
                    "type": "string"
                }
            }
        },
        "schemas": {
            "WebhookDeliveryList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/WebhookDeliveryData"
                }
            },
            "WebhookDeliveryData": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "The id of the delivery",
                        "nullable": false
                    },
                    "timestamp": {
                        "type": "number",
                        "nullable": false,
                        "description": "Timestamp of when the delivery should have been broadcasted",
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/UnixTimestamp"
                            }
                        ]
                    },
                    "deliveryTime": {
                        "type": "number",
                        "nullable": false,
                        "description": "Timestamp of when the delivery has actually been broadcasted. A delay with `timestamp` means your service either failed to process earlier deliveries or is taking too long to respond.",
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/UnixTimestamp"
                            }
                        ]
                    },
                    "httpCode": {
                        "type": "number",
                        "description": "HTTP code received by the remote service, if any.",
                        "nullable": true
                    },
                    "errorMessage": {
                        "type": "string",
                        "description": "User friendly error message, if any."
                    },
                    "status": {
                        "type": "string",
                        "description": "Whether the delivery failed or not (possible values are: `Failed`, `HttpError`, `HttpSuccess`)"
                    }
                }
            },
            "WebhookDataList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/WebhookData"
                }
            },
            "WebhookData": {
                "allOf": [
                    {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string",
                                "description": "The id of the webhook",
                                "nullable": false
                            }
                        }
                    },
                    {
                        "$ref": "#/components/schemas/WebhookDataBase"
                    }
                ]
            },
            "WebhookDataCreate": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookDataBase"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "secret": {
                                "type": "string",
                                "description": "Must be used by the callback receiver to ensure the delivery comes from BTCPay Server. BTCPay Server includes the `BTCPay-Sig` HTTP header, whose format is `sha256=HMAC256(UTF8(webhook's secret), body)`. The pattern to authenticate the webhook is similar to [how to secure webhooks in Github](https://docs.github.com/webhooks/securing/). If left out, null, or empty, the secret will be auto-generated.",
                                "nullable": true
                            }
                        }
                    }
                ]
            },
            "WebhookDataCreateResult": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookData"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "secret": {
                                "type": "string",
                                "description": "Must be used by the callback receiver to ensure the delivery comes from BTCPay Server. BTCPay Server includes the `BTCPay-Sig` HTTP header, whose format is `sha256=HMAC256(UTF8(webhook's secret), body)`. The pattern to authenticate the webhook is similar to [how to secure webhooks in Github](https://docs.github.com/webhooks/securing/). Value of the auto-generated or custom secret.",
                                "nullable": true
                            }
                        }
                    }
                ]
            },
            "WebhookDataUpdate": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookDataBase"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "secret": {
                                "type": "string",
                                "description": "Must be used by the callback receiver to ensure the delivery comes from BTCPay Server. BTCPay Server includes the `BTCPay-Sig` HTTP header, whose format is `sha256=HMAC256(UTF8(webhook's secret), body)`. The pattern to authenticate the webhook is similar to [how to secure webhooks in Github](https://docs.github.com/webhooks/securing/). If left out, null, or empty, the secret will not be changed.",
                                "nullable": true
                            }
                        }
                    }
                ]
            },
            "WebhookDataBase": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "enabled": {
                        "type": "boolean",
                        "description": "Whether this webhook is enabled or not",
                        "nullable": false,
                        "default": true
                    },
                    "automaticRedelivery": {
                        "type": "boolean",
                        "description": "If true, BTCPay Server will retry to redeliver any failed delivery after 10 seconds, 1 minutes and up to 6 times after 10 minutes.",
                        "nullable": false,
                        "default": true
                    },
                    "url": {
                        "type": "string",
                        "description": "The endpoint where BTCPay Server will make the POST request with the webhook body",
                        "nullable": false
                    },
                    "authorizedEvents": {
                        "type": "object",
                        "description": "Which event should be received by this endpoint",
                        "properties": {
                            "everything": {
                                "type": "boolean",
                                "description": "If true, the endpoint will receive all events related to the store.",
                                "nullable": false,
                                "default": true
                            },
                            "specificEvents": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "description": "If `everything` is false, the specific events that the endpoint is interested in. Current events are: `InvoiceCreated`, `InvoiceReceivedPayment`, `InvoiceProcessing`, `InvoiceExpired`, `InvoiceSettled`, `InvoiceInvalid`, `InvoicePaymentSettled`, `PaymentRequestCreated`, `PaymentRequestUpdated`, `PaymentRequestArchived`, `PaymentRequestStatusChanged`, `PayoutCreated`, `PayoutApproved`, `PayoutUpdated`, `SubscriberCreated`, `SubscriberCredited`, `SubscriberCharged`, `SubscriberActivated`, `SubscriberPhaseChanged`, `SubscriberDisabled`, `PaymentReminder`, `PlanStarted`, `SubscriberNeedUpgrade`.",
                                "nullable": false
                            }
                        }
                    }
                }
            },
            "WebhookEvent": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "deliveryId": {
                        "type": "string",
                        "nullable": false,
                        "description": "The delivery id of the webhook"
                    },
                    "webhookId": {
                        "type": "string",
                        "nullable": false,
                        "description": "The id of the webhook"
                    },
                    "originalDeliveryId": {
                        "type": "string",
                        "nullable": false,
                        "description": "If this delivery is a redelivery, the is the delivery id of the original delivery."
                    },
                    "isRedelivery": {
                        "type": "boolean",
                        "nullable": false,
                        "description": "True if this delivery is a redelivery"
                    },
                    "type": {
                        "type": "string",
                        "nullable": false,
                        "description": "The type of this event, current available are `InvoiceCreated`, `InvoiceReceivedPayment`, `InvoiceProcessing`, `InvoiceExpired`, `InvoiceSettled`, `InvoiceInvalid`, `InvoicePaymentSettled`, `PaymentRequestCreated`, `PaymentRequestUpdated`, `PaymentRequestArchived`, `PaymentRequestStatusChanged`, `PayoutCreated`, `PayoutApproved`, `PayoutUpdated`, `SubscriberCreated`, `SubscriberCredited`, `SubscriberCharged`, `SubscriberActivated`, `SubscriberPhaseChanged`, `SubscriberDisabled`, `PaymentReminder`, `PlanStarted`, and `SubscriberNeedUpgrade`."
                    },
                    "timestamp": {
                        "description": "The timestamp when this delivery has been created",
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/UnixTimestamp"
                            }
                        ]
                    }
                }
            },
            "WebhookInvoiceEvent": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "storeId": {
                                "type": "string",
                                "description": "The store id of the invoice's event",
                                "nullable": false,
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/StoreId"
                                    }
                                ]
                            },
                            "invoiceId": {
                                "type": "string",
                                "description": "The invoice id of the invoice's event",
                                "nullable": false
                            },
                            "metadata": {
                                "type": "object",
                                "description": "User-supplied metadata added to the invoice at the time of its creation",
                                "nullable": false
                            }
                        }
                    }
                ]
            },
            "WebhookInvoiceSettledEvent": {
                "description": "Callback sent if the `type` is `InvoiceSettled`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "manuallyMarked": {
                                "type": "boolean",
                                "description": "Whether the invoice has been manually marked as confirmed",
                                "nullable": false
                            }
                        }
                    },
                    {
                        "type": "object",
                        "properties": {
                            "overPaid": {
                                "type": "boolean",
                                "description": "Whether this invoice has received more money than expected",
                                "nullable": false
                            }
                        }
                    }
                ]
            },
            "WebhookInvoiceInvalidEvent": {
                "description": "Callback sent if the `type` is `InvoiceInvalid`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "manuallyMarked": {
                                "type": "boolean",
                                "description": "Whether the invoice has been manually marked as confirmed. If false, this invoice has received payments which could not confirm in time.",
                                "nullable": false
                            }
                        }
                    }
                ]
            },
            "WebhookInvoiceProcessingEvent": {
                "description": "Callback sent if the `type` is `InvoiceProcessing`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "overPaid": {
                                "type": "boolean",
                                "description": "Whether this invoice has received more money than expected",
                                "nullable": false
                            }
                        }
                    }
                ]
            },
            "WebhookInvoiceReceivedPaymentEvent": {
                "description": "Callback sent if the `type` is `InvoiceReceivedPayment`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "afterExpiration": {
                                "type": "boolean",
                                "description": "Whether this payment has been sent after expiration of the invoice",
                                "nullable": false
                            },
                            "paymentMethodId": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/PaymentMethodId"
                                    }
                                ],
                                "type": "string",
                                "description": "What payment method was used for this payment",
                                "nullable": false
                            },
                            "payment": {
                                "description": "Details about the payment",
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/Payment"
                                    }
                                ]
                            }
                        }
                    }
                ]
            },
            "WebhookInvoicePaymentSettledEvent": {
                "description": "Callback sent if the `type` is `InvoicePaymentSettled`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceReceivedPaymentEvent"
                    }
                ]
            },
            "WebhookInvoiceExpiredEvent": {
                "description": "Callback sent if the `type` is `InvoiceExpired`",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookInvoiceEvent"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "partiallyPaid": {
                                "type": "boolean",
                                "description": "Whether the invoice received some payments before being expired.",
                                "nullable": false
                            }
                        }
                    }
                ]
            }
        }
    },
    "x-webhooks": {
        "InvoiceCreated": {
            "post": {
                "operationId": "Webhook_InvoiceCreated",
                "summary": "InvoiceCreated",
                "description": "A new invoice has been created",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoiceExpired": {
            "post": {
                "operationId": "Webhook_InvoiceExpired",
                "summary": "InvoiceExpired",
                "description": "An invoice expired",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceExpiredEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoiceReceivedPayment": {
            "post": {
                "operationId": "Webhook_InvoiceReceivedPayment",
                "summary": "InvoiceReceivedPayment",
                "description": "An invoice received a payment",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceReceivedPaymentEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoicePaymentSettled": {
            "post": {
                "operationId": "Webhook_InvoicePaymentSettled",
                "summary": "InvoicePaymentSettled",
                "description": "A payment relating to an invoice has settled",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoicePaymentSettledEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoiceProcessing": {
            "post": {
                "operationId": "Webhook_InvoiceProcessing",
                "summary": "InvoiceProcessing",
                "description": "Triggers when an invoice is fully paid, but doesn't have the required amount of confirmations on the blockchain yet according to your store's settings.",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceProcessingEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoiceInvalid": {
            "post": {
                "operationId": "Webhook_InvoiceInvalid",
                "summary": "InvoiceInvalid",
                "description": "An invoice became invalid",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceInvalidEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "InvoiceSettled": {
            "post": {
                "operationId": "Webhook_InvoiceSettled",
                "summary": "InvoiceSettled",
                "description": "Triggers when an invoice is considered settled and the merchant can proceed with the order's delivery. The invoice now has enough confirmations on the blockchain (if paid on-chain) according to your store's configuration.",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInvoiceSettledEvent"
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PaymentRequestCreated": {
            "post": {
                "operationId": "Webhook_PaymentRequestCreated",
                "summary": "PaymentRequestCreated",
                "description": "A new payment request has been created",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paymentRequestId": {
                                        "type": "string",
                                        "description": "The id of the payment request",
                                        "nullable": false
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "Pending",
                                            "Completed",
                                            "Expired"
                                        ],
                                        "description": "The status of the payment request",
                                        "nullable": false
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PaymentRequestUpdated": {
            "post": {
                "operationId": "Webhook_PaymentRequestUpdated",
                "summary": "PaymentRequestUpdated",
                "description": "A payment request has been updated",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paymentRequestId": {
                                        "type": "string",
                                        "description": "The id of the payment request",
                                        "nullable": false
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "Pending",
                                            "Completed",
                                            "Expired"
                                        ],
                                        "description": "The status of the payment request",
                                        "nullable": false
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PaymentRequestArchived": {
            "post": {
                "operationId": "Webhook_PaymentRequestArchved",
                "summary": "PaymentRequestArchived",
                "description": "A payment request has been archived",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paymentRequestId": {
                                        "type": "string",
                                        "description": "The id of the payment request",
                                        "nullable": false
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "Pending",
                                            "Completed",
                                            "Expired"
                                        ],
                                        "description": "The status of the payment request",
                                        "nullable": false
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PaymentRequestStatusChanged": {
            "post": {
                "operationId": "Webhook_PaymentRequestStatusChanged",
                "summary": "PaymentRequestStatusChanged",
                "description": "A payment request has had its status changed",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paymentRequestId": {
                                        "type": "string",
                                        "description": "The id of the payment request",
                                        "nullable": false
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "Pending",
                                            "Completed",
                                            "Expired"
                                        ],
                                        "description": "The status of the payment request",
                                        "nullable": false
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PayoutCreated": {
            "post": {
                "operationId": "Webhook_PayoutCreated",
                "summary": "PayoutCreated",
                "description": "A payout has been created",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "payoutId": {
                                        "type": "string",
                                        "description": "The id of the payout",
                                        "nullable": false
                                    },
                                    "pullPaymentId": {
                                        "type": "string",
                                        "description": "The id of the pull payment this payout belongs to",
                                        "nullable": true
                                    },
                                    "payoutState": {
                                        "$ref": "#/components/schemas/PayoutState"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PayoutApproved": {
            "post": {
                "operationId": "Webhook_PayoutApproved",
                "summary": "PayoutApproved",
                "description": "A payout has been approved",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "payoutId": {
                                        "type": "string",
                                        "description": "The id of the payout",
                                        "nullable": false
                                    },
                                    "pullPaymentId": {
                                        "type": "string",
                                        "description": "The id of the pull payment this payout belongs to",
                                        "nullable": true
                                    },
                                    "payoutState": {
                                        "$ref": "#/components/schemas/PayoutState"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        },
        "PayoutUpdated": {
            "post": {
                "operationId": "Webhook_PayoutUpdated",
                "summary": "PayoutUpdated",
                "description": "A payout has been updated",
                "parameters": [
                    {
                        "in": "header",
                        "name": "BTCPay-Sig",
                        "required": true,
                        "description": "The HMAC of the body's byte with the secret's of the webhook. `sha256=HMAC256(UTF8(webhook's secret), body)`",
                        "schema": {
                            "type": "string",
                            "example": "sha256=b438519edde5c8144a4f9bcec51a9d346eca6506887c2ceeae1c0092884a97b9"
                        }
                    }
                ],
                "tags": [
                    "Webhooks"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "payoutId": {
                                        "type": "string",
                                        "description": "The id of the payout",
                                        "nullable": false
                                    },
                                    "pullPaymentId": {
                                        "type": "string",
                                        "description": "The id of the pull payment this payout belongs to",
                                        "nullable": true
                                    },
                                    "payoutState": {
                                        "$ref": "#/components/schemas/PayoutState"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "default": {
                        "description": "Unexpected error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Webhooks",
            "description": "Webhook operations"
        }
    ]
}
