Separate Charges and Transfers は機能ではなくて、支払いと分配のアプローチだ。Platform Account で支払いを受けた後で、明示的に Connected Account に分配する API を呼び出す。このアプローチは、ひとつの支払いに対して、複数の Connected Account に分配できる。
基本的な呼び出し
データモデルと資金フローを見るために、シンプルな呼び出しを例にする。まず、普通に支払いを処理する。
curl https://api.stripe.com/v1/payment_intents \
-d amount=1000 \
-d "expand[]"="charges.data.balance_transaction" \
...
});
{
"id": "pi_xxxx", 👈
"charges": {
"data": [
{
"id": "ch_xxxx",
"amount": 1000,
"balance_transaction": {
"id": "txn_xxxx",
"amount": 1000,
"fee": 36,
"net": 964,
...
},
...
}
]
}
}
次に、Connected Account に資金を分配する。
curl https://api.stripe.com/v1/transfers \
-d amount=800 \
-d destination=acct_xxxx \
-d "expand[]"="balance_transaction" \
-d "expand[]"="destination_payment.balance_transaction" \
...
});
{
"id": "tr_xxxx", ⬅️
"amount": 800,
"balance_transaction": {
"id": "txn_xxxx",
"amount": -800,
"fee": 0,
"net": -800,
...
},
"destination": "acct_xxxx",
"destination_payment": {
"id": "py_xxxx", ⏪
"amount": 800,
"balance_transaction": {
"id": "txn_xxxx",
"amount": 800,
"fee": 0,
"net": 800,
...
},
...
}
...
}
資金フローは下図のようになる。最初の Payment Intent から作られる Charge が、Payment Method (クレジットカード)から支払い処理し、手数料を引いて Platform Account に移動する。
次の Transfer で、Platform Account から Connected Account に資金を分配する。このとき、Connected Account から見ると、仮想的な支払いを表す Charge を経由して、売上が上がったように見える。
Payment Method Platform Account Connected Account
| ^ | ^
| | | |
| 1000 964 | | 800 | 800
v | | |
[Charge]👈 | | 800 [TXN]
[TXN]--------------+ +----->[TXN]-------->[Charge]⏪
| [Transfer]⬅️
| 36
v
Stripe
収支は下表のようになる。
Transaction | Payment Methond | Platform Account | Connected Account | Stripe |
---|---|---|---|---|
Charge | -1000 | +964 | 0 | +36 |
Transfer | 0 | -800 | +800 | 0 |
収支 | -1000 | +164 | +800 | +36 |
Platform Account から見ると、単純に Conncted Account に資金を分配していて、Conncted Account からの手数料というのは存在しない。Stripe の外側で計算してから Transfer の額を決定する。
Connected Account から見ると、売上として Charge が見える。Platform に支払う手数料というのは見えない。
複数の Connected Account に分配する
Separate Charges and Transfer は、ひとつの支払いで受け取った資金を、複数の Seller に分配できる。たとえばフードデリバリーで牛丼を宅配してもらって 1000 円払ったら、牛丼屋と配達員に分配される。あるいは定額コンテンツ配信サービスなら、毎月 5000 の会費を支払ったら、多数のコンテンツプロバイダーに分配される。
API 呼び出しシーケンスは次のとおりだ。
curl https://api.stripe.com/v1/payment_intents \
-d amount=1000 \
...
curl https://api.stripe.com/v1/transfers \
-d amount=300 \
-d destination: acct_A \
...
});
curl https://api.stripe.com/v1/transfers \
-d amount=500 \
-d destination: acct_B \
...
資金フローは下図のようになる。
Payment Method Platform Account Connected Account A Connected Account B
| ^ | | ^ ^
| 1000 964 | | 500 | 300 300 | | 500
| | | | 300 | |
| | | +--->[Trasnfer A]--->[Charge] |
| | | |
| | | 500 |
[Charge]----------+ +----------->[Trasnfer B]------------------->[Charge]
|
| 36
v
Stripe
Transaction | Payment Methond | Platform Account | Conn. Account A | Conn. Account B | Stripe |
---|---|---|---|---|---|
Charge | -1000 | +964 | 0 | 0 | +36 |
Transfer | 0 | -300 | +300 | 0 | 0 |
Transfer | 0 | -500 | 0 | +500 | 0 |
収支 | -1000 | +164 | +300 | +500 | +36 |
Destination Charges との違い
Destination Charges | Separate Charges and Transfers | |
---|---|---|
分配のタイミング | 支払い処理時 | 支払い後、明示的に呼び出す |
分配先 | 1 つ | 1 つ以上 |
Platform への手数料 | Application Fee で管理 | Stripe のデータには表れない |
まとめ
Separate Charges and Transfers のデータと資金フローを見た。明日は、このあとの返金を見ていく。