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.
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
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.
- Query: Retrieves the account number and name based on the input field accountId.
- 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.
- Query: Retrieves the related credit card data based on the payment ID obtained in the second query task.
- 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.AdditionalEmailAddress wrapped in double curly brackets), because the queries return JSON arrays by default, and JSON arrays cannot be directly selected in tasks.