nips icon indicating copy to clipboard operation
nips copied to clipboard

NIP-89 payto: Payment Targets

Open ATXMJ opened this issue 2 years ago • 5 comments

Bitcoin Lightning tipping/payments has obviously become very popular, and has been implemented by many of the nostr clients, but we should probably devise a NIP for generalized payment/tip protocol support

Possibly a profile field for a user-defined deep link protocol URI?

I'm new to this protocol, and not sure exactly what the best approach would be, or how to propose it from a technical standpoint, but eager to help in any way I can

ATXMJ avatar Feb 02 '23 21:02 ATXMJ

RFC8905, also known as payto: URLs seem like it would be a good candidate. This can handle payments to IBANs and Bitcoin addresses.

gkbrk avatar Feb 06 '23 18:02 gkbrk

@gkbrk RFC8905 looks very promising!

Do you have any suggestions for what a NIP to standardize around it might look like?

ATXMJ avatar Feb 14 '23 01:02 ATXMJ

NIP 57 has been merged? I think that covers this

benthecarman avatar Feb 15 '23 05:02 benthecarman

@benthecarman NIP 57 is only for Lightning Network transactions. This proposal will enable compatibility with the universal payto: URI scheme

ATXMJ avatar Feb 15 '23 23:02 ATXMJ

NIP-89

payto: Payment Targets

draft optional author:atxmj

On events of kind 0 (set_metadata) one can specify the key "nip89" with a value consisting of a list (one or many) of "payment targets" as partial RFC-8905 (payto:) URIs, each in the format of <payment_target_type>/<authority>, containing the payment target type and authority components for a payto: payment invocation URI as defined in the RFC-8905 specification.

For each value in the list, the client should validate the syntax, and if valid, assemble a full payto:// deep link URI and render it as a button or link in the user's profile in the format of payto://<payment_target_type>/<authority>.

A generic "payment" icon should be used as the button icon. If desired, a client may use a list of recognized payment target types, and use a stylized/iconized version of the target type for the button or link.

If a user has specified multiple payment targets, the client may choose to render multiple buttons/links, or render a dropdown to select the payment target of choice.

Example for a single payment target

If a client sees an event like this:

{
  "pubkey": "afc93622eb4d79c0fb75e56e0c14553f7214b0a466abeba14cb38968c6755e6a",
  "kind": 0,
  "content": "{\"nip89\": [\"xbt/bc1qxq66e0t8d7ugdecwnmv58e90tpry23nc84pg9k\"]}"
  ...
}

it will validate the payment target syntax, and if valid, assemble a deep link payment invocation URI as

payto://bitcoin/bc1qxq66e0t8d7ugdecwnmv58e90tpry23nc84pg9k

and embed that in the user's profile as a clickable button or link with a generic payment/tip icon or text, or a stylized/iconized button or link for the Bitcoin payment target type.

Example for a multiple payment targets

If a client sees an event like this:

{
  "pubkey": "afc93622eb4d79c0fb75e56e0c14553f7214b0a466abeba14cb38968c6755e6a",
  "kind": 0,
  "content": "{\"nip89\": [\"xbt/bc1qxq66e0t8d7ugdecwnmv58e90tpry23nc84pg9k\", \"nano/nano_1dctqbmqxfppo9pswbm6kg9d4s4mbraqn8i4m7ob9gnzz91aurmuho48jx3c\"]}"
  ...
}

for each payment target, it will validate the syntax, and if valid assemble a deep link payment invocation URI as

payto://bitcoin/bc1qxq66e0t8d7ugdecwnmv58e90tpry23nc84pg9k and payto://nano/nano_1dctqbmqxfppo9pswbm6kg9d4s4mbraqn8i4m7ob9gnzz91aurmuho48jx3c

and embed them in the user's profile as multiple clickable buttons or links, or as a dropdown selector for the payment target with a button with a generic payment/tip icon or text, or a stylized/iconized button or link for the corresponding Bitcoin and Nano payment target types.

ATXMJ avatar Feb 16 '23 00:02 ATXMJ

Conversation moved to https://github.com/nostr-protocol/nips/pull/262

ATXMJ avatar Feb 16 '23 23:02 ATXMJ