Support for multiple merchant accounts in one instance is a premium feature.
In a standard instance, all your API calls are associated with the
default merchant account without any extra effort.Managing accounts
Merchant accounts can be managed via the dashboard as well as via the API.API keys
API keys can only be created by administrators via the dashboard, they cannot be managed via the API. Keys can be created to either have access to a specific merchant account, or to all merchant accounts. These so-called administrator keys can be used to make API calls on behalf of any merchant account. Restricted API keys, or merchant keys, can only be used to make API calls on behalf of the merchant account they are associated with.| Administrator keys | Merchant keys | |
|---|---|---|
| Access | All merchant accounts | One merchant account |
| Header | Optional, defaults to default | Defaults to account associated to key |
| Use case | Platforms calling the API on behalf of merchants | Merchants making their own API calls |
Merchant account header
Most API endpoints can only access and operate on records in one merchant account at a time. Every request is processed within the context of that one merchant account, and it only allows for using other resources from within the same merchant account. For example, an API call to create a transaction associates that transaction with the merchant account for which the request is made, and it can only use buyers, payment methods, connections, and flow rules that belong to the same merchant account. To identify the merchant account to use, set theX-GR4VY-MERCHANT-ACCOUNT-ID header. For example,
the following request fetches a list of buyers for the legendary-games-uk account
on the legendary-games instance.
In a single merchant instance, the
X-GR4VY-MERCHANT-ACCOUNT-ID header can be
omitted and the API falls back to the default merchant account ID.
Additionally, when using a merchant key the header can be omitted and the
API falls back to the merchant account associated with the key.Administrator APIs
A few endpoints are not merchant aware and therefore can only be accessed by administrator keys. The only public endpoints currently affected are theGET /api-logs endpoint. Setting the
X-GR4VY-MERCHANT-ACCOUNT-ID on this API has no effect.
SDK usage
Each of the SDKs supports setting the merchant account ID. This automatically sets theX-GR4VY-MERCHANT-ACCOUNT-ID
for each request to this value. Without setting the ID explicitly its value falls back to default.