open-payments icon indicating copy to clipboard operation
open-payments copied to clipboard

Return the remaining balance on the outgoing payment grant during outgoing payment creation

Open mkurapov opened this issue 9 months ago • 0 comments

Context

For the web monetization extension (and very likely other use cases), we should know how much has already been spent on the outgoing payment grant.

Whenever we create an outgoing payment, we determine whether the amount for the payment fits within the limits of the issued outgoing payment grant (by summing up all of the other payment that have been created under that said grant). If not, we reject the payment, otherwise, we create it. This accounting is done in the Open Payment resource server because that is where all of the outgoing payments are stored. We can return these amounts as part of the outgoing payment creation response.

Todos

  • [ ] Update the RS OpenAPI spec to return grantSpentDebitAmount: Amount and grantSpentReceiveAmount: Amount in the outgoing payment creation response

mkurapov avatar Apr 30 '24 10:04 mkurapov