Blog / Cases of split payment

Example with splitting to exact amounts:

The Store pays a fixed amount of 0.2 BTC to Referral, 0.3 BTC for Delivery, 1.5 BTC hold for future in Cold Storage and rest keep in Business.

{
   "callback":{
	  "url":"http://example.com/callback",
	  "data":{
		 "secret":"7j0ap91o99cxj8k9"
	  }
   },
   "destinations":[
	  {"address": "1apiKcJM95jENZeom2dQo8ShK7dUQkRaS", "amount":  20000000},
	  {"address": "1apimr7q2cL3xPma8SfiDPyTdWSHXSEyB", "amount":  30000000},
	  {"address": "1ApiwpetcWnBbkpU7cb7biPfc6Tiucasf8", "amount": 150000000},
	  {"address": "1Api8ZyHPp4f1QNTsi3AGyXbaTnzzAuDez"}
   ]
}

The Buyer pays for order 10 BTC.

Case: paid less. If the Buyer pays 1 BTC only, then the amount will be split to 0.2, 0.3 and rest 1 - 0.5 = 0.5 will be sent to Cold Storage. The Business address will not receive anything because not enough amount to transfer.

Case: paid enough. The Store receives notification about payment and arrived amount split to specified amounts for different Bitcoin addresses: 0.2, 0.3, 1.5 and rest 10 - 2 = 8 BTC goes to business.

Case: overpaid. The last address (without amount) in the list will receive the rest amount.

Network fee and service fee will be deducted from the last address. It this case deduct from a Business part.

Example with splitting by percent:

Let's imagine that you are The Exchanger. You would like to cut 20 percents to Hot Wallet (for future fast payout to customers), 30 percents for the Management or arbitrage, and 50 percents to a safe place - Cold Storage.

{
   "callback":{
	  "url":"http://example.com/callback",
	  "data":{
		 "secret":"7j0ap91o99cxj8k9"
	  }
   },
   "destinations":[
	  {"address": "1apiKcJM95jENZeom2dQo8ShK7dUQkRaS", "amount": "20%"},
	  {"address": "1apimr7q2cL3xPma8SfiDPyTdWSHXSEyB", "amount": "30%"},
	  {"address": "1ApiwpetcWnBbkpU7cb7biPfc6Tiucasf8"}
   ]
}

The order of addresses in the list does not matter. The total sum must be 100 percents.
Whole income payment is divided into these three addresses proportionally.
Network fee and transaction fee will be deducted first.