This repository provides a demo for integrating Magento with Vue.js in a headless architecture using Gitpod as the development environment. This demo allows you to develop and test your Magento storefront using Vue.js components, while keeping the backend functionality and data management in Magento.
Before getting started, make sure you have the following:
- Github account
To get started with the Magento Headless integration with Vue.js in Gitpod, follow these steps:
- Create your Adyen Test API Credentials.
- Environment variable (one-time setup).
- Go to Gitpod account variables
- Add and set the
ADYEN_API_KEY
,ADYEN_CLIENT_KEY
andADYEN_MERCHANT_ACCOUNT
variables (scope:adyen-examples/*
). - Create variables
BASE_URL
andBEARER_TOKEN
. Set#
as its placeholder (scope:adyen-examples/*
). These values will be updated later after we've configured the backend. - Add and set
ADMIN_USERNAME
andADMIN_PASSWORD
in the Gitpod account variables as well. These will be used as your login credentials in the Magento admin dashboard. (Scope:adyen-examples/*
).
Warning The
ADMIN_PASSWORD
must be at least 7 characters in length and must include at least one alphabetic and at least one numeric character (Magento requirement).
- Launch the backend Magento instance by clicking the button below.
- Wait around ~260s (4 minutes) (for the Magento installation). You should have
magento2-container | Starting periodic command scheduler: cron.
before proceeding to next step. - Open a new Terminal in Gitpod, navigate to backend directory
cd magento-backend
and run./install.sh
to install and configure the Adyen payment plugin.
Note This part of the integration is an extension of the Magento Plugin Demo.
- Login the admin dashboard by navigating to the public URL/admin generated by gitpod (e.g.
https://adyenexampl-magentohead-gbqa16g1p1n.ws-eu101.gitpod.io/admin
). - You can login using the
ADMIN_USERNAME
andADMIN_PASSWORD
created in the previous step and navigate toSystem
>Integrations
>Add New Integration
to create a new integration token. - Under the
Integration Info
tab, enter aName
, setADMIN_PASSWORD
asYour Password
, do not hitSave
yet. - In the
API option
tab, you can find several folders underResource Access
. SelectSales
,Adyen
(under 'System'),Carts
and hitSave
. These are the required resources for the frontend. - Click on
Activate
, followed byAllow
to get yourAccess Token
. - Go to Gitpod and update
BEARER_TOKEN
with the copiedAccess Token
and save. - Update
BASE_URL
with URL (e.g.https://adyenexampl-magentohead-gbqa16g1p1n.ws-eu101.gitpod.io/
) of the Magento Instance and save.
- Launch the frontend Vue.js by clicking the button below.
- In the Magento Dashbboard, navigate to
Stores
>Configuration
>Sales
>Payment methods
>Adyen payments
>Configure
>Advanced settings
>Headless integration
. - Update the
Payment Origin URL
with the URL of the frontend (Vue) instance (e.g.https://3000-adyenexampl-magentohead-qtjz67kufbw.ws-eu101.gitpod.io/
). - Update the
Payment Return URL
with the URL of the frontend (Vue), append/result
to the URL (e.g.https://3000-adyenexampl-magentohead-qtjz67kufbw.ws-eu101.gitpod.io/result
) , then hitSave Config
. - Refresh the frontend view to load data from backend.
Note To allow the Adyen Drop-In and Components to load, you have to add
https://*.gitpod.io
as allowed origin for your chosen set of API Credentials.
Contributions are welcome! If you find any issues or have suggestions for improvements, please create an issue or submit a pull request.
This project is licensed under the MIT License.