diff --git a/enabler/.env.template b/enabler/.env.template index acebcee..3c2aa9b 100644 --- a/enabler/.env.template +++ b/enabler/.env.template @@ -3,4 +3,4 @@ VITE_ADMIN_CLIENT_ID=[client-id] VITE_ADMIN_CLIENT_SECRET=[client-secret] VITE_ADMIN_SCOPE=manage_project:commercetools-checkout VITE_REGION=europe-west1.gcp -VITE_CART_ID=[cart-id] +VITE_PROCESSOR_URL=http://localhost:8080 diff --git a/enabler/public/session.js b/enabler/dev-utils/session.js similarity index 83% rename from enabler/public/session.js rename to enabler/dev-utils/session.js index e511a68..629df10 100644 --- a/enabler/public/session.js +++ b/enabler/dev-utils/session.js @@ -34,15 +34,15 @@ const fetchAdminToken = async () => { return token.access_token; } -const getSessionId = async() => { +const getSessionId = async(cartId) => { const accessToken = await fetchAdminToken(); const sessionMetadata = { - cartId: '', - allowedPaymentMethods: ['card', 'ideal', 'googlepay'], + cartId: cartId, + allowedPaymentMethods: ['card'], // add here your allowed methods for development purposes }; - const res = await fetch(`http://localhost:3004/api/${projectKey}/sessions`, { + const res = await fetch(`https://session.${__VITE_REGION__}.commercetools.com/${projectKey}/sessions`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/enabler/index.html b/enabler/index.html index 98416a9..3d05422 100644 --- a/enabler/index.html +++ b/enabler/index.html @@ -5,41 +5,81 @@