rafiki icon indicating copy to clipboard operation
rafiki copied to clipboard

Discuss adding support for rejecting/completing an incoming payment to the Admin API

Open AlexLakatos opened this issue 3 years ago • 2 comments

AlexLakatos avatar Oct 03 '22 12:10 AlexLakatos

Completing an incoming payment is currently possible via Open Payments: https://docs.openpayments.guide/reference/complete-incoming-payment

Rejecting an incoming payment is indirectly possible when incoming payment grant authorization requires RO authorization:

  • https://github.com/interledger/rafiki/pull/588

wilsonianb avatar Oct 03 '22 13:10 wilsonianb

This issue is for the Admin API, so that the Incoming rafiki instance can early complete/reject a payment that was created by a 3rd party.

AlexLakatos avatar Oct 03 '22 15:10 AlexLakatos

This issue is for the Admin API, so that the Incoming rafiki instance can early complete/reject a payment that was created by a 3rd party.

This should not be limited to the incoming rafiki instance. Similar to the createReceiver mutation, we should be able to complete a incoming payment at a remote rafiki instance. Use case: whenever we are creating a fixed-send P2P payment, the incoming payment actually does not have an incoming amount, meaning, there isn't an easy way to trigger a completion of an incoming payment over the Admin API, and we have to rely on the Open Payments client or wait for the payment to expire. Instead, we should just have an API call happening in the outgoing-payment.completed webhook to complete the incoming payment.

mkurapov avatar Jul 03 '23 16:07 mkurapov

~Alternatively we could add a PATCH for the incoming payment to set an incoming amount after quote/outgoing payment creation or something. That way the sender can be explicit about whether they want to payment to finish exactly or not.~

We don't like this PATCH

mkurapov avatar Aug 08 '23 10:08 mkurapov

For completing: What if we had an Admin API endpoint that used Open Payments under the hood to complete incoming payments. Only clients that created an incoming payment can complete it via Open Payments. Hence, only incoming payments created by Rafiki itself can be completed by it, allowing for fast completion in the peer-to-peer use case. In contrast, we wouldn't accidentally complete incoming payments that may still be receiving in the future, like in the web monetization use case, because the extension (=client) created the incoming payment and Rafiki cannot complete it via OP.
ASEs would use this admin API endpoint when they receive the outgoing payment completed webhook.

sabineschaller avatar Nov 28 '23 16:11 sabineschaller