> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gr4vy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed & merchant accounts

Embed can be configured to use multiple merchant accounts either using an [admin API key](./api)
or a [merchant API key](./api).

## Set the merchant ID

Embed can be configured to explicitly take the merchant account ID to process a transaction for.

<CodeGroup>
  ```jsx React theme={"system"}

  <Gr4vyEmbed
    gr4vyId='example'
    environment='sandbox'
    merchantAccountId='my-merchant-account-id'
    ...
  />
  ```

  ```js Node/CDN theme={"system"}
  setup({
    gr4vyId: 'example',
    environment: 'sandbox',
    merchantAccountId: 'my-merchant-account-id',
    ...
  })
  ```
</CodeGroup>

<Note>
  Although it's recommended to set the merchant ID, the ID falls back to `default` if not set, which is the standard
  ID for the single merchant account in a single merchant environment.
</Note>

## Pinning metadata

When using an API key that has access to multiple merchant accounts ([an admin API key](./api)) it is recommended to pin
the `merchant_account_id` value when generating an Embed token.

<CodeGroup>
  ```js Node theme={"system"}
  const token = await client.getEmbedToken({
    amount: 1299,
    currency: 'AUD',
    merchant_account_id: 'my-merchant-account-id'
  })
  ```

  ```java Java theme={"system"}
  Gr4vyClient client = new Gr4vyClient("[YOUR_GR4VY_ID]", "private_key.pem");
  			
  Map<String, Object> embed = new HashMap<String, Object>();
  embed.put("amount", 1299);
  embed.put("currency", "AUD");
  embed.put("merchant_account_id", "my-merchant-account-id");

  String token = client.getEmbedToken(embed);
  ```

  ```py Python theme={"system"}
  embed = {
    "amount": 1299,
    "currency": "AUD",
    "merchant_account_id": "my-merchant-account-id",
  }

  token = client.generate_embed_token(embed)
  ```

  ```php PHP theme={"system"}
  echo $config->getEmbedToken(
    array(
      "amount" => 200,
      "currency" => "AUD",
      "merchant_account_id" => "my-merchant-account-id"
    )
  );
  ```
</CodeGroup>

<Note>
  Pinning is not required with merchant API keys as they are restricted to one single merchant account.
</Note>
