Loading
Agentforce Contact Center
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create WhatsApp Pay Screen Flow

          Create WhatsApp Pay Screen Flow

          This tutorial guides you through building a sample screen flow that uses a payment messaging component to send a payment request to a customer. You can use the component to request payments from customers directly within a WhatsApp messaging channel. To send this component and populate it with dynamic order details, you can build a screen flow. You can use this flow to gather necessary payment data by calling Apex actions. The data includes line items, totals, order context, and custom parameters like shipping amounts. After data gathering, the flow uses the Enhanced Message action to send the component to the user.

          • See Use Screen Flows to Interact with Users and Get Started with Screen Flows.
          • Create a WhatsApp payment messaging component.
          • Make sure that the Apex classes for retrieving payment data (PaymentMessageLineltems, PaymentPaymentTotal, PaymentOrderContext, PaymentMessage, and PaymentInitiations) are available in your org. You can have your own class names for better understanding. For more information on how to create an Apex class and sample code, see Create an Apex Class and Sample Code Snippets for Apex Classes.
          • If you’re using PIX as your payment method, make sure that you’ve specified the merchant name property.
          • If you’re sending order status back to the end user, create two custom parameters in your payment messaging component. One for capturing the reference ID and one capturing the order status label. Also, make sure that you’ve configured your WABA template for order status. If you haven't configured still, login to your WABA account and go to your message template. Under the Utility tab, select Order Status and then submit for review.
          • Create a custom parameter to capture the shipping amount. It’s an optional parameter that isn't available to you by default.

          Create a Custom Parameter

          1. From Setup, in the Quick Find box, enter Messaging Components, and then select Messaging Components.
          2. Find and click your WhatsApp Pay messaging component.
          3. Click Parameters.
          4. Click New.
            The New Pameter window appears.
          5. Enter the name as shipping_amount and select type as double.
          6. Click Save.

          Step 1: Create a Screen Flow

          1. From Setup, in the Quick Find box, enter Flows, and then select Flows.
          2. Click New Flow, select Screen Flow.
            The Screen Flow appears on the auto-layout page. If you don't see Screen Flow, use the search box to search Screen Flow.
          3. Click + to add the required screen flow elements.
            For more information on how to work with Flow Builder elements, such as Screen, Assignment, and Action see, Flow Elements.

          Step 2: Get the Messaging Session ID

          1. Click + to add a Screen element to your flow to capture the session ID.
            The New Screen Window appears.
          2. Under Components, in the search box, enter Text, and then select Text to add a Text component to the Screen element.
          3. Under Properties, for Label, enter GetSessionld, and enter details in other fields if necessary.
          4. Click Done.
            The flow is updated with the GetSessionld screen element.
          5. Click + below the screen element to add an Assignment element to the flow.
            This step creates a variable to store the session ID. Name it as StoreSessionld.
          6. Create a variable named Messaging Sessionld with the Data Type set to Text, and select Available for input and Available for output.
            Assign the Messaging Sessionld variable to the value of the screen component (GetSessionld.Sessionld). For more information on how to create variables, see Learn About Flow Variables.

          Step 3: Assign the Shipping Amount

          1. Add an Assignment element and name it SaveShippingAmount.
          2. Create a variable named ShippingAmount with the Data Type set to Number.
            Assign the Shipping Amount variable a value, such as 10.

          Step 4: Get Payment Line Items

          1. Add an Action element to call the Apex class that provides payment line items.
          2. Under Search Actions, search for and select the PaymentMessageLineltems action.
          3. Label the action as GetPaymentLineltems.
          4. Under View Output Resources, select Manually assign variables (advanced).
          5. Under Store Output Values, click the search box to create a variable named PaymentLineltems.
            1. Set the Data Type to Apex-Defined, select the RichMessaging_PaymentLineltem Apex class, and select Allow multiple values (collection).
            2. Select Available for input and Available for output. Assign the output to your PaymentLineltems variable.
          6. Click Done.

          Step 5: Get the Payment Total

          1. Add an Action element to call the Apex class that provides the total payment.
          2. Under Search Actions, search for and select the PaymentPaymentTotal action.
          3. Label the action as GetPayment Total.
          4. Under View Output Resources, select Manually assign variables (advanced).
          5. Under Store Output Values, click the search box to create a variable named Payment Total.
            1. Set the Data Type to Apex-Defined and select the RichMessaging_PaymentTotal Apex class. Don't allow multiple values. Assign the output to your Payment Total variable.
            2. Select Available for input and Available for output.
          6. Click Done.

          Step 6: Get the Order Context

          1. Add an Action element to call the Apex class that provides the order context or details.
          2. Under Search Actions, search for and select the PaymentOrderContext action.
          3. Label the action as GetPaymentOrderContext.
          4. Under View Output Resources, select Manually assign variables (advanced).
          5. Under Store Output Values, click the search box to create a variable named OrderContext.
            1. Set the Data Type to Apex-Defined and select the RichMessaging_OrderContext Apex class. Don't allow multiple values. Assign the output to your OrderContext variable.
            2. Select Available for input and Available for output.
          6. Click Done.

          Step 7: Get Payment Initiations

          1. Add an Action element to call the Apex class for payment initiation.
          2. Under Search Actions, search for and select the PaymentInitiations action.
          3. Label the action as GetPaymentInitiations.
          4. Under View Output Resources, select Manually assign variables (advanced).
          5. Under Store Output Values, click the search box to create a variable named PaymentInitiations.
            1. Set the Data Type to Apex-Defined, select the RichMessaging_PaymentInitiation Apex class, and select Allow multiple values (collection). Assign the output to your PaymentInitiations variable.
            2. Select Available for input and Available for output.
          6. Click Done.

          Step 8: Send the Payment Component

          1. Add a Screen element to create interactive interfaces that collect input from users or display information to them.
            Label it as SendPaymentComponent.
          2. Under Components, in the search box, enter Enhanced Message, then select Enhanced Message.
          3. Under Properties, select the required details.
            • For Messaging Session ID, select the Messaging Sessionld variable.
            • For Messaging Component Name, select your payment messaging component name. For example, Sample WhatsApp Payment Component.
            • Map the standard parameters to the Apex-defined variables that you created.
              • Payment Line Items Parameter: PaymentLineltems
              • Payment Total Parameter: Payment Total
              • Order Context: OrderContext
              • PaymentInitiations: PaymentInitiations
          4. Click Configure Custom Parameters.
            1. From Parameter Name, select shipping_amount.
            2. From Parameter Value Type, select Variable.
            3. From Variable, select the ShippingAmount variable.
            4. Click Add.
          5. Click Done.

          Step 9: Save and Activate the Flow

          1. In the top-right, click Save.
          2. Provide a label and description for the flow.
          3. Click Save.
          4. Click Activate.

          WhatsApp Pay Screen Flow

           
          Loading
          Salesforce Help | Article