Adding very simple payment flow to NIP96

This commit is contained in:
Quentin 2024-06-29 10:24:24 +02:00
parent 346ecd1114
commit 32fde0b852

10
96.md
View File

@ -121,7 +121,7 @@ The `server` MUST link the user's `pubkey` string as the owner of the file so to
- `413 Payload Too Large`: File size exceeds limit
- `400 Bad Request`: Form data is invalid or not supported.
- `403 Forbidden`: User is not allowed to upload or the uploaded file hash didnt match the hash included in the `Authorization` header `payload` tag.
- `402 Payment Required`: Payment is required by the server, **this flow is undefined**.
- `402 Payment Required`: Payment is required by the server, see [Payment required](#payment-required) section.
The upload response is a json object as follows:
@ -133,6 +133,8 @@ The upload response is a json object as follows:
message: "Upload successful.",
// Optional. See "Delayed Processing" section
processing_url: "...",
// Optional. Required if payment is required
payment_request: "lnbc1...",
// This uses the NIP-94 event format but DO NOT need
// to fill some fields like "id", "pubkey", "created_at" and "sig"
//
@ -315,6 +317,12 @@ Example Response:
- `page` page number (`offset=page*count`)
- `count` number of items per page
## Payment required
`servers` may require payment for file storage. In that case, the server SHOULD serve the normal response with a **402 Payment Required** status code and a the `payment_request` field filled with a LN invoice.
Until the payment is done, the server SHOULD display a QR code in the url tag of the NIP-94 event response. When the payment is done, the server MUST swap the QR code for the uploaded file.
## Selecting a Server
Note: HTTP File Storage Server developers may skip this section. This is meant for client developers.