Connected Accounts
Making Requests
Call the API as one of your connected accounts with the On-Behalf-Of header.
To act as a connected account, use your platform account's API key and add the connected account's ID in the On-Behalf-Of header:
curl -X POST "https://api.kingsplatform.net/api/api/v1/payments/charges" \
-H "Authorization: Bearer YOUR_PLATFORM_API_KEY" \
-H "On-Behalf-Of: 0197a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b" \
-H "Content-Type: application/json" \
-d '{ ... }'The request then runs exactly as if the connected account had made it: the charge belongs to the connected account, and lists and lookups return the connected account's objects. Every endpoint accepts the header. Leave it out to act as your own account.
What is checked
- The connection. The account in
On-Behalf-Ofmust be actively connected to the account that owns the API key. Otherwise the request fails with401 Unauthorized. - Your API key's settings. The platform key's permissions and IP restrictions still apply. If the key limits which accounts it may act as, the connected account must be on that list.
- The connected account's settings. Business rules use the connected account: its enabled payment methods, its limits, and its balance.
Fields that need On-Behalf-Of
Some fields only make sense when a platform acts for a connected account, and are rejected otherwise:
application_fee_amounton Create Payment Charge. See Application Fees.