We have previously introduced the steps for working with Next.js Commerce, but there have been some updates over time. This time, we would like to reintroduce the procedure to get up and running in the shortest possible time.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6lUd1cQK8ehcwXeedxrtXm%2Fbc99a5a769317e2b086caf18e25502db%2Fnextjscommerce18.png&w=3840&q=75)
Create an account
The Sitecore OrderCloud Sandbox is available free of charge. Once you sign up, you will be provided with a Staging and Production environment, allowing you to configure your site as required for actual operations. First, create an account.
![createaccount01.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6FRAlYnn1EZZCajvd4oHPl%2F9468a1a96352cb8dcd5ffb71fdda7dd0%2Fcreateaccount01.png&w=3840&q=75)
Clicking Create a Free Account in the upper right corner of the screen will bring up a sign-up screen where you can enter your e-mail address.
![createaccount02.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6xWLNsOBmxyvZatKWZuEOo%2Fd7510bcb6a9fcf83b7804684b1ddcda4%2Fcreateaccount02.png&w=3840&q=75)
Enter your e-mail address and click the Register button. In a few moments, you will receive an e-mail with a confirmation code in your e-mail address.
![createaccount03.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F43I1w0P15Zt5qg1pFcy1lN%2F91545663840a875736d612bb2e0abe95%2Fcreateaccount03.png&w=3840&q=75)
Enter the code in the first field and enter your full name and username and password for login.
![createaccount04.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7K9mxbxPv5znndPfeNouQU%2F6f20444adf40e2a4c6e12a9ac0ef8bba%2Fcreateaccount04.png&w=3840&q=75)
After user registration is completed, you will be taken to the following screen.
![createaccount05.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F29WQ2iw69DJC4cempMWGdw%2F53f34f674efb13949a89127061e68dd4%2Fcreateaccount05.png&w=3840&q=75)
You have now created your account. Please log in with the account you have created. The first thing you will see is a dialog box with terms and conditions of use.
![createaccount06.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5BxBPMcbvGYnV89XgM1YyH%2F6c81c025c7b40481e1cb1050d81c73bd%2Fcreateaccount06.png&w=3840&q=75)
After checking the box and logging in, the portal screen can now be accessed.
![createaccount07.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F62EdJajOV47pukJpIbak1g%2F22b9c4e32a6cedbd796ba0c0ede915ea%2Fcreateaccount07.png&w=3840&q=75)
Import sample data into OrderCloud
In this case, our goal is to set up an OrderCloud tenant in a Japanese data center. For this purpose, we will create a new marketplace for the Japanese data center. As a preliminary step, we need to upload the images to be used on the site to Azure storage. The procedure is as follows (assuming that the storage has already been created)
- Download the file https://raw.githubusercontent.com/ordercloud-api/ordercloud-seed/main/seeds/Vercel-B2C.yml. Save this file in the assets/Seed folder.
- Download the full set of images described in the Yaml file above.
- Create a vercel-integration-assets container for Azure storage
![storage01.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7C0AVavGVfcNOWZFl7zAml%2F22e3790fa7f6814815854232eda91265%2Fstorage01.png&w=3840&q=75)
- Upload the downloaded images to the container you created.
![storage02.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1JtdScHyr315CIA3UNbB0r%2F94f37713db6e7d66c5e61fc8659b7d0d%2Fstorage02.png&w=3840&q=75)
- Make sure you can access the uploaded images in your browser
- Change the image path in the assets/Seed/Vercel-b2c.yml file to the new storage path.
You are now ready to upload. Then, using the command line, create a new Marketplace using the data you have prepared.
npx @ordercloud/seeding seed Vercel-B2C.yml -n='Nextjs Commerce Japan' -u={username} -p={password} -r=jpn
Match the username and password as the data for the account you just created. The required data will be generated based on the data as shown below.
![seeding01.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6IQTr3OUgPnY289UIRUKgi%2Ffb00da239b650d04e7478b7b622a4266%2Fseeding01.png&w=3840&q=75)
Once completed, confirm that the marketplace has been created on the OrderCloud administration page.
![seeding02.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2F4tpXkzLsuWQfzs088bzX%2Fec4688f8caedc2d9c55e90b4d313249f%2Fseeding02.png&w=3840&q=75)
You are now ready to launch at a data center in Japan.
Create a Next.js Commerce project
Next, create a Next.js project in Vercel, which also allows you to create a free account (limited capacity, etc., but fine for evaluation purposes). Click Create Project, and the following screen appears, showing the Next.js Commerce project.
![nextjscommerce01.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F56foq6Mpf5kzGJJctdZVmI%2Fb5090c91f0cc770ee36ce4e55acea9d7%2Fnextjscommerce01.png&w=3840&q=75)
You will be asked to select the Git repository you wish to link to, in this case GitHub.
![nextjscommerce02.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2lNedgSeQRKJBHOlpmwRvi%2F70e75e3d77b5e7a3f7620dc203770b2b%2Fnextjscommerce02.png&w=3840&q=75)
Enter a project name. In this case, we will use `nextjs-commerce`.
![nextjscommerce03.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1w90ROmr4YEDd7oBlObXeK%2F5b48bebd66b016c69e2257c3a475ab12%2Fnextjscommerce03.png&w=3840&q=75)
Since Sitecore OrderCloud is not available at this time, skip the Add Integrations section and execute it.
![nextjscommerce04.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1jItSksTfIgC5dr3PquFWr%2Fd0ec5a18b9b9d84f97e058e202d89b9b%2Fnextjscommerce04.png&w=3840&q=75)
After a while, the site will be launched using Next.js Commerce data.
Work with OrderCloud.
For integration, we will first create a new marketplace in a data center in the U.S. This is because it is not possible to select a data center on the Connector's administration screen. Since it is not possible to select a data center on the Connector's administration screen, we will proceed by creating a marketplace in the U.S. and then connecting to the data in the Japanese marketplace.
First, search for sitecore in the Integration administration page and select Sitecore OrderCloud.
![nextjscommerce05.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6RmAHkuqEVwcK9EWHsHAUA%2F3d80de0f174a8bfff7bb82e87b856ace%2Fnextjscommerce05.png&w=3840&q=75)
Click on the button below to display the screen below and click on the Add Integration button.
![nextjscommerce06.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3vUef63HWcyFOCbYIZ9z1V%2F307458f10fa4986ccdedef7eaec0f526%2Fnextjscommerce06.png&w=3840&q=75)
The screen will change and the following dialog will appear (the sample environment has already been installed, so the screen will be different from the first time).
![nextjscommerce07.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5iCVZI6AEbyng9LoH6GvLp%2Fb1f08b15b31db22dbba20c4d16c4109b%2Fnextjscommerce07.png&w=3840&q=75)
Once this is done, click on the `Configure` button and the following screen will appear. For the list that appears on the right side, keep the Seed new Marketplace item selected and click `Apply Changes`.
![nextjscommerce08.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F19oWJ7jEtC8VPV2IaqYqK4%2F914802dc1eeb6545fbe34c9971b1d5a2%2Fnextjscommerce08.png&w=3840&q=75)
You can see that a new Marketplace has been created for a while on the screen.
![nextjscommerce09.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7LQUvOegf3nn98JJaKQkMM%2F87362397a3bc5bbb8dc2784f54f7b40d%2Fnextjscommerce09.png&w=3840&q=75)
There are no changes to the site since the Build process is not yet running after the Integration setup is complete.
![nextjscommerce10.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FzaUCbFS3B3Hatmb9jpB7i%2Fd0f8d2cce34650afa3db8177a723ec35%2Fnextjscommerce10.png&w=3840&q=75)
Click Redeploy from the Deployments menu to build the site
![nextjscommerce11.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1lIXPK0Ih5tzc429iq6yrn%2F9bdf443294885d0c25ce4c677a805dfa%2Fnextjscommerce11.png&w=3840&q=75)
After a short while, the build is completed and the site is changed as follows.
![nextjscommerce12.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FvSf13jSHQAeCqPXOz52CE%2F46223a762a3b3df94d2cf14c542d39fc%2Fnextjscommerce12.png&w=3840&q=75)
Switching Marketplaces
The site is already up and running with Next.js Commerce and OrderCloud working together, but the data center is overseas. Finally, we will proceed with the procedure to switch to the Japanese marketplace.
First, we will change the values of the Environment Variables for the project. First, we will retrieve two pieces of information about the marketplace from the following page on OrderCloud
- ORDERCLOUD_MARKETPLACE_ID: Marketplace Identifier
- ORDERCLOUD_MARKETPLACE_NAME: Marketplace Name
![nextjscommerce13.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2kUYXjZUzkfwmQxfa1i3yY%2Fe689b8b2ea2ba8df61f1673b169185dd%2Fnextjscommerce13.png&w=3840&q=75)
Then select `API Clients` from the menu on the left, or `Nextjs` for Sandbox (if you have a different name).
![nextjscommerce14.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7pdAepOHNeGtXZrpuGYoh%2F344a8be27fa5b1bcbc9cdac0fe548aee%2Fnextjscommerce14.png&w=3840&q=75)
From this screen window, select API Client to retrieve the values. First, obtain the following two keys from Middleware Integrations. -middleware
- ORDERCLOUD_MIDDLEWARE_CLIENT_ID : Client ID
- ORDERCLOUD_MIDDLEWARE_CLIENT_SECRET : Client Secret
![nextjscommerce15.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F17bwc94hXMkN3ZPRAqUGQC%2F1665b452414965a7d034f9c1c0de4fe4%2Fnextjscommerce15.png&w=3840&q=75)
Finally, to retrieve the Buyer's ID, switch to the Storefront App to retrieve the ID.
- ORDERCLOUD_BUYER_CLIENT_ID : Client ID
![nextjscommerce16.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3s7DTKdKFDqLkEBXKOrzgJ%2F23e3b951dec5565d64a84e39868b85ca%2Fnextjscommerce16.png&w=3840&q=75)
We have now changed the variables in the project set up in Vercel. However, this is not enough to complete the work. The data center referenced by the Next.js Commerce project is in the U.S., so we need to switch this to Japan. Please change the following files in your project
export const API_URL = 'https://japaneast-sandbox.ordercloud.io'
Also, for images, please add the storage URL as follows, as they will be stored in a different storage than the sample.
const commerce = require('./commerce.config.json')
module.exports = {
commerce,
images: {
domains: ['localhost', 'ocdevops.blob.core.windows.net', 'YOURBLOBSTORAGE.blob.core.windows.net'],
},
}
Change this code and reflect it on GitHub to perform a rebuild.
![nextjscommerce17.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1tdFh3cXa56ZKPl8diXdnu%2Ff30878b11301320335d91d99bf4f3ffc%2Fnextjscommerce17.png&w=3840&q=75)
If you get an error, click on the Redeploy with existing Build Chache dialog on the Redeploy screen and then deploy on the side to complete the process. The following is the screen.
![nextjscommerce18.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6lUd1cQK8ehcwXeedxrtXm%2Fbc99a5a769317e2b086caf18e25502db%2Fnextjscommerce18.png&w=3840&q=75)
Summary
In this article, we have introduced the process of integrating Next.js Commerce and Sitecore OrderCloud, and even the procedure for selecting a data center in Japan. You can see how easy it is to set up a commerce site.