Requirements
| Requirement | Description |
|---|---|
| Integration type | A Salesforce Composable Storefront integration. |
| Setup steps | Before you can set up payment methods in your Salesforce Business Manager, add the payment methods that you want to offer in your Customer Area. |
Enable Adyen as your payment processor
To enable Adyen as the payment processor for cards and other local payment methods that you have added in your Customer Area:- In the Salesforce Business Manager, go to Merchant tools > Ordering > Payment Methods.
- In the Payment Methods overview, check the ID column to make sure that AdyenComponent and CREDIT_CARD are enabled.
- Under Details, set Payment Processor to Adyen_Component for both types.
Apple Pay
You can allow your shoppers to check out with Apple Pay or Apple Pay express in your Composable Storefront integrated with Adyen. Our package supports setting up Apple Pay with Adyen’s Apple Pay certificate. To set up Apple Pay:- Enable Apple Pay.
- Optionally, set up Apple Pay express.
- Make test payments with Apple Pay.
- Go live.
Enable Apple Pay
-
Set up your server for secure communication with Apple Pay.
- All pages that include Apple Pay must be served over HTTPS.
- Your domain must have a valid SSL certificate.
-
Add Apple Pay in your test Customer Area.
- You’ll be asked for Shop websites: your website URLs, for example
https://www.mystore.com. If you add more than one, separate them with a comma. - You cannot use
http://localhostto test.
- You’ll be asked for Shop websites: your website URLs, for example
(Optional) Set up Apple Pay express
To allow your shoppers to pay with Apple Pay express, insert the Apple Pay express checkout button in a page of your PWA Retail React App. You can display the express checkout button on your cart page or the mini cart modal window. The integration only supports displaying the Apple Pay button after a shopper places one or more items in their basket. Therefore, it is not possible to display the Apple Pay express button on the product detail page.- v1.2.0
- v2.0.0 and later
- v4.0.0 and later
- v4.2.0 or later
- v1.2.0
- v2.0.0 and later
-
In your Retail React App, import the payment processing and UI elements that are required to enable the Apple Pay express checkout button on your cart page (
cart-cta.jsx) or mini cart modal window (use-add-to-cart-modal.js). Import the elementsimport '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' // Import the Apple Pay button style. import {useAccessToken, useCustomerId, useCustomerType} from '@salesforce/commerce-sdk-react' // Fetch the basket and use Salesforce Commerce APIs. import {AdyenExpressCheckoutProvider, ApplePayExpress} from '@adyen/adyen-salesforce-pwa' // Import the Adyen Apple Pay Express component. import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' // Import Salesforce React hooks to get the locale and site name for the shopper session. import PropTypes from 'prop-types' -
Add the Adyen Express Checkout context in the Retail React App page where you want to enable Apple Pay express.
Add the context
<AdyenExpressCheckoutProvider useAccessToken={useAccessToken} useCustomerId={useCustomerId} useCustomerType={useCustomerType} useMultiSite={useMultiSite} > <ApplePayExpress /> </AdyenExpressCheckoutProvider>
-
In your Retail React App, import the payment processing and UI elements that are required to enable the Apple Pay express checkout button on your cart page (
cart-cta.jsx) or mini cart modal window (use-add-to-cart-modal.js). Import the elementsimport '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' // Import the Apple Pay button style. import {useAccessToken, useCustomerId, useCustomerType} from '@salesforce/commerce-sdk-react' // Fetch the basket and use Salesforce Commerce APIs. import {AdyenExpressCheckoutProvider, ApplePayExpress} from '@adyen/adyen-salesforce-pwa' // Import the Adyen Apple Pay Express component. import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' // Import Salesforce React hooks to get the locale and site name for the shopper session. import PropTypes from 'prop-types' -
Add the Adyen Express Checkout context in the Retail React App page where you want to enable Apple Pay express.
Add the context
<AdyenExpressCheckoutProvider authToken={authToken} customerId={customerId} locale={locale} site={site} basket={basket} navigate={navigate} > <ApplePayExpress /> </AdyenExpressCheckoutProvider>
-
In your Retail React App, import the payment processing and UI elements that are required to enable the Apple Pay express checkout button on your cart page (
cart-cta.jsx) or mini cart modal window (use-add-to-cart-modal.js). Import the elementsimport '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' // Import the Apple Pay button style. import {useAccessToken, useCustomerId, useCustomerType} from '@salesforce/commerce-sdk-react' // Fetch the basket and use Salesforce Commerce APIs. import {ApplePayExpress} from '@adyen/adyen-salesforce-pwa' // Import the Adyen Apple Pay Express component. import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' // Import Salesforce React hooks to get the locale and site name for the shopper session. import PropTypes from 'prop-types' -
Add the Adyen PWA Apple Express Checkout component in the Retail React App page where you want to enable Apple Pay express.
Add the Apple Pay express checkout component
import React, {useEffect, useState} from 'react' import {useAccessToken, useCustomerId} from '@salesforce/commerce-sdk-react' import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket' import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation' import {ApplePayExpress} from '@adyen/adyen-salesforce-pwa' import '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' const CartCTA = () => { const {data: basket} = useCurrentBasket() const customerId = useCustomerId() const {getTokenWhenReady} = useAccessToken() const navigate = useNavigation() const {locale, site} = useMultiSite() const [authToken, setAuthToken] = useState() useEffect(() => { const getToken = async () => { const token = await getTokenWhenReady() setAuthToken(token) } getToken() }, []) const handleError = (error) => { console.error('Apple Pay error:', error) } return ( <div> {/* Your existing cart CTA buttons */} {/* Apple Pay Express Button */} <ApplePayExpress authToken={authToken} site={site} locale={locale} basket={basket} navigate={navigate} customerId={customerId} onError={[handleError]} /> </div> ) } export default CartCTA
On v4.2.0 and later of the package, you can also start the Apple Pay express flow on the product detail page.
-
In your Retail React App, import the payment processing and UI elements that are required to enable the Apple Pay express checkout button on your cart page (
cart-cta.jsx), mini cart modal window (use-add-to-cart-modal.js), or the product detail page. Import the elementsimport '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' // Import the Apple Pay button style. import {useAccessToken, useCustomerId, useCustomerType} from '@salesforce/commerce-sdk-react' // Fetch the basket and use Salesforce Commerce APIs. import {ApplePayExpress} from '@adyen/adyen-salesforce-pwa' // Import the Adyen Apple Pay Express component. import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' // Import Salesforce React hooks to get the locale and site name for the shopper session. import PropTypes from 'prop-types' -
Add the Adyen PWA Apple Express Checkout component in the Retail React App page where you want to enable Apple Pay express.
Add the Apple Pay express checkout component
import React, {useEffect, useState} from 'react' import {useAccessToken, useCustomerId} from '@salesforce/commerce-sdk-react' import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket' import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site' import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation' import {ApplePayExpress} from '@adyen/adyen-salesforce-pwa' import '@adyen/adyen-salesforce-pwa/dist/app/adyen.css' const CartCTA = () => { const {data: basket} = useCurrentBasket() const customerId = useCustomerId() const {getTokenWhenReady} = useAccessToken() const navigate = useNavigation() const {locale, site} = useMultiSite() const [authToken, setAuthToken] = useState() useEffect(() => { const getToken = async () => { const token = await getTokenWhenReady() setAuthToken(token) } getToken() }, []) const handleError = (error) => { console.error('Apple Pay error:', error) } return ( <div> {/* Your existing cart CTA buttons */} {/* Apple Pay Express Button */} <ApplePayExpress authToken={authToken} site={site} locale={locale} basket={basket} navigate={navigate} customerId={customerId} onError={[handleError]} /> </div> ) } export default CartCTA -
Only if you are displaying the Apple Pay express button on the product detail page, add the following to your Apple Pay express context.
isExpressPdp= true- A
productobject that containsid, andquantity.
The component does not support handling quantity and variant changes on the product detail page.<ApplePayExpress authToken={authToken} customerId={customerId} locale={locale} site={site} currency={currency} navigate={navigate} isExpressPdp={true} merchantDisplayName={'Merchant name'} product={ {id: product.id, quantity} } onError={[onError]} />
Testing
Use Apple’s test card numbers to test your integration. Refer to Apple Documentation for a full list of test cards and instructions on how to add those to your test device.You can check the status of an Apple Pay test payment in Customer Area > Transactions > Payments.Go live
To process live Apple Pay payments, follow the steps that are relevant to your version.- Download and unzip the Apple Pay domain association file from our Apple Pay documentation. You do not have to follow the subsequent steps on the page.
- In the environment variables file you created when setting up the package, add a YOUR_SITE_ID_ADYEN_APPLE_DOMAIN_ASSOCIATION variable.
-
Copy and paste the domain association file content to set the variable value:
YOUR_SITE_ID_ADYEN_APPLE_DOMAIN_ASSOCIATION="7B227..."
- Download and unzip the Apple Pay domain association file from our Apple Pay documentation. You do not have to follow the subsequent steps on the page.
- In your MRT environment, go to your environment variables.
- Copy the domain association file content, and paste it to the YOUR_SITE_ID_ADYEN_APPLE_DOMAIN_ASSOCIATION variable value.
Click to Pay
Click to Pay is supported on v4.1.0 and later. To set up Click to Pay, you need toTo set up Click to Pay:-
To allow scripts and iframes from external sources, which is required to load Click to Pay, configure your Content Security Policy (CSP):
-
Go to the
overrides/app/ssr.jsfile of your Retail React App, where you will add the required domains. -
Add the following Visa and Mastercard domains to the script-src, img-src, frame-src, and connect-src directives:
- *.mastercard.com
- *.visa.com
-
Go to the
-
Optionally, configure a Merchant Display name that will be shown on the Click to Pay dialog.
- In your
AdyenCheckoutcomponent instance, set themerchantDisplayNameto your preferred display name.
<AdyenCheckout authToken={authToken} site={site} locale={locale} navigate={navigate} basket={basket} returnUrl={${window.location.origin}/checkout/confirmation} // Your other optional configuration merchantDisplayName={'YOUR_COMPANY_NAME'} /> - In your
Credit card installments
Credit card installments are optionally available in some countries. To learn more about their availability, see Credit card installments.Credit card installments are supported on v4.3.0 and later of the package. When enabled, the AdyenWeb card component shows the shopper an Installments dropdown next to the card form. The selected installment count is forwarded to Adyen, persisted on the Salesforce Commerce Cloud payment instrument asc_cardInstallments, and shown on the order confirmation page.Installments only apply to regular card payments. Express checkouts (Apple Pay, Google Pay, and PayPal express) do not surface the installments UI.Requirements
-
In your test Customer Area, enable installments for each combination of merchant account, card scheme, and country that you want to support. Without this, the
/paymentsrequest fails with an installments-not-allowed error even if the storefront submits a valid value. -
Installments are only allowed for the following country and currency combinations:
The PWA package enforces this country gate server-side based on the country part of the
Country Allowed values Brazil (BR) Any unique integers in 1..99. Currency must be BRL.Mexico (MX) Any unique subset of [3, 6, 9, 12, 18]. Currency must be MXN.Japan (JP) Plans regular,revolving, andbonus.regularaccepts integers2..99;revolvingandbonusalways require1. Currency must be JPY.localequery parameter sent on/api/adyen/payments. For any other country, theinstallmentsfield is removed from the payment request before it reaches Adyen.
Configure credit card installments
-
To generate a ready-to-paste configuration block, run the helper script that ships with the package:
Generate the installments configuration
The script asks for the country, mode (single
npx generate-installment-optionscardor per-scheme), card schemes, and values or plans. It validates your input against the allowed values for each country and prints a configuration block that you can drop into your Retail React App. -
Pass the generated
card.installmentOptionsblock to the<AdyenCheckout />component through thepaymentMethodsConfigurationproperty in your checkout payment step (overrides/app/pages/checkout/partials/payment.jsx).-
Per scheme: configure different installment values for each card brand, for example visa, mc, or amex.
Per-scheme installments configuration
const paymentMethodsConfiguration = { card: { installmentOptions: { visa: { values: [2] }, mc: { values: [4, 6] } }, showInstallmentAmounts: true } } -
Single configuration for all cards: a single
cardkey applies to every accepted scheme. Single installments configuration for all cardsconst paymentMethodsConfiguration = { card: { installmentOptions: { card: {values: [3, 6, 9, 12]} }, showInstallmentAmounts: true } }
showInstallmentAmountsto true to display the per-installment amount, for example3 x $33.33, next to each option in the dropdown. -
Per scheme: configure different installment values for each card brand, for example visa, mc, or amex.
Per-scheme installments configuration
-
Pass the
paymentMethodsConfigurationobject to your<AdyenCheckout />component instance: Pass installments configuration to AdyenCheckout<AdyenCheckout authToken={authToken} site={site} locale={locale} navigate={navigate} basket={basket} paymentMethodsConfiguration={paymentMethodsConfiguration} // Your other configuration />
c_cardInstallments. The retail app reads it from order.paymentInstruments[0].c_cardInstallments and renders an Installments line on the order confirmation page when the value is present.PayPal express
PayPal express is supported on v4.2.0 and later of the package. With PayPal express, your shoppers can complete their purchases from the cart or product detail pages without manually entering shipping and billing information. The component handles the checkout flow by fetching the shipping addresses, and methods, so the shopper does not have to manually enter shipping and billing information.-
Add the Adyen PWA PayPal express checkout component in your Retail React App page where you want to enable PayPal express.
- Cart page:
type: cart - Product detail page:
type: pdp
- Cart page:
-
Only if you are displaying the component on the product detail page, add a
productobject in the PayPal express context. The product object must include theid,price, andquantityfields, so the component creates a temporary basket. The component usesquantity * priceto calculate the price. The component does not support handling quantity and variant changes on the product detail page. The example below shows how to add the PayPal express button on your product detail page with custom styling configuration and callbacks to handle the payment flow. Add the PayPal express button to your product detail pageimport {PayPalExpress} from '@adyen/adyen-salesforce-pwa' <PayPalExpress authToken={authToken} customerId={customerId} locale={ {id: 'en-US'} } site={siteConfig} basket={basket} navigate={navigate} type="pdp" currency="USD" product={ { // Only required for the express flow on the product detail page id: 'product-123', price: 99.99, quantity: 1, variationAttributes: {...} } } beforeSubmit={[validateCart]} afterSubmit={[trackPaymentInitiation]} beforeAuthorized={[logAuthorization]} afterAuthorized={[updateAnalytics]} beforeShippingAddressChange={[validateAddress]} afterShippingAddressChange={[updateShippingCosts]} onError={[handleError, logError]} configuration={ { style: { layout: 'horizontal', shape: 'rect', label: 'paypal' } } } spinner={<LoadingSpinner />} /> -
Optionally, redirect shoppers to a review page before they complete the payment where they can review their order by setting
enableReviewto {true}. Enable the review pageimport {PayPalExpress} from '@adyen/adyen-salesforce-pwa' <PayPalExpress // Your other properties for the PayPal express flow enableReview={true} reviewPageUrl="/checkout/review" /> -
Configure your review page. The review page needs to:
- Display an order summary with the shipping and billing addresses.
- Show selected shipping and payment methods.
- Use the
useAdyenReviewPagehook to retrieve payment data. - Call
submitPaymentDetails()when the shopper confirms the order details.
Below is an example implementation of the review page.
import {useAdyenReviewPage} from '@adyen/adyen-salesforce-pwa' const ReviewPage = () => { const {data: basket} = useCurrentBasket() const customerId = useCustomerId() const {getTokenWhenReady} = useAccessToken() const {site} = useMultiSite() const navigate = useNavigation() const [authToken, setAuthToken] = useState() useEffect(() => { const getToken = async () => { const token = await getTokenWhenReady() setAuthToken(token) } getToken() }, []) const {isLoading, isSubmitting, paymentData, error, submitPaymentDetails} = useAdyenReviewPage({ authToken, customerId, basketId: basket?.basketId, site, skip: !authToken || !basket?.basketId }) const handlePlaceOrder = async () => { if (!paymentData) return try { const response = await submitPaymentDetails() if (response?.isSuccessful && response?.isFinal) { navigate(`/checkout/confirmation/${response?.merchantReference}`) } else { // Handle payment failure } } catch (err) { // Handle error } } return ( // Render order review UI <Button onClick={handlePlaceOrder} isLoading={isSubmitting}> Place Order </Button> ) }
Google Pay
Enable Google Pay in your test Customer Area. You do not need additional configuration for the standard Google Pay flow. Adyen automatically forwards themerchantId and gatewayMerchantId to the component.To enable Google Pay in the live environment, get your Google Merchant ID and register your storefront origins in your Google Pay & Wallet Console.Google Pay express
Google Pay express is supported on v4.3.0 and later of the package. With Google Pay express, your shoppers can complete their purchases from the cart or product detail pages without going through the regular multi-step checkout. The component opens the Google Pay sheet to collect the shipping address, shipping method, and payment method, and then authorizes the payment through Adyen.Requirements
- Configure shipping methods per market in Salesforce Commerce Cloud. If
/api/adyen/shipping-methodsdoes not return any applicable methods for the selected address, the Google Pay sheet shows aSHIPPING_ADDRESS_UNSERVICEABLEerror. - Make sure the storefront uses locales whose country part matches a country supported by Google Pay. The component derives the country code from the last two characters of
locale.id, for example en-US maps to US.
Add the Google Pay express component
-
Add the Adyen PWA Google Pay express checkout component in your Retail React App page where you want to enable Google Pay express.
- Cart page:
cart-cta.jsx. Pass the currentbasketto the component. - Product detail page: set
isExpressPdpto true. Pass aproductobject that containsid,price,quantity, and any requiredvariationAttributes. Also pass thecurrency. The component creates a temporary basket through the Adyen package, so the shopper’s main basket is not modified if they abandon the flow.
import {GooglePayExpress} from '@adyen/adyen-salesforce-pwa' <GooglePayExpress authToken={authToken} customerId={customerId} locale={ {id: 'en-US'} } site={siteConfig} navigate={navigate} currency="USD" isExpressPdp={true} merchantDisplayName={'Merchant name'} product={ { // Only required for the express flow on the product detail page id: 'product-123', price: 99.99, quantity: 1, variationAttributes: {...} } } onError={[handleError]} configuration={ { buttonColor: 'black', buttonType: 'pay', buttonRadius: 4 } } spinner={<LoadingSpinner />} /> - Cart page:
-
To add the Google Pay express button on your cart page, pass the current
basketinstead ofisExpressPdp,currency, andproduct. Add the Google Pay express button to your cart pageimport {GooglePayExpress} from '@adyen/adyen-salesforce-pwa' <GooglePayExpress locale={locale} site={site} basket={basket} navigate={navigate} onError={[showError]} spinner={<LoadingSpinner />} /> -
Use the following properties to configure the component:
The component is silently not mounted on browsers or devices that do not support Google Pay.
Property Type Required Description localeObject 
The locale object. The locale.idis forwarded to AdyenWeb and used to derive the Google PaycountryCode.siteObject 
The current site object. basketObject Cart only The current basket. Required in cart mode and ignored when isExpressPdpis true.navigateFunction 
The React Router navigate function used to redirect to the order confirmation page. isExpressPdpBoolean Set to true to start the express flow on the product detail page. The component creates a temporary basket on click. currencyString PDP only The currency to use for the synthetic basket built from the product. Required when isExpressPdpis true.productObject PDP only The product object with id,price,quantity, and any requiredvariationAttributes. Required whenisExpressPdpis true.merchantDisplayNameString Display name shown in the Google Pay sheet. configurationObject Display overrides for the Google Pay button, for example buttonColor,buttonType, andbuttonRadius.onErrorArray of functions Callbacks invoked with errors from the environment, payment methods, shipping, or payment flow. spinnerNode Custom loader rendered while the environment, payment methods, or shipping methods are loading. authTokenString A pre-fetched SCAPI access token. If not provided, the component fetches one with useAccessToken.customerIdString A pre-fetched customer ID. If not provided, the component fetches one with useCustomerId.
See also
Next steps
Customization guide
Check our customization guide to learn how you can modify your integration.
Configure your live account
Required. Follow this checklist before you start accepting live payments.