DASH PAY FEATURE (RPC: dashpay dash_address dash_amount mode)
The DashPay feature is designed to allow a BiblePay user to leverage all of the use cases that Dash currently has: Gift cards, storefronts, physical items, bill payments online, etc.
The idea is to facilitate the payment of an item that is priced in DASH with payment made in BiblePay, instantly, by leveraging instantsend (on both ends).
Example: The user finds a gift card on 'bitrefill.com' for $10.00. The gift card can only be purchased with DASH (or USD or a top 5 crypto). The User goes to the checkout and selects DASH for payment. The checkout cart quotes a DASH address and a DASH AMOUNT. Using BiblePay's 'dashpay' feature, you can complete the purchase in less than one minute!
Step by Step Example
Navigate to www.bitrefill.com. Browse Products. Search for Walmart. Select the Walmart card.
Change the Amount to Buy to : $5.00
Click Add to cart | Check out | DASH
The page is asking the user to send .132461 DASH to XnPnFn6JGtwKrjkQsBF5YTBcp3RSa7SMtC
You now have 15 minutes to do this.
From BiblePay, click Tools | RPC. From there type:
dashpay XnPnFn6JGtwKrjkQsBF5YTBcp3RSa7SMtC .132461 0
(The zero means Test Mode). Click <ENTER>.
Verify that the quoted quantity of BBP for this $5 purchase satisfies your purchasing power, then when you are happy, type:
dashpay XnPnFn6JGtwKrjkQsBF5YTBcp3RSa7SMtC .132461 1
(The one means Spend Mode). Click <ENTER> if you approve.
At this point the wallet will spend the quoted amount of BBP for this purchase.
One of two things will happen: If the IX lock succeeds in locking your transaction, and, the Dash lock succeeds, your transaction will be funded Instantly, meaning you will see the website update that payment has been received and the transaction will continue.
NOTE: Most likely the transaction will succeed. If the transaction succeeds, you will immediately see the DASH transaction ID in the RPC. You can track this using the dash explorer, if necessary (https://chainz.cryptoid.info/dash/).
(Alternatively, if one of the locks fails, which can happen in rare cases such as sanctuary congestion or if Dash masternode congestion, have no fear, the BBP will be refunded to you after 3 confirmations. You can type trackdashpay bbp_txid to find out what happened in this case.)
The transfer from chain to chain is accomplished by sending the BBP as an instantsend transaction, then monitoring the transaction ID for locks. Once it is locked, we ask a DASH node to lock the denominated DASH amount in an outbound transaction. Once this occurs the transaction is marked as "IX" and completed normally. If any of this fails, the transaction is queued as a normal relay transaction (but is eventually sent to the dash recipient or refunded back to the user).
In the current state, Delayed/Queued transactions complete after two confirms (and we currently refund the BBP back to the sender). (The current logic is it is safer to refund it in case the user was waiting for a time locked DASH transaction, we would rather not risk sending the DASH late, for example, if blocks are confirming very slowly due to high difficulty).