1

I understand this is all new and still very early but I'm wondering if more advanced payment integration is possible. I went through the example of accepting payments, but I have an app releasing soon where I charge the customer through credit card only after my service takes place.

I'm able to place a hold on their credit card for x amount and then their order is sent to my server if there's enough funds. After service is done, I replace the hold on their credit card with variables on what happened during the service(ex: An Uber driver driving 8 miles is going to charge the customer less than driving 20 miles). Am I able to replicate this kind of flow with Cardano? I'm a holder and was hoping this flow was possible with the blockchain. Again, I understand this is still early but I would love to have Cardano integrated with my app if possible.

I'm bound by the rules that:

  1. Crypto transactions cannot be changed once sent(See my post number 2, my app changing the credit card hold after service is complete )

  2. If I refund their ADA because they aren't able to find a service provider, they'll incur fees from transferring so it isn't an option for them to send ADA first and then have the rest of the app run. My service has to complete before they make a transaction

Is this where smart contracts come in/is the only option? Thanks

Example from website: https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-cli/

3 Answers 3

1

my two cents, so if I am correct you want that a party can commit to paying and have the ability to cancel the service (and thus payment) without inflicting fee's. Possibly you also would want an expiration on the possible transaction. I think something like this is possible right now without any loss of control over funds. To understand the solution we will need some introduction to some technical insides of Cardano.

What is money on Cardano and how is represented account wise? Ada is best represented as cash. Where you might have a real wallet with a 10 and 5 dollar bill you might have a Cardano wallet containing 10 and 5 ada, each separate from each other. Each of these 'bills' we call an UTxO (unspent transaction output). For each transaction you combine bills into one big pot and redistribute them how you would like, the 10 + 5 bills might become 8 and 7 bills (minus fees which I omit). One property that UTxO's have is that they can only be spend once!

How are UTxO's spent? At its root UTxO's are locked by a signature, that is deduced from some seed phrase in a Cardano wallet. This means that to spend an UTxO the owner of it has to see how that money is spend and sign for it. Note that this can be done without settling the transaction indefinitely. This because a valid signature on a transaction does not mean that these two pieces of information are send to the blockchain. In theory one can calculate these signatures with pen and paper. Only when these two are send to a validating node that checks that the signature is correct it becomes immutable.

So what to do? For your app you let the counter party generate a transaction that pays you the amount for the service and sign it. Now neither one of you sends this to the blockchain for settlement. You hold on to it and while you are providing your service you constantly check whether the UTxO('s) in that transaction are not being spend, if so you need to regain a valid transaction with signature. If the service is provided and you want to cash your payment you send the initial transaction to the chain to become permanent. If for some reason you want to abort the payment, just trow away the signed transaction. This inflicts no costs. It is also advisable to set an expiration date on the transaction, to make the transaction invalid after some time.

Now note that discrete predetermined partial payments are also possible since the counter party can generate not 1 but many versions of the first transaction. They can give you the right to claim 10%, 20%,... 100% of the agreed funds once.

Hope this helps, looking forward to your app :)

0

There is NFT minting transactions where you send a certain amount and the other party decides what to send back. I would think this would be equivalent to gas station putting 100 hold till after gas pump the returns the remaining. Clunky but that's closest thing I can think of.

0

There's no way of saving the user from paying fees. What you could do, is to refund the full amount and the fee from your company's own pocket when refunding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.