EC SFRA Integration Guide
EC SFRA Integration Guide
EC SFRA Integration Guide
Copyright Information
© 2018 PayPal, Inc. All rights reserved.
PayPal is a registered trademark of PayPal, Inc. The PayPal logo is a trademark of PayPal, Inc.
Other trademarks and brands are the property of their respective owners. The information in this
document belongs to PayPal, Inc. It may not be used, reproduced, or disclosed without the
written approval of PayPal, Inc.
Copyright © PayPal. All rights reserved. PayPal (Europe) S.à r.l. et Cie, S.C.A., Société en
Commandite par Actions. Registered office: 22-24 Boulevard Royal, L-2449, Luxembourg,
R.C.S. Luxembourg B 118 349
Consumer advisory: The PayPal™ payment service is regarded as a stored value facility under
Singapore law. As such, it does not require the approval of the Monetary Authority of Singapore.
You are advised to read the terms and conditions carefully.
Notice of Non-Liability
PayPal, Inc. is providing the information in this document to you “AS-IS” with all faults. PayPal,
Inc. makes no warranties of any kind (whether express, implied or statutory) with respect to the
information contained herein. PayPal, Inc. assumes no liability for damages (whether direct or
indirect), caused by errors or omissions, or resulting from the use of this document or the
information contained in this document or resulting from the application or use of the product or
service described herein. PayPal, Inc. reserves the right to make changes to any information
herein without further notice.
Integration of the cartridge into your storefront application does not imply
modifications of core cartridge, SFRA approach of files overwriting should be used
instead.
2 Component Overview
Express Checkout Mark and Express Checkout Shortcut support the following
features:
The following diagram is a high-level view of the integration, which uses the
general PayPal Express Checkout flow.
PayPal Express Checkout allows users to check out from both the Shopping Cart
and Billing pages. During Express Checkout, users are redirected to the PayPal
login page. After authentication, the user is redirected to your website to continue
the checkout process by selecting a shipping method and placing their order. A
typical checkout process flow would include entering a shipping address, a billing
address, and payment information. PayPal provides the shipping address in the
Express Checkout flow.
Express Checkout makes it easier for buyers to pay online. It also enables you to
accept PayPal while retaining control of the buyer and the overall checkout flow.
On mobile devices, Express Checkout provides payment pages tailored for faster
checkout and for smaller mobile screens and keyboards.
In-Context checkout keeps your website in view while providing customers with a
streamlined and tightly-integrated checkout experience. The checkout experience
takes place in the popup window (mini-browser).
2.2.4 IPN
PayPal has developed the following use cases for the int_paypal_sfra/bm_paypal
cartridge:
2.5 Compatibility
This integration requires access to the following customer data elements: Billing
Address, Shipping Address, Order Details, Customer Profile and some custom
properties of Customer Payment Instruments.
3 Implementation Guide
3.1 Setup
The following sub-sections describe the entry points for the integration.
int_paypal_sfra/cartridge/scripts/hooks/payment/processor/pa
ypal.js provides the Payment Processor interface to Commerce Cloud for
PayPal Express Checkout or PayPal Credit features. It’s used for the SFRA
payment processor mechanism.
This controller contains common Handle and Authorize methods (start nodes),
and is called through the payment flow in the SFRA CheckoutServices controller.
3.2 Configuration
Here’s how:
3. Insert int_paypal_sfra into the cartridge path of a target site. To do so, go to Business
Manager > Administration > Sites > Manage Sites > Your Target Site > Settings and
After installing the cartridge, you need to configure service and update PayPal
credentials (your API Signature and API Certificate). Here’s how:
1. Go to Business Manager > Administration > Operations > Services > Credentials.
Following recommended credentials objects may be listed to distinguish various types of
authorization that can be applied to int_paypal_sfra/bm_paypal:
o PayPal_Sandbox_Certificate_Credentials_MobileFirst
o PayPal_Production_Certificate_Credentials_MobileFirst
o PayPal_Sandbox_Signature_Credentials_MobileFirst
o PayPal_Production_Signature_Credentials_MobileFirst
2. Update credentials record(s), using the exact credentials from your PayPal merchant
account. You should specify PayPal API Username (User field) and PayPal API
Password (Password field) and chose to use either API Signature or Certificate.
4. If Certificate is used, you need to check “Use certificate” checkbox and upload Certificate.
Upload your API Certificate (only if you will use API Certificate authentication). To do this,
go to Business Manager > Administration > Operations > Private Keys, click Import,
and follow the flow shown in Figure 9.
NOTE: You must provide a *.p12 private key. To generate one, you can use
the OpenSSL utility. For details, see
https://developer.paypal.com/docs/classic/api/apiCredentials/.
Figure 9. int_paypal.http.nvp.payment.PayPal.CustomSiteID
7. Grant access to PayPal Transactions (the BM Extension feature) to the target roles (and
optionally, for the Business Manager “PayPal Transactions” extension). Here’s how:
Once you do this, every Business Manager user with that role can manage PayPal
Transactions by selecting Business Manager > Merchant Tools> Ordering > PayPal
Transactions.
3.2.3 Adding the Payment Options (Express Checkout and PayPal Credit)
You must create Payment Processor record and configure the Payment Methods
to be used. Here’s how:
1. Go to Business Manager > Merchant Tools > Ordering > Payment Processors.
2. Create payment processor PAYPAL. (See Figure 11.)
3. Update Payment Instruments to use the PAYPAL payment processor. (See Figure 12)
4. Select your target site and go to Business Manager > Merchant Tools > Ordering >
Payment Methods.
5. Create or select the PayPal Payment Method and select PAYPAL as the Payment
Processor. This will be used for PayPal Express Checkout or PayPal.
6. Click Select near the Image field and upload pp-acceptance-small.png. Select this
image for this payment method.
Optionally, you can modify the appearance of the PayPal Credit banner. Here’s
how:
1. Go to Business Manager > Merchant Tools > Site Preferences > Custom Site
Preferences > PayPal Branding.
2. Set your preferences for the following:
You’ll find dimensions for the PayPal Credit banner on the PayPal Financing
Portal at https://financing.paypal.com/ppfinportal/adGenerator/webSize.
Your PayPal Credit banners will be shown according to your Campaign settings.
Here’s how:
1. Go to Business Manager > Merchant Tools > Site Preferences > Custom Site
Preferences. You’ll see two new Custom Site Preference Groups (See Figure 13, Figure
14, and Figure 15.) Each preference has its own description.
2. Click View for PayPal Express Checkout. Then select your preferred settings for the
preferences shown in Figure 14:
NOTE: If you don’t check (select) the preferences “Shipping Address Override”
and “Accept only confirmed shipping addresses,” you won’t be able to
select the option “PayPal does not display shipping address fields
whatsoever” for the “Display shipping address state” preference.
Store Front Reference Architecture (SFRA) does not imply modification of core
cartridge to enable any of LINK integration cartidges. int_paypal_sfra/bm_paypal
follows best practices recommended by Salesforce, thus no any code changes
are required for the default installation.
If you’re using Signature as your PayPal API Credential, update the PayPal
Signature in Service Credentials object. To do so, select Business Manager >
Administration > Services > Credentials and update Service Credentials object
used by Service Definition int_paypal.http.nvp.payment.PayPal.CustomSiteID.
If you’re using Certificate as your PayPal API Credential, you need to check the
appropriate checkbox in Service Credentials object used by Service Definition
int_paypal.http.nvp.payment.PayPal.CustomSiteID. Make sure there is a
certificate uploaded via Business Manager > Administration > Operations >
Private Keys and Certificates.
NOTE: Commerce Cloud uses a cache for service initialization scripts, so the
credentials record will be cached. To run service initialization after
updating your services credentials or Signature, switch to a different code
version and then switch back to the original version. This action will
trigger the service initialization scripts.
All requests are formed as Name=Value strings, separated by &. This format is
called NVP. To learn more about NVP, visit the PayPal Developer Portal page
PayPal Name-Value Pair API Basics.
This PayPal Integration cartridge supports the following PayPal Classic API calls:
• SetExpressCheckout
• GetExpressCheckoutDetails
• DoExpressCheckoutPayment
• GetTransactionDetails
• TransactionSearch
• DoAuthorization
• DoReauthorization
• DoVoid
• DoCapture
• RefundTransaction
• DoReferenceTransaction
• BillAgreementUpdate
Each of the API calls listed under API Calls is implemented as a stand-alone
method of the paypalApi module and can be invoked from external code without
3.5 Testing
You must obtain your own test account on the PayPal Developer Portal. If you
can’t create your own PayPal Sandbox account, contact PayPal support.
4.2 Logs
Copyright ©2018 PayPal Inc. All rights reserved. Operations and Maintenance | 18
messages). You can enable these logs in the Site Preferences by writing IPN
notifications to the Logs (via Merchant Tools > Site Preferences > Custom Site
Preferences > Paypal General Configuration).
3. Service communication logs –These logs contain every request and response to the
PayPal endpoint. To enable these logs, go to Administration > Operations > Services
> int_paypal.http.nvp.payment.PayPal.CustomSiteID and check the Communication
Log Enabled preference. service-PayPalHttpNvp-blade2-2-appserver-20150730.log is
an example of the service communication logs.
All log files are located in the Logs folder (under Administration > Site
Development > Development Setup > Logs). For example: https://paypal01-
tech-prtnr-na01-dw.demandware.net/on/demandware.servlet/webdav/Sites/Logs.
4.3 Availability
You can track availability by service status in the Commerce Cloud Business
Manager. (Go to Administration > Operations > Service Status >
int_paypal.http.nvp.payment.PayPal.CustomSiteID.) See Figure 17.
Copyright ©2018 PayPal Inc. All rights reserved. Operations and Maintenance | 19
You can configure any availability options related to this PayPal integration via the
Commerce Cloud Service Profile Interface. (To do this, go to Administration >
Operations > Services > Service Profiles.). You can set a timeout for all
requests, enable the Circuit Breaker mechanism, and adjust the Rate Limit. Use
thePayPal_Default_Profile (shown in Figure 18) for this.
4.4 Support
• PayPal Business support − Go to PayPal’s Common Questions and Help Topics page
and log in to your PayPal account.
• Technical Support − Go to the Merchant Technical Support home page.
• PayPal Site Notifications − Go to PayPal’s Get Notified webpage.
5 User Guide
PayPal introduced no new roles with this integration. You’ll need to update
existing roles or create and update new ones if you want to use the Business
Manager extension PayPal Transactions.
The main PayPal Transactions page displays all orders in the Commerce Cloud
Site that were paid or partially paid by PayPal Express Checkout (and also PayPal
Credit). Functionality (See Figure 19.) You can access this page in the Ordering
menu by selecting Business Manager > Merchant Tools > Ordering > PayPal
Transactions.
You can search Orders placed within PayPal Express Checkout by the Commerce
Cloud Order Number (as shown in Figure 20) or by PayPal Transaction ID (as
shown In Figure 21).
You can see Transaction Details from the PayPal Payment Transaction of the
actual order by clicking Order Number or the Change link on the right. If an order
has more than one related transaction, you’ll see a selection box with all of the
transactions that are related to the current order (as shown in Figure 23).
Figure 23. PayPal Transactions Selected for Their Relationships to Commerce Cloud Order Transactions
Each type of transaction can have the following action buttons (shown in Figure
24, Figure 25, and Figure 26):
PayPal delivers all payment related statuses through IPN. After a merchant’s
action, PayPal sends an IPN message to the Commerce Cloud end point and,
depending on the status of this action, updates the order transaction.
You’ll need to configure your IPN settings in the PayPal account to send IPNs to
the Ipn-Listener controller action. (To do so, select Profile > My selling tools >
Instant Payment Notification.) Your URL to Ipn Listener should look like this:
https://your_instance_domain/path_to_site_if_so/your_locale/
Ipn-Listener.
Example: https://paypal01-tech-prtnr-na01-
dw.demandware.net/on/demandware.store/Sites-MobileFirst-Site/default/Ipn-
Listener.
NOTE: PayPal recommends that you configure the URL alias for this path in the
Commerce Cloud’s Business Manager.
To learn more about configuring IPN, see Identifying Your IPN Listener to PayPal.
This integration of the PayPal Payment Link cartridge provides several changes to
the Commerce Cloud Store Front Reference Architecture (SFRA) storefront:
1. PayPal Express Shortcut and PayPal Credit Shortcut on the Shopping Cart Page (Figure
32).
2. PayPal Express Mark and PayPal Credit Mark on the Payment Page (Figure 34).
Figure 33. Payment Method Select (1. Optional PayPal Express, 2. Optional PayPal Credit 3. PayPal Guest
Payment)
3. PayPal Reference Transactions. (For more information, visit the following page on the
PayPal Developer portal: https://developer.paypal.com/docs/classic/express-
checkout/integration-guide/ECReferenceTxns/.)
If you enable a Billing Agreement, the buyer can save their PayPal account during
checkout on the Payment page.
If a buyer previously saved their account during checkout and the checkbox “Use
my stored PayPal account to pay” is checked (this checkbox is checked by
default), the user won’t be redirected to PayPal. Instead, the PayPal Billing
Agreement will be used to fulfill the payment.
Figure 37. Billing Agreement Checkbox, with “Use my stored PayPal account to Pay” Checked
The buyer can either use regular PayPal payment, or create a new Billing
Agreement.
PayPal UK merchants can use this feature to present financing options, such as
installment, same-as-cash, and no-interest options, to buyers paying for goods or
services.
Example 1:
var paypalApi =
require('*/cartridge/scripts/paypal/paypalRestApi');
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 32
var responseData = paypalApi.call('GET', 'credit/active-
merchant-financing-options?country_code=US');
Example 2:
var paypalApi =
require('*/cartridge/scripts/paypal/paypalRestApi');
var responseData = paypalApi.call('POST',
'credit/calculated-financing-options', {
financing_country_code: 'US',
transaction_amount: {
value: 100.5,
currency_code: 'USD'
}
});
paypalApi.credit.getActiveMerchantFinancingOptions(countryCode)
var paypalApi =
require('*/cartridge/scripts/paypal/paypalRestApi');
var reponseData =
paypalApi.credit.getActiveMerchantFinancingOptions('US');
paypalApi.credit.getCalculatedFinancingOptions(requestData)
var paypalApi =
require('*/cartridge/scripts/paypal/paypalRestApi');
var reponseData =
paypalApi.credit.getCalculatedFinancingOptions({
financing_country_code: 'US',
transaction_amount: {
value: 100.5,
currency_code: 'USD'
}
});
creditFinancialOptionsHelper.getDataForAllOptionsBanner(costValue,
currencyCode, countryCode) – returns object with all options (INST-type) and
other helpful information
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 33
var creditFinancialOptionsHelper =
require('*/cartridge/scripts/paypal/paypalCreditFinancingOp
tionsHelper.js');
var allOptionsData =
creditFinancialOptionsHelper.getDataForAllOptionsBanner(100
.5, 'USD', 'US');
creditFinancialOptionsHelper.getDataForAllOptionsBanner(costValue,
currencyCode, countryCode, creditType) – returns all options by a credit type
var creditFinancialOptionsHelper =
require('*/cartridge/scripts/paypal/paypalCreditFinancingOp
tionsHelper.js');
var allOptions =
creditFinancialOptionsHelper.getAllOptions(100.5, 'USD',
'US', 'INST');
creditFinancialOptionsHelper.getDataForAllOptionsBanner(costValue,
currencyCode, countryCode, creditType) – returns lowest monthly payment
cost (INST-type)
var creditFinancialOptionsHelper =
require('*/cartridge/scripts/paypal/paypalCreditFinancingOp
tionsHelper.js');
var lowestCost =
creditFinancialOptionsHelper.getLowestPossibleMonthlyCost(1
00.5, 'USD', 'US');
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 34
Also, the integration provides 2 endpoints:
Sites-MobileFirst-Site/en_US/PaypalCreditFinancingOptions-
GetLowestPossibleMonthlyCost?value=89¤cyCode=USD&countryCode=US
/Sites-MobileFirst-Site/en_US/PaypalCreditFinancingOptions-
GetAllOptionsData?currencyCode=USD&isGetCartTotalAsValue=true
OR /Sites-MobileFirst-Site/en_US/PaypalCreditFinancingOptions-
GetAllOptionsData?currencyCode=USD&value=228
These methods and endpoints can be used for creating custom presentation of
Credit options.
<isscript>
var assets = require('*/cartridge/scripts/assets');
assets.addJs('/js/paypalCreditFinancingOptions.js');
assets.addCss('/css/paypalCreditFinancingOptions.css');
</isscript>
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 35
paypalCalculatedCost should contain cost value (type is dw.value.Money)
which will be used for Credit calculations.
Examples:
<isset name="paypalCalculatedCost"
value="${dw.value.Money(100, 'USD')}" scope="page"/>
<isinclude
template="paypalCreditFinancingOptions/lowerCostPerMonth"/>
OR
<isset name="paypalCalculatedCost"
value="${dw.value.Money(100.5, 'USD')}" scope="page"/>
<isinclude
template="paypalCreditFinancingOptions/lowerCostPerMonthBan
ner"/>
OR
<isset name="paypalCalculatedCost"
value="${dw.value.Money(69.99, 'USD')}" scope="page"/>
<isinclude
template="paypalCreditFinancingOptions/allOptionsBanner"/>
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 36
NOTE: These banners use PayPal REST API, the service configuration must be
done (see the part 6.4.1 Service configuration and credentials). Also, their
visibility is depended on configuration in Business Manager > Merchant
Tools > Site Preferences > Custom Site Preferences > PayPal Branding
(see the part 6.4.2 Presentments visibility configuration).
File templates/default/product/productTile.isml:
<iselse>
<isinclude
template="product/components/pricing/main" />
</isif>
<isset name="paypalCalculatedCost"
value="${product.price.type === 'range' ?
dw.value.Money(product.price.min.sales.value,
product.price.min.sales.currency) :
dw.value.Money(product.price.sales.value,
product.price.sales.currency)}" scope="page"/>
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 37
<isinclude
template="paypalCreditFinancingOptions/lowerCostPerMonth"/>
File templates/default/product/components/
descriptionAndDetails.isml
<div class="description-and-detail">
<isset name="paypalCalculatedCost"
value="${dw.value.Money(price.value, price.currency)}"
scope="page"/>
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 38
<isinclude
template="paypalCreditFinancingOptions/lowerCostPerMonthBan
ner"/>
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 39
NOTE: int_paypal_sfra contains a lot of examples how to use these banners
(search by “paypalCreditFinancingOptions” keyword)
6.4 Configuration
Copyright ©2018 PayPal Inc. All rights reserved. Financing Options API (Installment Calculator – for UK merchants only) | 40
2. Go to Business Manager > Administration > Operations > Services >
Services. Create new service for PayPal REST API. Name (ID) of service
must be int_paypal.http.rest.payment.PayPal.{SITE_ID}.
The configuration page Business Manager > Merchant Tools > Site
Preferences > Custom Site Preferences > PayPal Branding has two fields
related with this functionality:
7.1 Overview
Get powerful marketing tools designed to help increase your sales. Your PayPal
Business account now includes unique shopper insights and customizable
incentives from PayPal for your website, at no extra cost.
Copyright ©2018 PayPal Inc. All rights reserved. PayPal Marketing Solutions | 41
7.2 Integration points
Copyright ©2018 PayPal Inc. All rights reserved. PayPal Marketing Solutions | 42
If banner should be on all pages, the template paypal/marketingSolutions
must be included at the end of file
templates/default/common/scripts.isml
<script type="text/javascript"
src="${URLUtils.staticURL('/js/main.js')}"></script>
<isloop items="${
require('*/cartridge/scripts/assets.js').scripts }"
var="script">
<script type="text/javascript"
src="${script}"></script>
</isloop>
<isinclude template="paypal/marketingSolutions"/>
PayPal Marketing Solutions ID can be retrieved by visiting this link and clicking on
“Other”. It is posted in the url or in the code snippet as shown in the figure below.
Copyright ©2018 PayPal Inc. All rights reserved. PayPal Marketing Solutions | 43
8 Known Issues
No reported issues so far.