NFT-Worlds / WRLD-Payments-API

https://www.nftworlds.com/
GNU Affero General Public License v3.0
12 stars 14 forks source link

Provide A Way To Handle Duplicate Pay Transactions #11

Closed iamarkdev closed 2 years ago

iamarkdev commented 2 years ago

Right now, if you pay a payment request, if you were to pay it again the payment goes through but the request doesn't get fulfilled a second time, causing a lost payment for the sender.

There are cases where shops/stores in game may want a payment request to be able to be paid more than once.

For these situations, we could do something where in the wrld-payments-api, by default payment requests are 1 time pay, but an optional flag for a payment request could be set to allow unlimited payments, each payment re-fulfilling the same purchase. For example if you want to purchase an Apple from a shop, and pay it, and then pay it again - you'd receive a net 2 apples instead of just 1 apple and a second lost payment as a player.

The UI on the nftworlds.com/pay page has been update already to allow a duplicate query parameter to be set with the ref query parameter.

If a ref (Reference id of the tx) is set AND duplicate is set to 1 or true in the query string, the payments for will show a "Purchase Again" button after finishing a payment, allowing the user to repeat the pay process on the same payment req that is setup to allow duplicate payments.

jacobp925 commented 2 years ago

Added in https://github.com/NFT-Worlds/WRLD-Payments-API/commit/2b120bc84677a63d261ecf01a8b8af0be75bf9bb