error handling 402->400. Special note for Head requests

This commit is contained in:
Quentin 2024-11-20 21:22:20 +01:00
parent 73fcfbfbd3
commit 463f28da7b
1 changed files with 5 additions and 1 deletions

View File

@ -85,6 +85,10 @@ Example for Lightning:
X-Lightning: "966fcb8f153339372f9a187f725384ff4ceae0047c25b9ce607488d7c7e93bba"
```
**Special Note on HEAD Requests**
The HEAD endpoints are only used to retrieve blob or server information. They MUST NOT be retried with payment proof. Instead, clients should complete the payment and proceed with the `PUT` or `GET` request.
### Recurring Payments
Servers MAY accept recurring payments for blob storage using the following Nostr event types:
@ -99,7 +103,7 @@ The event MUST include a custom `x` tag containing the hash of the blob being pa
### Error handling
If the client fails to provide the payment proof (expired invoice, invalid token, etc.) the server MUST respond with **402 Payment Required** status code and include the relevant `X-{payment_method}` header(s) with updated payment details.
If the client fails to provide the payment proof (expired invoice, invalid token, etc.) the server MUST respond with **400 Bad request** status code and include a `X-Reason` header with a human-readable message. The client SHOULD inform the user about the error and provide a way to retry the request.
### Extending with Future Payment Methods