LogoLogo
Partner Integrations
Salesforce Lightning B2B Commerce App 1.3
Salesforce Lightning B2B Commerce App 1.3
  • Salesforce Lightning B2B Commerce App 1.3
  • Introduction
    • How it works
    • What's new in version 1.3
  • Upgrading to version 1.3
  • Integrate the Salesforce Lightning app
    • Step 1: Install the Digital River app
    • Step 2: Configure the Digital River app
    • Step 3: Register external services
    • Step 4: Configure DCM logs
    • Step 5: Add custom fields to the page layouts
    • Step 6: Enable email deliverability
    • Step 7: Import ECCN codes, tax groups, and tax types
    • Step 8: Configure and synchronize the products
    • Step 9: Schedule backend jobs
    • Step 10: Set up integration between Salesforce and Digital River
    • Step 11: Set up webhooks
    • Step 12: Configure landed cost
    • Step 13: Manage permission sets
    • Step 14: Configure shipping integration
    • Step 15: Integrating refunds
    • Step 16: Configure the From email address
    • Step 17 (alternative): Integrate the Digital River components into an asynchronous checkout flow
      • Custom components used in the checkout subflows
      • Subflow configuration
        • Configure the delivery method subflow
        • Configure the Checkout Summary subflow
        • Configure the Payment and Billing Address subflow
          • Edit the Payment Method screen
          • Edit the decision elements
          • Link screen components
        • Configure the shipping address subflow
          • Configure the shipping address screen
      • Configure the main checkout flow
    • Step 18 (alternative): Integrate the Digital River components into a synchronous checkout flow
      • Deploy flows using Salesforce Workbench
      • Update the flow nodes in the synchronous checkout flow
        • Create custom variables
        • Delete nodes
        • Connect nodes
        • Modify nodes
        • Add nodes
      • Configure screens for a customized synchronous flow
        • Add custom components to screens in the synchronous checkout flow
        • Configure the Shipping Options screen
        • Configure the Delivery Method Screen
        • Configure the Checkout Summary screen
        • Configure the Payment And Billing Address screen
        • Configure the Place Order Confirmation screen
    • Step 19: Add custom components to pages
      • Drag and drop (custom) components
    • Step 20: Test the Salesforce Lightning app integration
  • Extend the Salesforce Lightning app
    • Extend the Ship From address
    • Extend the webhook framework
    • Configure subscriptions
    • Shipping choice extension point
    • Customer credit
      • addCustomerCreditSourceToCheckout
      • deattachPaymentToCheckout
      • getAmountRemainingforCheckout
      • getCartDetailsById
      • Publishing connector events
    • Tax calculation
    • Overriding Digital River CSS
    • Customizing the Lightning web components
      • Designer attributes
      • Components
        • Buyer info component
        • Tax certificate component
        • DR util component
        • DR Terms component
        • Checkout summary component
        • Hide checkout summary component
        • Order Summary component
        • Place order component
        • Payments component
        • Payment details component
        • Tax identifier component
        • DR compliance component
        • Address details component
  • User guide
    • Regulatory fees
    • Tax certificates
    • Tax identifiers
    • My wallet
    • Customer credit
    • Checkout and order creation
    • Fulfillment/cancellation flow
    • Refunds
    • Invoices and credit memos
  • Support
  • Appendix
    • Custom fields and objects
    • Contact point address
    • Multi-currency support
Powered by GitBook
On this page
  • Enable or disable specific payment methods
  • Subscribe to the Fire Zero Dollar event
  • Publish the Payment component events
  1. Extend the Salesforce Lightning app
  2. Customizing the Lightning web components
  3. Components

Payments component

Learn how to use the Payments component for various use cases.

PreviousPlace order componentNextPayment details component

Last updated 2 years ago

Use the drb2b_payments component to display Drop in and collect payment information from the shopper. You can configure this component in the flow.

You can publish an event to show or hide the Payments component and to reload the component. Refer to the section below for details on how to publish the event to enable and disable specific payment methods.

Enable or disable specific payment methods

At times, you may need to let shoppers choose from specific payment methods based on their business requirements, such as providing payment methods based on the type of products in their cart. You do this by using the Payments component's Enable override payments designer attribute along with publishing an event which specifies the payment methods that should be displayed. This ability allows you to set the components attributes dynamically during page loading.

By default, the Enable override payments attribute is set to False and the drb2b_ payments component automatically loads on page load. If the Enable override payments designer attribute is set to True, the drb2b_payments component does not automatically load on page load. Instead, you can control the methods that are loaded by firing an event as described below. Drop-in Checkout then gets loaded once this event is received.

You publish the event and pass the values (payment methods) that you enabled or disabled based on your business requirements. While publishing the event, you must pass the purpose and payload as shown in this example payload:

{
“purpose”: “overridePayments”, //Required parameter
“payload” : { //payload parameter is optional 
        “enabledPaymentMethods”:["creditCard","googlePay"], // contains list of methods that needs to enable
        “disabledPaymentMethods”:["creditCard","googlePay"]// contains list of methods that needs to disable
}

Note: You can send either enabledPaymentMethods or disabledPaymentMethods in the payload attribute for this event, but not both. If you send a payload that contains both, theenablePaymentMethodparameter is used and disablePaymentMethodsis ignored.

Subscribe to the Fire Zero Dollar event

You can also use the Payment component to place zero-dollar orders without a payment source. By default the designer attribute Fire Zero Dollar Event is set to false. With this setting, when an order is zero-dollars, the connector will automatically move the shopper to the next screen in the flow without attaching a payment source. Depending on your flow, you may wish to have a greater control over the screen flow. In this case, you can set the attribute Fire Zero Dollar Event to true and subscribe to an event that you can use to control the flow. When this event is published, the drb2b_dropIn component will be hidden, but the shopper will not be redirected to the next screen in the flow.

Use the following steps to subscribe to an event published by connector when “Fire Zero Dollar Event” is set to True:

  • Import the digitalriverv3__ DigitalRiverMessageChannel __c message channel and message service into a custom Javascript file.

import {subscribe, MessageContext, publish} from "lightning/messageService";
import dr_lms from "@salesforce/messageChannel/digitalriverv3__DigitalRiverMessageChannel__c";
  • Declare the message context variable.

@wire(MessageContext) messageContext;
  • Subscribe to the event.

connectedCallback() {
        this.subscribeToMessageChannel();
    }

subscribeToMessageChannel() {
        if (!this.subscription) {
            this.subscription = subscribe(this.messageContext, dr_lms, (message) => this.handleMessage(message));
        }
    }

handleMessage(message) {
       if(message.payload == ‘fireZeroDollarEvent’){
          //Implemented logic here         
       }
    }

Publish the Payment component events

Complete the following tasks to publish various event types. The event purpose and payload will vary depending on the use case.

Import DigitalRiverMessageChannel__c message channel and message service into a custom JavaScript file as shown below.

Import example
import dr_lms from "@salesforce/messageChannel/digitalriverv3__DigitalRiverMessageChannel__c";

import {publish, MessageContext } from "lightning/messageService";

Declare the message context variable as shown below.

Declare variable example
@wire(MessageContext) messageContext;

Publish the event.

Event publishing example
publish(this.messageContext, dr_lms, { 
                    purpose: '<purpose>',           
                    payload: '<payload>'            
                });

Refer to the following table for more information on the Payments component events.

Event purpose
Event payload example
Description

toggleShowPaymentComponent

{"isShow":true}

Publish this event to show {"isShow":true} or hide {"isShow":false} the Payments component.

reloadPaymentComponent

n/a

Publish this event to reload the Payments component.

overridePayments

Example 1:

{"enabledPaymentMethods":["creditCard","googlePay"]}

Example 2: {"disabledPaymentMethods":["creditCard","googlePay"]}

Publish this event to override the payment methods shown for a specific transaction.

This event can be fired using both on page load – using the Designer Attributes of the drb2b_payments component in the flow and by firing an event outside the connector.

To use this override, first ensure that the designer attribute “Enable override payments” on the drb2b_payments component is set to true.

See details in the topic.

Publish the Payment component events
Enable or disable specific payment methods