Action Required: Mandatory Salesforce Sites security configuration update (July 2026)

Sorry, we didn't find any relevant articles for you.

Send us your queries using the form below and we will get back to you with a solution.

How to catch the expired access/refresh token error and send email alert?

Overview

When an authentication refresh fails, Payments2Us creates an Error Log - Payments2Us record. The record may include an error similar to:

Program Area: payments2Us.DML.performOAuthRefresh
Subject: Response error
Description:
Error: invalid_grant
Error Desc: expired access/refresh token

This article explains how to create a Salesforce Flow that emails your nominated administrators whenever a related error log is created. This allows your team to re-authorise Payments2Us promptly (How to authorise Payments2Us).

Steps

1. Create a record-triggered Flow

  1. In Salesforce, go to Setup.
  2. Search for and open Flows.
  3. Select New Flow.
  4. Choose Record-Triggered Flow.
  5. Select Error Log - Payments2Us as the object.
  6. Set the trigger to A record is created.

2. Add the entry conditions

Configure the Flow to run when Any Condition Is Met (OR).

Add these conditions:

Field Operator Value
Program Area Contains payments2UsDML.refreshToken
Program Area Contains payments2UsDML.performOAuthRefresh

These conditions ensure the Flow monitors Payments2Us token-refresh and OAuth-refresh errors.

The exact Program Area text may vary by package version. Confirm the value from an existing relevant Error Log - Payments2Us record and update the Flow condition if needed.

Set Optimize the Flow For to Actions and Related Records, then select Done.

3. Add a Send Email action

  1. Under Run Immediately, select the + icon.
  2. Select Action.
  3. Search for and select Send Email.
  4. Enter a label, for example: Send Email Error Alert Action.
  5. Configure the recipient details with the email address or addresses for the team responsible for Payments2Us administration.
  6. Configure the sender detail with the org-wide email address responsible for sending the alert

Use a clear subject, for example:

Action required: Payments2Us authorisation may have expired

Use an email body similar to the following:

Refresh Token Error, please action immediately:

https://help.payments2us.com/installation-security/how-to-authorise-payments2us-for-public-website

4. Save and activate the Flow

  1. Select Save.
  2. Enter a clear Flow label, for example:
    Payments2Us Send an Alert for Token Authorisation Failure
  3. Select Activate.

5. Test the alert

After activation, confirm that the nominated recipients receive an email when a matching Error Log - Payments2Us record is created.

When you receive an alert, review the Error Log. If it confirms an expired access or refresh token, re-authorise Payments2Us promptly to restore authentication. (How to authorise Payments2Us)

This alert helps you respond quickly, but it does not automatically re-authorise Payments2Us. Re-authorisation must be completed by an authorised Salesforce administrator.

Updated at August 26th, 2026

Was this article helpful?