構築するもの
1つの Payments Account(receiving account)で Payin を作成し、allocation_profile を付与します。Payin が支払われると、Hello Clever はプラットフォーム手数料を receiving account に残し、各加盟店の取り分をそれぞれの Payments Account(recipient accounts)に移します。
分配の計算方法と適用タイミングは Platform Fees and Fund Splitting を参照してください。
事前準備
- Dedicated Balance を利用する Clever Connect アカウント。
- Payin の通貨で fund splitting が有効になっていること。担当のアカウントマネージャーにお問い合わせください。
- その通貨の有効な allocation profile を Merchant Portal で作成済みであること。その
uuid(例:map_tBdQGAAjkqx9)を控えておきます。 - receiving account の
app-idとsecret-key。 - サンドボックスは
https://api.cleverhub.co、本番環境はhttps://api-merchant.helloclever.coです。
allocation_profile オブジェクト
Payin のリクエストで次のオブジェクトを送信します。
1
分配先にできるアカウントを一覧する
receiving account のキーを使って Get Allocation Recipient Accounts(GET
/api/v2/merchant_allocation_profiles/accounts)を呼び出します。同じ通貨のその他の Payments Account が返されます。receiving account は常に除外されます。Request
Response
currency は不要です。app-id に紐づく receiving account から取得されます。2
allocation profile を指定して Payin を作成する
v2 の Payin または Payment Gateway 3 の決済リンクに
allocation_profile を追加します。両方の例を以下に示します。3
分配結果を取得する
Payin または決済リンクを取得します。適用された分配が
allocation_profile に返されます。方法 A: v2 の Payin
POST/api/v2/payins に allocation_profile を追加します。
Request
Response (excerpt)
方法 B: Payment Gateway 3 の決済リンク
POST/api/v3/payin_links に allocation_profile を追加します。payin_method_code は任意です。省略すると、顧客がチェックアウト時に決済手段を選びます。
Request
Response
/api/v3/payin_links/{uuid} の transaction_info.allocation_profile に分配が返されます。
Response (excerpt)
カード決済では、カードへの請求後に
allocation_profile が表示されます。Hello Clever は、カードブランドに応じた正しい決済手数料を適用するために、分配の前にカード情報の確定を待ちます。レスポンスのフィールド
allocation_profile は、分配された Payin でのみ返されます。
分配は適用時に保存されます。その後 allocation profile を変更しても、分配済みの Payin には影響しません。
Webhook
Payin の Webhook は、他の Payin と同様に receiving account のendpoint_url に送信されます。受取アカウントには、取り分についての個別の Webhook は送信されません。
エラー
リクエストは、errors.message に次のいずれかのメッセージを含めて拒否されます。
サンドボックスでのテスト
- カード以外の手段では、POST
/api/v3/payins/simulateに{"uuid": "<payin link uuid>", "action": "completed"}を送信して、決済リンクを支払済みにします。支払額の過不足をテストするには、別のamountを渡します。分配は受け取った金額で再計算されます。 - カードの場合は、
payment_urlを開いてテストカードで支払います。