addCustomerCreditSourceToCheckout
Learn how to add a Customer Credit source to checkout.
Use this global method to create a customer credit payment source and attach it to checkout.
The payment session identifier and currency code will be derived from the cart if multicurrency is enabled in org. Otherwise, the currency code will be derived from the user’s default currency.
Before creating a payment source, use this method to verify that the amount
specified by the shopper is less than or equal to the amountRemainingToBeContributed
. If the amount passed into the method is greater than amountRemainingToBeContributed
, it will throw an error.
This global method will set the amountContributed
and amountRemainingToBeContributed
values in the Cart
object.
Sending a request
This method accepts parameters in JSON string format and can be called outside the managed package. You need to pass the cartId
and the amount
applied to this method.
Parameter | Required/Optional | Determine |
---|---|---|
| Required | The Salesforce ID for the |
| Required | The amount specified by the shopper to use for the customer credit source. |
| Optional | You can pass the If this parameter is not provided, the label "CustomerCredit" will be used by default. |
Receiving a response
You'll see the following parameters in the response.
Parameter | Description |
---|---|
| This global method returns a Boolean value where:
|
| If the system returns an error and the value for
|
| The unique identifier of the customer credit source. |
Calling the global method from a custom component
Import the addCustomerChreditSourceToCheckout
method into your custom component javascript file with digialriverv3
as the namespace as shown below.
Call the global method from a custom JavaScript file by passing the cartId
, amount
, and (optionally) paymentName
arguments as shown below.
Last updated