EC SFRA Integration Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 47
At a glance
Powered by AI
The key takeaways from the document are that it provides an overview and implementation guide for integrating PayPal payments into a Salesforce Commerce Cloud storefront.

The main features supported by the PayPal integration include Express Checkout, PayPal Credit, In-Context Checkout, IPN, Reference Transactions, and standalone API calls.

The different checkout and payment options described are PayPal Express Checkout from the cart and payment pages, PayPal Credit, In-Context Checkout from the cart and payment pages, and IPN.

PayPal Integration Guide

FOR SALESFORCE COMMERCE CLOUD


Table of Contents
1 Summary ................................................................................................. 1

2 Component Overview ............................................................................. 1


2.1 Supported Features ............................................................................................... 1
2.2 Functional Overview .............................................................................................. 2
2.2.1 PayPal Express Checkout from Cart and Payment Page ............................. 2
2.2.2 PayPal Credit ................................................................................................ 2
2.2.3 In-Context Checkout from Cart and Payment Page...................................... 3
2.2.4 IPN ................................................................................................................ 4
2.2.5 Reference Transactions ................................................................................ 4
2.2.6 Stand-alone API Calls ................................................................................... 4
2.3 Use Cases ............................................................................................................. 5
2.4 Headings and Constraints...................................................................................... 5
2.5 Compatibility .......................................................................................................... 5
2.6 Privacy and Payment ............................................................................................. 5

3 Implementation Guide ............................................................................. 5


3.1 Setup...................................................................................................................... 5
3.1.1 PAYPAL Payment Processor Script ............................................................. 6
3.1.2 IPN-Listener Controller Method .................................................................... 6
3.2 Configuration.......................................................................................................... 6
3.2.1 Installing the Cartridge .................................................................................. 6
3.2.2 Adding API Credentials ................................................................................. 7
3.2.3 Adding the Payment Options (Express Checkout and PayPal Credit) ....... 10
3.2.4 Updating PayPal Credit Banner Preferences.............................................. 11
3.2.5 Updating Cartridge Custom Site Preferences ............................................. 11
3.3 Customizing Code................................................................................................ 15
3.4 External Interfaces ............................................................................................... 15
3.4.1 Using Services ............................................................................................ 15
3.4.2 API Calls ..................................................................................................... 16
3.4.3 Controller Version ....................................................................................... 16
3.4.4 API Call Data Examples.............................................................................. 17
3.5 Testing ................................................................................................................. 18

4 Operations and Maintenance ............................................................... 18


4.1 Data Storage ........................................................................................................ 18
4.2 Logs ..................................................................................................................... 18
4.3 Availability ............................................................................................................ 19
4.4 Support ................................................................................................................ 20

5 User Guide ............................................................................................ 20


5.1 Roles and Responsibilities ................................................................................... 20
5.2 Business Manager ............................................................................................... 21
5.3 Storefront Functionality ........................................................................................ 28

6 Financing Options API (Installment Calculator – for UK merchants


only) ............................................................................................................. 32
6.1 Supported Features ............................................................................................. 32
6.2 Functional Overview ............................................................................................ 32
6.2.1 Framework for making any PayPal API call ................................................ 32
6.2.2 Methods for easily retrieving the Financing Options data ........................... 33
6.3 Presentment examples ........................................................................................ 35

Copyright ©2018 PayPal Inc. All rights reserved. Summary | i


6.3.1 Common integration points for all presentment examples .......................... 35
6.3.2 Presentment for category page................................................................... 37
6.3.3 Presentment for product details page ......................................................... 38
6.4 Configuration........................................................................................................ 40
6.4.1 Service configuration and credentials ......................................................... 40
6.4.2 Presentments visibility configuration ........................................................... 41

7 PayPal Marketing Solutions .................................................................. 41


7.1 Overview .............................................................................................................. 41
7.2 Integration points ................................................................................................. 42

8 Known Issues ........................................................................................ 44

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.

Copyright ©2018 PayPal Inc. All rights reserved. Summary | ii


1 Summary
This Implementation Guide describes how to integrate int_paypal_sfra version
18.2.0 and bm_paypal into Commerce Cloud reference application Store Front
Reference Architecture (SFRA).

The int_paypal_sfra and bm_paypal components support the following:

• PayPal Express Checkout from the Cart


• PayPal Express Checkout from the Payment page
• PayPal Credit
• Instant Payment Notification (IPN, which should be extended depending on your needs)
• In-Context checkout
• Reference Transactions
• Various standalone API calls

For more information, contact your PayPal support manager.

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

2.1 Supported Features

Express Checkout Mark and Express Checkout Shortcut support the following
features:

• PayPal Credit Button and Banners


• Order, Authorization, and Capture
• Authorization and Capture
• Refund
• Void
• Line Item Details
• Pending Payments
• Reference Transactions
• In-Context checkout experience
• Mobile Express Checkout
• Billing Address Requests
• Ship to Store
• Address Override
• Foreign Currency

Copyright ©2018 PayPal Inc. All rights reserved. Summary | 1


2.2 Functional Overview

The following diagram is a high-level view of the integration, which uses the
general PayPal Express Checkout flow.

2.2.1 PayPal Express Checkout from Cart and Payment Page

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.

Figure 1. Express Checkout Flow

In the Express Checkout flow, the buyer:

1. Chooses Express Checkout by clicking Checkout with PayPal.


2. Logs into PayPal to authenticate their identity.
3. Reviews the transaction on PayPal.
4. Confirms the order and pays on your site.
5. Receives an order confirmation.

On mobile devices, Express Checkout provides payment pages tailored for faster
checkout and for smaller mobile screens and keyboards.

To learn more about Express Checkout, see NVP/SOAP Express Checkout on


the PayPal Developer Portal.

2.2.2 PayPal Credit

PayPal Credit is a reusable credit line available on purchases at thousands of


stores that accept PayPal. It’s currently available to merchants in the United
States. It's available for purchases at thousands of other online stores. In addition,
it comes with the same security and flexibility you trust from PayPal.

To learn more, see the PayPal Credit home page.

Copyright ©2018 PayPal Inc. All rights reserved. Component Overview | 2


2.2.3 In-Context Checkout from Cart and Payment Page

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).

Figure 2. Express Checkout In-Context Flow

Figure 3. Mobile Flow – Displays a Mobile-optimized Full-page Checkout Window

Copyright ©2018 PayPal Inc. All rights reserved. Component Overview | 3


Figure 4. In-Context Checkout

To learn more about In-Context Checkout, see NVP/SOAP Integration.

2.2.4 IPN

Instant Payment Notification (IPN) is a messaging service that notifies you of


events related to PayPal transactions. You can use IPN messages to automate
Business Manager and administrative functions, such as fulfilling orders, tracking
customers, or providing status and other transaction-related information.

The current implementation of IPN affects Order Payment Transaction custom


attributes that indicate PayPal payment status and transaction history. You can
extend IPN functionality by adding a new method to the lpn.js controller.

Refer here for more details about IPN feature.

2.2.5 Reference Transactions

The PayPal Billing Agreement (Reference Transactions) feature helps customers


to pay more quickly. This feature allows buyers to accept a Billing Agreement for
future payments. If a buyer accepts Billing Agreements with your site, they can
check out without redirection to PayPal, both from the Cart and Billing page.

To learn more, see Reference transactions.

2.2.6 Stand-alone API Calls

The int_paypal_sfra/bm_paypal cartridge provides various classic API calls, such


as DoAuthorization, DoCapture, DoVoid, GetTransactionDetails, and so on.
PayPal API version 121.0 is used.

Copyright ©2018 PayPal Inc. All rights reserved. Component Overview | 4


2.3 Use Cases

PayPal has developed the following use cases for the int_paypal_sfra/bm_paypal
cartridge:

• Express Checkout from Cart.


• Express Checkout from the Payment page.
• PayPal Credit from the Cart.
• PayPal Credit from Payment page.
• In-Context Checkout from the Cart.
• In-Context Checkout from the Payment Page.
• Accept Billing Agreement with Reference Transactions.
• Use Billing Agreements through checkout.

2.4 Headings and Constraints

The int_paypal_sfra/bm_paypal cartridge doesn’t support the multi-shipping


functionality in Store Front Reference Architecture (SFRA).

2.5 Compatibility

The int_paypal_sfra/bm_paypal cartridge has been available since Commerce


Cloud version 18.1.

The cartridge is presented as a LINK integration solution for Store Front


Reference Architecture (SFRA) v2, what implies absence of any modifications into
the storefront cartridge code.

2.6 Privacy and Payment

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

Two cartridges support this integration:

1. int_paypal_sfra – Commerce Cloud storefront extension cartridge


2. bm_paypal – Business Manager extension “PayPal Transactions” cartridge

The following sub-sections describe the entry points for the integration.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 5


3.1.1 PAYPAL Payment Processor Script

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.1.2 IPN-Listener Controller Method

This is used for listening incoming Instant Payment Notifications.

3.2 Configuration

To integrate PayPal Express, PayPal Credit or Instant Payment Notifications, you


need to add int_paypal_sfra to your target site cartridge path.

To integrate PayPal Transactions Business manager extension, you need to add


the bm_paypal and int_paypal_sfra cartridges to your Business Manager
cartridge path.

3.2.1 Installing the Cartridge

Here’s how:

1. Upload int_paypal_sfra and bm_paypal to your CI or development sandbox. Apply the


standard flow used to upload cartridges to your environment.
2. Upload and import metadata from the metadata folder. To do so, go to Business
Manager > Administration > Site Development > Site Import & Export. Then apply
the standard procedure for uploading metadata into the Commerce Cloud site. You can
compress metadata to a .zip archive (Figure 5) or upload it via XML files and import it
separately.

Figure 5. Metadata .zip Archive

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

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 6


insert int_paypal_sfra before your cartridges record, as shown in Figure 6. (For
example, int_paypal_sfra:app_storefront_core)

Figure 6. Store Front Reference Architecture (SFRA)Path with int_paypal_sfra

4. Optionally, if you need to integrate Business Manager Extension PayPal Transactions,


insert int_paypal_sfra and bm_paypal into the record of the Business Manager
cartridge path. To do so, in Commerce Cloud go to Business Manager >
Administration > Sites > Manage Sites >Manage the Business Manager Site >
Settings and insert bm_paypal:int_paypal_sfra before your cartridges record. (See
Figure 7.)

Figure 7. Business Manager Cartridge Path, Updated

3.2.2 Adding API Credentials

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

However, there is no any requirements to number of credentials IDs used by


int_paypal_sfra/bm_paypal, and you are free to create as many credentials objects as it
is needed for your organization (single PayPal account for all online stores versus
multiple accounts).
For the needs of default integration of int_paypal_sfra/bm_paypal you may create one
service credentials object with any id.

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.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 7


3. If Signature is used, you need to uncheck “Use certificate” checkbox and fill “API
Signature” field.

Example of view Credential using Signature

4. If Certificate is used, you need to check “Use certificate” checkbox and upload Certificate.

Example of view Credential using 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/.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 8


Figure 8. PayPal API Credentials Certificate in the Commerce Cloud Keychain

5. Configure the int_paypal.http.nvp.payment.PayPal.MobileFirst service to use service


credentials object you configured prior.
6. Enable the communication log for the int_paypal.http.nvp.payment.PayPal.MobileFirst
service. The Communication log will log every request and response to the log files.

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:

a. Go to Business Manager > Administration > Organization > Roles &


Permissions and select the target role that needs to have access to PayPal
Transaction management.
b. Select the Business Manager Modules tab in the drop-down list on top. You must
select your target site as the active context. (See Figure 10.)
c. Scroll to the PayPal Transactions module. Grant access to it by checking the
checkbox and clicking Update.

Once you do this, every Business Manager user with that role can manage PayPal
Transactions by selecting Business Manager > Merchant Tools> Ordering > PayPal
Transactions.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 9


Figure 10. Select Context

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.

NOTE: You’ll find images in the repository folder.

Figure 11. PAYPAL Payment Processor

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 10


Figure 12. PayPal Payment Instrument Configuration

3.2.4 Updating PayPal Credit Banner Preferences

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:

o Campaign ID for PayPal credit banner preference ID by Commerce Cloud Campaign


ID.
o PayPal Credit Banner Width.
o PayPal Credit Banner Height.

You’ll find dimensions for the PayPal Credit banner on the PayPal Financing
Portal at https://financing.paypal.com/ppfinportal/adGenerator/webSize.

NOTE: The Portal requires you to sign in.

Your PayPal Credit banners will be shown according to your Campaign settings.

3.2.5 Updating Cartridge Custom Site Preferences

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.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 11


Figure 13. PayPal Custom Site Preferences

2. Click View for PayPal Express Checkout. Then select your preferred settings for the
preferences shown in Figure 14:

o Enable PayPal Express Checkout on the cart page


o Payment Action
o Reference Transaction Payment Action
o Run Authorization in Case of Order
o Billing Agreement State
o Billing Agreement Description
o Billing Agreement Type
o Billing Agreement Payment Type
o Shipping Address Override
o Retrieve Billing Address From PayPal
o Accept only confirmed shipping addresses
o Express Checkout Solution Type
o Express Checkout Landing Page
o Display shipping address state
o Allow Multiple Capture
o Write IPN notifications to the Logs
o Cart Button Configuration
o Billing Button Configuration

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 12


Figure 14. PayPal Express Checkout Custom Site Preferences

3. Configure the PayPal Branding preferences shown in Figure 15:

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 13


o Payer ID
o Merchant Publisher ID
o Brand Name
o Logo image URL
o Campaign ID for PayPal credit banner
o PayPal Credit Banner Width
o PayPal Credit Banner Height
o PayPal Marketing Solutions ID
o Enable PayPal UK Credit Financial Options Banners
o Password to enable PayPal UK Credit Financial Options Banners

Figure 15. PayPal Branding Custom Site Preferences

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.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 14


3.3 Customizing Code

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.

3.4 External Interfaces

3.4.1 Using Services

The main configuration for the integration of PayPal services is the


int_paypal.http.nvp.payment.PayPal.CustomSiteID service, which you’ll find
under Business Manager > Administration > Operations > Services. (See
Figure 16.)

Figure 16. int_paypal.http.nvp.payment.PayPal.CustomSiteID

NOTE: Your service should be postfixed by .CustomSiteID (dot CustomSiteID)


and your credentials should be postfixed by _CustomSiteID (underscore
CustomSiteID), where CustomSiteID is your site ID in the Commerce
Cloud system. (For example,
int_paypal.http.nvp.payment.PayPal.CustomSiteID).
NOTE: If merchant credentials must be separated for different currency on the
same site, the configuration service ID must be
int_paypal.http.nvp.payment.PayPal.CustomSiteID.CurrencyCode
(For example: int_paypal.http.nvp.payment.PayPal.MobileFirst.EUR,
int_paypal.http.nvp.payment.PayPal.MobileFirst.BRL).
If for some currency there is no appropriate service, default service
(without .CurrencyCode postfix) will be used.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 15


You can edit the Log Name Prefix, enable Communication Logs, and the Change
Credentials record for this service. This cartridge ships with four credentials
records that you should replace with your credentials. Depending on your
preferred authentication method (API Certificate or API Signature), you must
select either the Certificate credentials or the Signature credentials record. If you
want to run PayPal integration with the PayPal Sandbox environment, you must
select either the Sandbox or the Production credentials record.

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.

3.4.2 API Calls

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

3.4.3 Controller Version

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

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 16


integration to SFRA. However, you still need to configure custom preferences, as
shown in the following example:

var paypalApi = require('int_paypal_sfra/cartridge/scripts


/paypalApi.js');
var result = paypalApi.doVoid({
authorizationID: 'R34ss2d88gXww0045777700sssD',
note: 'Some note'
});
/*
success result
{
requestContainer: requestContainer,
responseData: responseData//Response data
}
error result
{
error: true
}
*/

3.4.4 API Call Data Examples

NOTE: For a detailed description of parameters, see PayPal Name-Value Pair


API Basics.

API Operation Description


SetExpressCheckout Initiates an Express Checkout transaction.

DoExpressCheckoutPayment Completes an Express Checkout transaction. If you set


up a billing agreement in your SetExpressCheckout
API call, the billing agreement is created when you call
the DoExpressCheckoutPayment API operation. The
DoExpressCheckoutPayment API operation
completes an Express Checkout transaction. If you set
up a billing agreement in your SetExpressCheckout
API call, the billing agreement is created when you call
the DoExpressCheckoutPayment API operation.

GetTransactionDetails Obtains information about a specific transaction.

DoAuthorization Authorizes a payment. (More about authorization and


capture)

DoVoid Voids an order or an authorization.

DoCapture Captures an authorized payment.

RefundTransaction Issues a refund to the PayPal account holder


associated with a transaction. This API operation can
be used to issue a full or partial refund for any
transaction within a default period of 60 days from
when the payment is received.

Copyright ©2018 PayPal Inc. All rights reserved. Implementation Guide | 17


API Operation Description
DoReferenceTransaction Processes a payment from a buyer's account, which is
identified by a previous transaction.

TransactionSearch Searches transaction history for transactions that meet


the specified criteria.

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 Operations and Maintenance

4.1 Data Storage

The int_paypal_sfra integration requires System Objects Extension to store


payment-related information.

OrderPaymentInstrument custom properties:


• paypalAck – Result of a payment action (Auth, Order, Sale).
• paypalCorrelationId – The reference ID for PayPal API calls.
• paypalPayerID – The PayPal Payer ID in the PayPal service.
• paypalPaymentStatus – PayPal payment status.
• paypalToken – Used to identify Set, Get, Do ExpressCheckout API calls. Helps to
identify payments.
• paypalCredit – Indicates if this transaction used PayPal Credit.

Profile custom properties:


• paypalBillingAgreementId – The PayPal Billing Agreement ID.

Order custom properties:


• paypalPaymentMethod – Property to differentiate Express Checkout.

PaymentTransaction custom properties:


• transactionsHistory – History of PayPal transactions related to the actual payment
transaction.

4.2 Logs

This integration introduces a few new custom logs:

1. PayPal Custom logs – Such as the Custom-PayPal-blade2-2-appserver-20150722.log.


This Log file contains all errors related information in the int_paypal_sfra and bm_paypal
cartridges.
2. PayPal Instant Payment Notification logs – Such as the Custom-PayPalNotifications-
blade2-2-appserver-20150723.log. This log file contains IPN data (incoming IPN

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.

Figure 17. PayPal Service Availability Chart

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.

Figure 18. PayPal Service Profile Settings

4.4 Support

Here’s how to get help and support from PayPal:

• 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

5.1 Roles and Responsibilities

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.

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 20


5.2 Business Manager

This integration introduces a new Business Manager function, PayPal


Transactions. See the section “Installing API Credentials” in this document for a
detailed description of how to grant access to the PayPal Transactions page.

The PayPal Transactions extension allows you to manage PayPal transactions


assigned to Commerce Cloud Orders by the Commerce Cloud Business
manager.

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.

This page displays various information from the order record:

Figure 19. PayPal Transactions Business Manager Main Page Interface

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).

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 21


Figure 20. Search Orders with PayPal Transaction by Commerce Cloud Order Number

Figure 21. Search Orders with PayPal Transaction by Transaction ID

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).

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 22


Figure 22. Transaction Details Popup

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):

• Create Sale Transaction


• Create Authorization Transaction
• Capture
• Void
• Issue Refund

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 23


Figure 24. Payment Actions (1 of 3)

Figure 25. Payment Actions (2 of 3)

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 24


Figure 26. Payment Actions (3 of 3)

Figure 27. Create Authorization Transaction Form

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 25


Figure 28. Void Authorization Form

Figure 29. Capture Form

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 26


Figure 30. Issue Refund Form

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.

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 27


Figure 31. IPN URL Configuration

To learn more about configuring IPN, see Identifying Your IPN Listener to PayPal.

5.3 Storefront Functionality

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).

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 28


Figure 32. Shipping Cart with PayPal Express Checkout Mark and PayPal Credit Mark

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/.)

To enable Reference Transactions for checkout, you need to configure your


Billing Agreement State custom preference. You’ll find it under Business

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 29


Manager > Merchant Tools > Site Preferences > Custom Site Preferences >
PayPal Express Checkout. (See Figure 34.)

Figure 34. Billing Agreement Options

If you enable a Billing Agreement, the buyer can save their PayPal account during
checkout on the Payment page.

Figure 35. Billing Agreement on the PayPal Side

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 30


Figure 36. Billing Agreement Checkbox

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.

Copyright ©2018 PayPal Inc. All rights reserved. User Guide | 31


Figure 38. Billing Agreement Checkbox

6 Financing Options API (Installment


Calculator – for UK merchants only)
Financing calculator feature is only available for PayPal merchants based out of
UK. Please reach out to Braintree/PayPal support to enable this feature for your
account and get further details.

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.

6.1 Supported Features

The int_paypal integration includes following:

• Framework for making any PayPal API call


• Methods for easily retrieving the Financing Options data
• Presentment examples

6.2 Functional Overview

6.2.1 Framework for making any PayPal API call

To make any call to PayPal REST API needs to use paypalRestApi.js


module. This module has method call(methodType, path, data,
contentType).

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'
}
});

Details of all PayPal REST API methods see by the link


https://developer.paypal.com/docs/api/overview/

Before making calls the service configuration and credentials should be


configured.

6.2.2 Methods for easily retrieving the Financing Options data

Below are excerpts of the API request:

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');

The variable allOptionsData will contain:

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');

The variable allOptions will contain:

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');

The variable lowestCost will contain:

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&currencyCode=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.

6.3 Presentment examples

6.3.1 Common integration points for all presentment examples

All presentment examples require including


paypalCreditFinancingOptions.js and
paypalCreditFinancingOptions.css files.

For StoreFront it can be done in 2 steps:

1. Insert the static files in appropriate layout template

<isscript>
var assets = require('*/cartridge/scripts/assets');

assets.addJs('/js/paypalCreditFinancingOptions.js');

assets.addCss('/css/paypalCreditFinancingOptions.css');
</isscript>

2. Include a presentment template in that template where a presentment banner


should be shown and set paypalCalculatedCost page variable.

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"/>

After rendering it will look like the following figure:

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).

6.3.2 Presentment for category page

The integration point for category page is to include


paypalCreditFinancingOptions/lowerCostPerMonth template into
productTile.isml and to set according cost for paypalCalculatedCost
variable.

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"/>

<isif condition="${pdict.display.ratings !==


false}">
<isinclude template="product/productTileFooter"
/>
</isif>

6.3.3 Presentment for product details page

The integration point for PDP is to include paypalCreditFinancingOptions/


lowerCostPerMonthBanner template into descriptionAndDetails.isml
and to set according cost for paypalCalculatedCost variable.

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"/>

<div class="row product-attributes collapsible-xs">


<isinclude template="product/components/attributes"
/>
</div>

Clicking on “Click for details”, will extend the banner.

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

6.4.1 Service configuration and credentials

1. Go to Business Manager > Administration > Operations > Services >


Credentials. Create new credentials for PayPal REST API. Fields Name,
URL, User, Password are required.

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}.

6.4.2 Presentments visibility configuration

The configuration page Business Manager > Merchant Tools > Site
Preferences > Custom Site Preferences > PayPal Branding has two fields
related with this functionality:

1. Enable PayPal UK Credit Financial Options Banners – solves visibility of


all presentments.

2. Password to enable PayPal UK Credit Financial Options Banners –


should be set password which was provided by your PayPal representative.

7 PayPal Marketing Solutions

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.

For more information visit https://www.paypal.com/marketingsolutions.

Copyright ©2018 PayPal Inc. All rights reserved. PayPal Marketing Solutions | 41
7.2 Integration points

Implementing this feature requires to first include a template in an appropriate


StoreFront template and then to set one configuration field in Business Manager.

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"/>

If banner should be on specific pages, the template


paypal/marketingSolutions must be included into a appropriate decorator
or common templates.

Second required step is setting PayPal Marketing Solutions ID configuration


field in Business Manager > Merchant Tools > Site Preferences > Custom
Site Preferences > PayPal Branding.

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.

Copyright ©2018 PayPal Inc. All rights reserved. Known Issues | 44

You might also like