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

# Magento 2

> Connect your Magento 2 store backend to Converge

export const OutboundLink = ({linkText, linkTarget}) => {
  return <a target="_blank" href={linkTarget}> {linkText} 
    <div className="inline h-3 w-3 fill-gray-500 dark:fill-gray-100 text-gray-500 dark:text-gray-300 ml-1 mr-1">
      <svg className="inline w-2.5 h-2.5 bg-gray-500 dark:bg-gray-300" style={{
    maskImage: `url('https://mintlify.b-cdn.net/v6.5.1/solid/up-right-from-square.svg')`,
    maskRepeat: "no-repeat",
    maskPosition: "center center"
  }}></svg> 
    </div>
    </a>;
};

## Installation instructions

<Steps>
  <Step title="Set the Configuration">
    1. Open your terminal or command prompt and navigate to the root directory of your Magento 2 installation.
    2. Execute the following command to set the `oauth/consumer/enable_integration_as_bearer` configuration option to `1`.

    ```bash bash theme={null}
    bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
    ```
  </Step>

  <Step title="Verify the Configuration">
    3. To ensure that the configuration has been set correctly, you can check the value using the following command:

    ```bash bash theme={null}
    bin/magento config:show oauth/consumer/enable_integration_as_bearer
    ```

    4. The output should confirm that the value is set to `1`.
  </Step>

  <Step title="Navigate to your Magento Integration Settings">
    5. Navigate to your Magento Admin Dashboard.
    6. From the Menu Sidebar, navigate to the **System** > **Extensions** > **Integrations** submenu.
  </Step>

  <Step title="Generate your Magento Admin Access Token">
    7. Choose to generate a new key, and choose `Sales/Operations/Orders/Actions/View` as your scope.
    8. Copy the generated access token, you will need it in the next step.
  </Step>

  <Step title="Create a new Server-side source in Converge">
    9. In Converge, click on **Create a new source**
    10. Pick *Server-side* from the modal
    11. Name your source: e.g. `{Storename} Store Backend`
    12. Choose the **Magento v2** app from the dropdown menu.
  </Step>

  <Step title="Connect the Source to Magento">
    13. Enter the full URL of the REST API of your Magento 2 store in the  **API URL**-field, including `https://`, e.g. `https://myshop.com/rest`
    14. If your storefront is hosted on a different domain than your API, please provide the domain in the **Storefront domain**.
        This domain should match the domain on which the Magento Storefront Module was installed. For example, `myshop.com`.
        Feel free to leave this blank if your store is hosted on the same domain.
    15. Paste in the Admin Access Token you retrieved in the previous section in the **Admin Access Token**.
    16. Optionally, filter out orders by store view or modify the start date. You should leave these fields blank if you do not have a good reason to use them.
  </Step>
</Steps>

<Note> You should see the Source syncing all historical order data, you should wait until it's fully synced to create destinations </Note>

## Configuration

### Storefront domain

If your storefront is hosted on a different domain than your API, please provide the domain in the **Storefront domain**.
This domain should match the domain on which the Magento Storefront Module was installed.
For example, `www.example.com`.

<Note>
  Pay attention to provide the full domain here. Depending on your setup, it might be necessary to include `www.`, or not.
  You can inspect the full domain in the browser's address bar when you visit your storefront. Click on the address bar to see the full URL.
</Note>

### Filter by store view name

You can scope your Magento integration to only include orders from a specific store view.
This may be useful if you have multiple store views in your Magento installation and want to separate them out in Converge.

### Only track orders once they reach a status

You can customize where in the order lifecycle Converge starts tracking orders.
This can be useful if you want to exclude unconfirmed orders or only track orders that have been paid for.

The default order status lifecycle is documented by Magento <OutboundLink linkText="here" linkTarget="https://experienceleague.adobe.com/en/docs/commerce-admin/stores-sales/order-management/orders/order-status" />.

<Accordion title="Default lifecycle example">
  For the default order lifecycle, you could specify `processing` to only track orders that have been paid for.

  The order reaches the `processing` status after the payment has been confirmed, before it is shipped.
</Accordion>

<Note>
  Converge will track the order whenever it reaches any of the specified status. The order may still go through multiple transitions after this point.
</Note>

<Warning>
  Depending on your Magento installation, the order lifecycle may have been customized.
  Make sure to consult on any changes with your Magento developer.
</Warning>

***

## Event spec

This integration auto-tracks the following events on the server with all properties available according to the [Converge event spec](/sources/converge-spec).

| Event Name                                          | Event Description                |
| --------------------------------------------------- | -------------------------------- |
| [Placed Order](/sources/converge-spec#placed-order) | When a customer places an order. |
