Let receivers pay transaction fees I want my customers to pay transaction fees. The only helpful but incomplete answer I have found so far is from here:


  You can create a transaction which spends the output to yourself, attaching a fee to that transaction. In order for miners to grab the transaction fee on that transaction, they would have to also mine the original transaction.


I have some experience of calling bitcoind methods using JSON. With these assumptions:

my account: "my"
receiver's address: "123..zyz"
coins to be sent: 0.001
transaction fee: (unpredictable)


my customer will receive 0.0008 coins if the transaction fee is 0.0002 in this case.

Am I supposed to first call method sendfrom like below?

sendfrom("my","123..zyz",0.001)

Then how do I determine the transaction fee? How do I charge the transaction fee to the receiver?
Would kind soul please provide me the detail answer with complete list of calls to Original Bitcoin client/API calls?
For precise calculations consider using raw transactions. Then you have to decide how this transaction fee will be calculated. For single output transactions it's clear, you deduct the tx fee from the receiving amount, although for some micro-payments this is not possible as the tx fee might be bigger than the actual payout amount. Batching your outgoing payments (pay many outputs in a single tx) will help reduce the transaction fees for your customers but in this case you have to decide who pays what. The tx fee is what is left if you deduct your outputs total amount (change included in that) from your inputs total amount. You can also chose to charge a flat fee per tx which is less precise but more transparent for your clients and easier for your calculations.