dw.extensions.payments
Class SalesforcePaymentsMgr
Object
dw.extensions.payments.SalesforcePaymentsMgr
Contains functionality for use with Salesforce Payments. See Salesforce Payments documentation for how to gain access and configure it for use on your sites.
Properties
paymentsSiteConfig  :  SalesforcePaymentsSiteConfiguration  (Read Only)
A payments site configuration object for the current site.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
static attachPaymentMethod(paymentMethod : SalesforcePaymentMethod, customer : Customer) : void
Attaches the given payment method to the given customer.
static detachPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void
Detaches the given payment method from its associated customer.
static getAttachedPaymentMethods(customer : Customer) : Collection
Returns a collection containing the payment methods attached to the given customer.
static getPaymentIntent(basket : Basket) : SalesforcePaymentIntent
Returns the payment intent for the given basket, or null if the given basket has none.
static getPaymentIntent(order : Order) : SalesforcePaymentIntent
Returns the payment intent for the given order, or null if the given order has none.
static getPaymentsSiteConfig() : SalesforcePaymentsSiteConfiguration
Returns a payments site configuration object for the current site.
static getPayPalOrder(basket : Basket) : SalesforcePayPalOrder
Returns the PayPal order for the given basket, or null if the given basket has none.
static getPayPalOrder(order : Order) : SalesforcePayPalOrder
Returns the PayPal order for the given order, or null if the given order has none.
static getSavedPaymentMethods(customer : Customer) : Collection
Returns a collection containing the payment methods saved to be presented to the given customer for reuse in checkouts.
static onCustomerRegistered(order : Order) : void
Handles the account registration of the shopper who placed the given order.
static removeSavedPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void
Removes the given saved payment method so that it is no longer presented to the given customer for reuse in checkouts.
static savePaymentMethod(customer : Customer, paymentMethod : SalesforcePaymentMethod) : void
Saves the given payment method to be presented to the given customer for reuse in subsequent checkouts.
Methods inherited from class Object
Method Detail
attachPaymentMethod
static attachPaymentMethod(paymentMethod : SalesforcePaymentMethod, customer : Customer) : void
Attaches the given payment method to the given customer. Use this method to attach a payment method of type SalesforcePaymentMethod.TYPE_CARD to a shopper who registers as a customer after placing an order, and has affirmatively elected to save their card as part of the registration process. This method will throw an error if passed incompatible payment method and/or customer objects.
Parameters:
paymentMethod - payment method to attach to customer
customer - customer whose payment method to attach
Throws:
Exception - if there was an error attaching the payment method to the customer

detachPaymentMethod
static detachPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void
Detaches the given payment method from its associated customer. Once detached the payment method remains associated with payment intents in the payment account, but is no longer saved for use by the customer in future orders.
Parameters:
paymentMethod - payment method to detach from customer
Throws:
Exception - if there was an error detaching the payment method from its customer

getAttachedPaymentMethods
static getAttachedPaymentMethods(customer : Customer) : Collection
Returns a collection containing the payment methods attached to the given customer. The collection will be empty if there are no payment methods attached to the customer, or there was an error retrieving the attached payment methods.
Parameters:
customer - customer whose payment methods to get
Returns:
collection of attached payment methods
Throws:
Exception - if the given customer is null or undefined

getPaymentIntent
static getPaymentIntent(basket : Basket) : SalesforcePaymentIntent
Returns the payment intent for the given basket, or null if the given basket has none.
Parameters:
basket - basket to checkout and pay using Salesforce Payments
Returns:
The payment intent
Throws:
Exception - if there was an error retrieving the payment intent for the basket

getPaymentIntent
static getPaymentIntent(order : Order) : SalesforcePaymentIntent
Returns the payment intent for the given order, or null if the given order has none.
Parameters:
order - order paid using Salesforce Payments
Returns:
The payment intent
Throws:
Exception - if there was an error retrieving the payment intent for the order

getPaymentsSiteConfig
static getPaymentsSiteConfig() : SalesforcePaymentsSiteConfiguration
Returns a payments site configuration object for the current site.
Returns:
a payments site configuration or null if no payments site configuration found
Throws:
Exception - if there is no current site

getPayPalOrder
static getPayPalOrder(basket : Basket) : SalesforcePayPalOrder
Returns the PayPal order for the given basket, or null if the given basket has none.
Parameters:
basket - basket to checkout and pay using Salesforce Payments
Returns:
The PayPal order
Throws:
Exception - if there was an error retrieving the PayPal order for the basket

getPayPalOrder
static getPayPalOrder(order : Order) : SalesforcePayPalOrder
Returns the PayPal order for the given order, or null if the given order has none.
Parameters:
order - order paid using Salesforce Payments
Returns:
The PayPal order
Throws:
Exception - if there was an error retrieving the PayPal order for the order

getSavedPaymentMethods
static getSavedPaymentMethods(customer : Customer) : Collection
Returns a collection containing the payment methods saved to be presented to the given customer for reuse in checkouts. The collection will be empty if there are no payment methods saved for the customer, or there was an error retrieving the saved payment methods.
Parameters:
customer - customer whose payment methods to get
Returns:
collection of attached payment methods
Throws:
Exception - if the given customer is null or undefined, or there is an error getting the saved payment methods

onCustomerRegistered
static onCustomerRegistered(order : Order) : void
Handles the account registration of the shopper who placed the given order. Use this method to ensure the registered customer profile is associated with the order in Salesforce Payments.
Parameters:
order - order paid using Salesforce Payments
Throws:
Exception - if there was an error attaching the payment method to the customer

removeSavedPaymentMethod
static removeSavedPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void
Removes the given saved payment method so that it is no longer presented to the given customer for reuse in checkouts. The payment method remains in the payment account, but is no longer saved for use by the customer.
Parameters:
paymentMethod - payment method to detach from customer
Throws:
Exception - if there was an error removing the saved payment method from its customer

savePaymentMethod
static savePaymentMethod(customer : Customer, paymentMethod : SalesforcePaymentMethod) : void
Saves the given payment method to be presented to the given customer for reuse in subsequent checkouts. This method will throw an error if passed incompatible payment method and/or customer objects.
Parameters:
customer - customer for which to save the payment method
paymentMethod - payment method to save for the customer
Throws:
Exception - if there was an error saving the payment method for the customer

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.