Install the Buy with Prime Cartridge
Buy with Prime API is now available for early access
Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.
Prerequisites
Complete the following prerequisites before starting the process of installing the Buy with Prime cartridge.
Set up your development environment
Set up your development environment with the following:
- An integrated development environment (IDE) of your choice.
- Node.js version 14.19 or later. For details about downloading and installing Node.js, see the Node.js website.
- Tools configured to upload your cartridges to Salesforce Commerce Cloud. For details, see the Salesforce documentation at Upload and Configure Cartridges.
Install the SFRA cartridges and libraries
Verify that you've added the cartridges for your Salesforce Commerce Cloud site to your development environment. For details about Salesforce Reference Architecture (SFRA), see the Salesforce documentation at Get Started with Storefront Reference Architecture.
In your development environment, verify the following in the cartridges
folder as part of your Salesforce Commerce Cloud installation:
app_storefront_base
, the base cartridge provided with Storefront Reference Architecture (SFRA)bm_app_storefront_base
, the Business Manager cartridge provided with SFRA.modules
, the folder that contains globally shared modules.
Build the SFRA cartridge
If you haven't done so already, build SFRA as shown in the following procedure. You must build SFRA before building the Buy with Prime cartridge.
- At a command prompt, change directory to your
storefront_reference_architecture_master
directory. - Run
npm install
.
Integrate with a PSP (optional)
If you don't have an existing integration with Amazon Pay or with another payment service provider (PSP), the Amazon Pay cartridge can be an integration option. For details about installing and configuring the Amazon Pay v2 cartridge, see the Amazon Pay documentation for Upgrading to Checkout v2.
Clone the Buy with Prime cartridge
Clone the Buy with Prime cartridge for Salesforce Commerce Cloud. For details about the Git repository that contains the Buy with Prime cartridge, see buy-with-prime-for-salesforce-commerce-cloud repository on GitHub.
To access the Git repository, work with your Buy with Prime solutions architect.
Install the Buy with Prime cartridge
Add the Buy with Prime cartridge to your workspace
Do the following to add the Buy with Prime cartridge to your workspace:
- Open your IDE.
- Navigate to the tools to add a directory to a workspace.
- Browse to the directory where you cloned the Buy with Prime cartridge.
- Add the
buy-with-prime-for-salesforce-commerce-cloud
root folder to your workspace.
Specify the path to your SFRA directory
The Buy with Prime cartridge assumes that your app_storefront_base
cartridge is at the default path storefront-reference-architecture-master/cartridges
, and that the root SFRA folder storefront-reference-architecture-master
is side by side with the root folder for your Buy with Prime cartridge.
└── <Project name>
├── ...
├── buy-with-prime-for-salesforce-commerce-cloud/
| ├── cartridges/
| | ├── int_buywithprime/
| | └── int_buywithprime_sfra/
| ├── metadata/
| | └── ...
| ├── test/
| | └── ...
| └── ...
├── storefront-reference-architecture-master/
| ├── ...
| ├── cartridges/
| | ├── app_storefront_base/
| | └── ...
| └── ...
└── ...
If you've modified the folder names or directory structure for your Salesforce Commerce Cloud site from the default SFRA paths, do the following to specify the path to your app_storefront_base
cartridge:
- Open your IDE, and then open a file explorer view of your project.
- Under the root folder that you downloaded for the Buy with Prime cartridge, in the
cartridges
folder, open thepackage.json
file. - In the
package.json
file,git replace the following relative path with the relative path to yourapp_storefront_base
cartridge:"paths": { "base": "../storefront-reference-architecture-master/cartridges/app_storefront_base/" },
- Save the changes to the
package.json
file.
Build the Buy with Prime cartridge
To build the Buy with Prime cartridge, make sure that you're using version 14.19 or later of Node.js.
- At a command prompt, open your
buy-with-prime-for-salesforce-commerce-cloud
directory. - Change directory to the
cartridges
directory. - Run
npm install
. - Run
npm run build
.
The build outputs the compiled and generated code to a directory named static
. For example, in the int_buywithprime
directory, in the cartridge
subdirectory, you'll see the code in the static
subdirectory.
└── <Project name>
├── ...
├── buy-with-prime-for-salesforce-commerce-cloud/
| ├── cartridges/
| | ├── int_buywithprime/
| | | ├── cartridge/
| | | | ├── ...
| | | | ├── static/
| | | | └── ...
| | | └── ...
| | └── int_buywithprime_sfra/
| └── ...
└── ...
Update and import the site metadata for the Buy with Prime cartridge
The Buy with Prime cartridge has site-specific configuration and credentials so that you can associate each site with a different Buy with Prime merchant console account, if needed. You can update the metadata for the Buy with Prime cartridge with your site-specific metadata, and then import the metadata into the Business Manager tool for Salesforce Commerce Cloud.
As an alternative to following the procedures for updating and importing the site metadata, you can choose your site in Business Manager before running a job. For details, see Select your site using Business Manager.
Update your site metadata in the Buy With Prime cartridge
In the code for the Buy with Prime cartridge, do the following to replace placeholders with the name of your site.
- Open the Business Manager tool for Salesforce Commerce Cloud, and then in the upper left corner, on the menu, verify your name of your site.
- Open your IDE, and then open a file explorer view of your project.
- In the
buy-with-prime-for-salesforce-commerce-cloud
folder, open themetadata
folder. - In the
jobs.xml
file, replace each of the occurrences of{your_site_id}
with the name of your site. - In the
jobs.xml
file, replace the occurrence ofRefArch
with the name of your site. - In the
services.xml
file, replace the occurrence ofRefArch
with the name of your site. - Save the changes to the
jobs.xml
andservices.xml
files. - From the
metadata
folder, open thesites
folder, and then rename theRefArch
subdirectory to match the name of your site.
└── <Project name>
├── ...
├── buy-with-prime-for-salesforce-commerce-cloud/
| ├── cartridges/
| | ├── int_buywithprime/
| | └── int_buywithprime_sfra/
| ├── metadata/
| | ├── ...
| | ├── sites/
| | | └── RefArch/
| | ├── jobs.xml
| | └── services.xml
| └── ...
└── ...
Import your site metadata to Salesforce Commerce Cloud
After updating the site metadata, do the following to import the metadata from the Buy with Prime cartridge to Salesforce Commerce Cloud.
- Zip the
metadata
directory and all of its subdirectories into a new.zip
file. - Open the Business Manager tool for Salesforce Commerce Cloud.
- From the Administration menu, under Site Development, click Site Import & Export.
- Under Import, click the Choose File button.
- Navigate to the
.zip
file that you created, and then click Open. - Click Upload.
- Click the option button next to instance/metadata.zip, then click Import, and then click OK.
To verify that the metadata imported successfully, do the following to view the log:
- From the Administration menu, under Site Development, click Development Setup.
- On the Folder Browser tab, click Logs, then jobs, and then sfcc-site-import.
- Click the Job-sfcc-site-import-....log with the latest last modified date.
If the import succeeds, the log shows finished with status [OK]
.
Select your site using Business Manager as an alternative to updating and importing site metadata
As an alternative to editing and importing the site metadata, you can select your site in Business Manager for the job that you want to run.
- Open the Business Manager tool for Salesforce Commerce Cloud.
- From the Administration menu, under Operations, click Jobs.
- Click the job for which you want to specify your site.
- Click the Job Steps tab.
- Next to Scope, click the value.
- Select the check box next to your site, and then click Assign.
Related topics
Updated 2 days ago