Multistore setup
To setup a multistore for VSF Adyen Magento 2 integration, register the following extension for @vsf-enterprise/adyen-magento2/server
middleware's integration:
// middleware.config.js
const cookieNames = {
storeCookieName: 'vsf-store'
};
module.exports = {
integrations: {
// ...
adyen: {
location: '@vsf-enterprise/adyen-magento2/server',
configuration: {
// ...
},
extensions: extensions => [
...extensions,
{
name: 'multistore-extension',
hooks: (req) => ({
beforeCreate ({ configuration }) {
const storeCookie = req.cookies[cookieNames.storeCookieName];
return {
...configuration,
m2Api: {
...configuration.m2Api,
baseApiUrl: configuration.m2Api.baseApiUrl + `/${storeCookie}`
}
};
}
})
}
]
}
}
}
Generally, it is all about appending a value of the Magento's integration current store cookie to the baseApiUrl
.