From 32fde0b8527c9ec75bddccc676986afeeecea649 Mon Sep 17 00:00:00 2001 From: Quentin Date: Sat, 29 Jun 2024 10:24:24 +0200 Subject: [PATCH] Adding very simple payment flow to NIP96 --- 96.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/96.md b/96.md index 2f253516..a924f564 100644 --- a/96.md +++ b/96.md @@ -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.