---
schema_version: "1"
id: 5041af7e7b17ad00dcc4b7159689b1dcd8c1f3d0231cce07e78d6eda4c689177
title: Create WhatsApp Pay Screen Flow for Brazil
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/messaging_create_wa_screen_flow.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.messaging_create_wa_screen_flow.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: adbfb70956555b81009262407cedde7d175e4935f5bcdcc31bd9b935f38fd87a
description: 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.
products:
  - Service Cloud
  - Digital Engagement
release: "264"
---
# Create WhatsApp Pay Screen Flow for Brazil

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](https://help.salesforce.com/s/articleView?id=platform.create_forms_with_screen_flow_components.htm&type=5&language=en_US) and [Get Started with Screen Flows](https://trailhead.salesforce.com/content/learn/modules/screen-flows/get-started-with-screen-flows).
- Create a [WhatsApp payment messaging](https://help.salesforce.com/s/articleView?id=service.messaging_add_whatsapp_pay.htm&release=264.0.0&type=5 "Use these steps to create a WhatsApp Pay Messaging Component.") component. For your component properties, make sure you are selecting the country name as Brazil, and currency code as Brazilian Real.
- 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](https://trailhead.salesforce.com/content/learn/projects/quickstart-apex/quickstart-apex-1) and [Sample Code Snippets for Apex Classes](https://help.salesforce.com/s/articleView?id=service.messaging_whatsapp_payment_apex_snippets.htm&release=264.0.0&type=5 "Use these Apex classes to define the parameters required for WhatsApp Pay integration.").
- 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.
- The messaging session expiry times can differ from payment component expiry times.
- Make sure that you send the order status back to customer in the chat.

## 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](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements.htm&type=5&language=en_US).

## 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](https://trailhead.salesforce.com/content/learn/modules/flow-basics/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](https://help.salesforce.com/s/articleView?id=service.messaging_whatsapp_payment_apex_snippets.htm&release=264.0.0&type=5 "Use these Apex classes to define the parameters required for WhatsApp Pay integration.").
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](https://trailhead.salesforce.com/content/learn/modules/flow-basics/learn-about-flow-variables) 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](https://help.salesforce.com/s/articleView?id=service.messaging_whatsapp_payment_apex_snippets.htm&release=264.0.0&type=5 "Use these Apex classes to define the parameters required for WhatsApp Pay integration.").
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](https://trailhead.salesforce.com/content/learn/modules/flow-basics/learn-about-flow-variables) 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](https://help.salesforce.com/s/articleView?id=service.messaging_whatsapp_payment_apex_snippets.htm&release=264.0.0&type=5 "Use these Apex classes to define the parameters required for WhatsApp Pay integration.").
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](https://trailhead.salesforce.com/content/learn/modules/flow-basics/learn-about-flow-variables) 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](https://help.salesforce.com/s/articleView?id=service.messaging_whatsapp_payment_apex_snippets.htm&release=264.0.0&type=5 "Use these Apex classes to define the parameters required for WhatsApp Pay integration.").
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](https://trailhead.salesforce.com/content/learn/modules/flow-basics/learn-about-flow-variables) 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/support_channels/images/messaging/messaging_wa_pay_screen_flow.png)