Skip to main content

Integration with Configurable Payment Retry: Emails about declined payments


Integration with Configurable Payment Retry: Emails about declined payments

If you want Configurable Payment Retry to trigger a workflow after a declined payment, you need to create the workflow first. You can design the workflow to either fix the issue and retry the payment directly, or send a summary of the declined payment, including the payment gateway and credit card information, to someone (for example, yourself) for further processing.  

In this topic, we'll show you how to design a workflow that is triggered by Configurable Payment Retry to email the details of the declined payment to a specific recipient.

Workflow overview

First, you need to define two input parameters in the settings of the workflow. The first two query tasks use these two input fields to retrieve the related account and payment data.

Use the settings in the table to define the two parameters. Use default settings for parameters not specified in the table.

Callout Field Name Object Field Name Datatype
accountId Workflow accountId Text
paymentId Workflow paymentId Text

This workflow consists of four tasks, three query tasks and one email task. We do not want to use a single export task to retrieve all the data, because this workflow may be triggered multiple times in a short time. If we use an export task, the concurrent limit for export tasks can be reached easily.

  1. Query: Retrieves the account number and name based on the input field accountId.
  2. Query: Retrieves the related payment data based on the input field paymentId. The data retrieved will be used in the next query task and in the email.
  3. Query: Retrieves the related credit card data based on the payment ID obtained in the second query task. 
  4. Email: Sends an email about the declined payment. Detailed information obtained from the previous three tasks are included in the email.

Exported JSON of the workflow

You can create a copy of the workflow that we introduce in this topic by copying the JSON code in CPR_integration_1.json and paste it into a blank workflow. 

To learn about how to create a copy of a workflow, see Create a Copy of a Workflow.


After you create a copy of the workflow, you can customize the workflow and task settings. You must change the email in the To (Email) field in the email task. If you want to use a merge field (such as Account.AdditionalEmailAddress), you cannot select the field from the drop-down list. You need to use a Liquid statement (for example, Account[0].AdditionalEmailAddress wrapped in double curly brackets), because the queries return JSON arrays by default, and JSON arrays cannot be directly selected in tasks.