attachPaymentMethod
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
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
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
Returns the payment intent for the given basket, or null
if the given basket has none.
Parameters:
basket
-
basket to checkout and pay using Commerce Cloud Payments
Returns:
The payment intent
Throws:
Exception
-
if there was an error retrieving the payment intent for the basket
getPaymentIntent
Returns the payment intent for the given order, or null
if the given order has none.
Parameters:
order
-
order paid using Commerce Cloud Payments
Returns:
The payment intent
Throws:
Exception
-
if there was an error retrieving the payment intent for the order