Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Design and Test a Flow

Learning Objectives

After completing this unit, you’ll be able to:

  • Design a flow to automatically sync data from Stripe to Salesforce.
  • Test your flow to ensure it syncs data as expected.

In this unit, you first learn how to use MuleSoft Composer to create a flow that automatically syncs customer data in Stripe with Salesforce. Then, you test your flow to ensure it syncs data as expected.

By default, MuleSoft Composer validates your work and provides contextual in-app help every step of the way. For example, when you add a connection to a system, MuleSoft Composer tests the connection to make sure it works before you can proceed to the next step. Also, to simplify building your flows, MuleSoft Composer prompts you to complete required fields within each step.

As a best practice, when building a flow, add a few steps and test iteratively until you complete the flow.

Note

If you have a large integration task, it’s recommended that you break up the task into manageable, bite-sized chunks, and then create a flow for each chunk. This enables you to more easily and quickly build, test, and run your flows to accomplish the task.

Take a look at this video demonstration showing how to connect Stripe to Salesforce using MuleSoft Composer.

Design a Flow

Now you’re ready to design an integration flow that automatically syncs customer data in Stripe with Salesforce. 

Follow these steps to design a flow.

Launch MuleSoft Composer from the NTO org.

  1. Log in to your NTO org using your username and password.
  2. From the App Launcher, enter Composer and select MuleSoft Composer.

Create a new flow.

  1. Click Create New Flow.
  2. Click the pencil icon next to the default flow name.
  3. Name the flow Sync Stripe Customers with NTO Org Accounts and click Save.

Create the trigger for the flow using a test mode Stripe connection.

  1. Click Stripe.
  2. Click Add new Stripe connection.
  3. Configure a test mode Stripe connection using the following values, and then click Create. MuleSoft Composer automatically tests the connection. If no error message appears, you have a successful connection, and the first step (trigger) of the flow appears.
    • Connection Display Name: Test NTO Stripe
    • API Key: Paste the test mode secret API key from your text file.
  4. Click the pencil icon next to the default step name.
  5. Name the step Get new charge and click Save.

Configure the trigger to start the flow every time a new charge is added in Stripe.

  1. Click in the Choose an event that starts this flow field and select New charge.
  2. Click Save to save the flow.

Create the second step for the flow to find the customer associated with the charge in Stripe.

  1. Click the plus icon to add a step.
  2. Select Stripe and then select Test NTO Stripe.
  3. Name the step Find customer for charge and click Save.

Configure the second step to find the customer associated with the charge in Stripe.

  1. Click in the Action field and select Find customer. The Customer ID field automatically appears because it’s a required field.
  2. In the Customer ID field, select CustomerId from step 1 of the flow.

Create the third step for the flow to get NTO org accounts with the Stripe customer name.

  1. Click the plus icon to add a step.
  2. Click Salesforce.
  3. Click Add new Salesforce connection to create a connection to the NTO sandbox org.
  4. Name the connection NTO sandbox org.
  5. Select the checkbox This is a sandbox organization and click Create.
  6. Enter your NTO sandbox org’s username and password and click Log In.
  7. Click Allow to grant MuleSoft Composer the permissions to access your basic information, access and manage your data, and perform requests on your behalf at any time. MuleSoft Composer automatically tests the connection. If no error message appears, you have a successful connection, and the third step of the flow appears.
  8. Name the step Get accounts and click Save.

Configure the third step to get NTO org accounts with the Stripe customer name.

  1. Click in the Action field and select Get records.
  2. In the Record Type field, enter Account. In the Filter records section, the All conditions must be met (AND) condition is selected by default.
  3. Select Account Name as the field, Equals as the operator, and Name from step 2 of the flow.

Create and configure an If/Else block to check if an account with the same Stripe customer name exists in the NTO org.

  1. Click the plus icon to add a step.
  2. Click If/Else Block.
  3. Click Add Conditions. The All conditions must be met (AND) condition is selected by default.
  4. Select List of Account from step 3 of the flow as the field; select Is empty as the operator; and then click Save. If this condition is met, it means no corresponding account for the Stripe customer exists in the NTO org. So, an account is created for the customer in the next step.

Create the fourth step for the flow to sync Stripe customers with NTO org accounts.

  1. Click the plus icon within the If/Else block to add a step.
  2. Click Salesforce.
  3. Click NTO sandbox org to connect to the NTO sandbox org.
  4. Name the step Sync customers with accounts and click Save.

Configure the fourth step to sync Stripe customers with NTO org accounts.

  1. Click in the Action field and select Create record.
  2. In the Object Type field, enter Account. The Account Name field automatically appears because it’s a required field.
  3. Click Add Fields, select Account Phone, Billing Street, Billing City, Billing State/Province, Billing Country, and Billing Zip/Postal Code, and then click Add.
  4. Map the Account fields in Sales Cloud to their corresponding Customer fields captured in step 2 of the flow as follows.
    • Account Name = Name from step 2
    • Account Phone = Phone from step 2
    • Billing Street = Address | Line1 from step 2
    • Billing City = Address | City from step 2
    • Billing State/Province = Address | State from step 2
    • Billing Country = Address | Country from step 2
    • Billing Zip/Postal Code = Address | Postal Code from step 2
  5. Save the flow. Your entire flow should look like this.

Step 1 of flow showing new charge from Stripe.Step 2 of flow showing customer associated with charge in Stripe. Step 3 of flow showing accounts with same Stripe customer name.If/Else block of flow showing If/Else condition to determine if list of accounts is empty.Step 4 of flow within If/Else block showing a new account is created.

Next, you learn how to test your flow. 

Test a Flow

After you’ve designed your flow, you need to test it from end to end to ensure it syncs data as expected. In general, you have up to 10 minutes to complete a test. When the test completes or 10 minutes have passed, the test stops. As a best practice, you should get all required applications and data ready for the test before starting it. 

In this use case, when a new charge is created in Stripe, it triggers the flow. So be prepared to enter a customer and a payment for that customer in Stripe. If the customer associated with the payment doesn’t exist as an account in Sales Cloud, it appears as a new account in the NTO org. So get ready to verify that the account has been successfully added in Sales Cloud. If the customer exists as an account, a new account isn’t created in Sales Cloud. Be ready to verify this scenario as well.

Follow these steps to test a flow.

  1. In the Sync Stripe Customers with NTO Org Accounts flow, click Test. The flow goes into a read-only mode.
    Note: While the test is running, if for some reason you want to stop it, click Stop Test
  2. Log in to your Stripe account.
  3. Click Viewing test data. You’re now in test mode.
  4. Click Customers and click Add customer.
  5. Add a new customer with the following values, and then click Add customer.
    • Name: Jane Doe
    • Email: jane.doe@acme.com
    • Billing email: Same as account email
    • Country: United States
    • Address: 501 Fifth Avenue
    • City: New York
    • State: New York
    • Zip: 10017
    • Phone: 212-333-4444
    • Shipping details: Same as billing details
  6. Click Payments and click Create payment.
  7. Select One-time, add a new payment with the following values, and then click Submit payment.
    • Amount: 199.00 USD
    • Customer: jane.doe@acme.com
    • Statement descriptor: acme.com
    • Card number: 4242-4242-4242-4242
    • Expiration date: any future date
    • CVC: any three digits
  8. Go back to your flow and wait for the test to complete. If every step of the flow shows a green check mark, this indicates the flow ran successfully. Take a look at the Test Output section and see the record values you entered for the test.
    Tested flow showing a green check mark on step 1.Tested flow showing a green check mark on step 2.Tested flow showing a green check mark on step 3.Tested flow showing a green check mark on step 4 within If/Else block.
  9. Log in to the NTO sandbox org’s Sales Cloud, navigate to the Accounts tab, and verify that a new account corresponding to the Stripe customer has been created.
    New Sales Cloud account corresponding to Stripe customer.
  10. In the Sync Stripe Customers with NTO Org Accounts flow, click Test again.
  11. In your Stripe account, click New payment.
  12. Select One-time, add a new payment with the following values, and then click Submit payment.
    • Amount: 599.00 USD
    • Customer: jane.doe@acme.com
    • Statement descriptor: acme.com
  13. Go back to your flow and wait for the test to complete. If the first three steps of the flow show a green check mark but the fourth step doesn’t, this indicates the flow ran successfully. This is because the Stripe customer exists as an account in Sales Cloud, and so step 4 (creating an account) wasn’t executed. Take a look at the Test Output section. You should see there’s no test output for step 4.
    Tested flow showing a green check mark on step 1.Tested flow showing a green check mark on step 2.Tested flow showing a green check mark on step 3.Tested flow showing there’s no test output on step 4.
  14. Log in to the NTO sandbox org’s Sales Cloud, navigate to the Accounts tab, and verify that no new account corresponding to the Stripe customer has been created because the account exists.
  15. Repeat steps 1 through 14 to test two new charges associated with a new customer of your choice. Your flow should work as expected.

Good job! In the next unit, you learn how to activate, monitor, and troubleshoot your flow in the production environment.

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기