Set up webhooks so statuses update automatically
A webhook is a message one system sends to another when something happens. Payload sends one to Salesforce when a payment is processed, declined, refunded, voided or rejected, and when money is deposited to or withdrawn from your bank account. REDA Pay receives these messages and updates the matching Pay Transaction, or creates a Statement Activity for a deposit. Without webhooks, a payment that is accepted today and rejected by the bank three days later stays "processed" in Salesforce until someone presses Sync Transaction by hand.
Setting this up has six parts: a public address in Salesforce that Payload can reach, access for the guest user behind that address, the address on the Pay Profile, access for the Salesforce user that processes the messages, on Payload API v2 a signing secret, and the Setup Webhooks button that registers the address with Payload. Nothing here needs code.
- The Pay Profile is active with its API key stored — see Sync processing accounts and activate the profile.
- You know the profile's Payload API Version (blank or v1, or v2) — see Choose the Payload API version. It changes Part 2 and Part 5.
- You hold REDA Pay - Admin User and the Salesforce Customize Application permission (a System Administrator has it).
- Read Part 6 before pressing Setup Webhooks on a v1 profile: it removes every webhook registered under your Payload API key.
How the pieces fit
Payload ──(webhook message)──▶ your public Salesforce site ──▶ REDA Pay ──▶ Pay Transaction updated
/services/apexrest/rpay/… (processed by the Automated Process user)
Payload needs an address it can call without logging in. In Salesforce that is a Site — a public web address belonging to your org, used here only as a mailbox for Payload's messages. REDA Pay tells Payload the full address; you only provide the site's base address. The full address ends in /services/apexrest/rpay/payload/<Pay Profile Id> for a v1 profile and /services/apexrest/rpay/payloadv2/<Pay Profile Id> for a v2 profile.
Part 1 — Create the public site
If your org already has a Salesforce Site used for integrations, you can reuse it; skip to Part 2. Otherwise:
- Open Setup, type Sites in the Quick Find box, and click Sites (under User Interface → Sites and Domains).
- If you have never created a site, register a domain first: enter a name in the domain box, click Check Availability, accept the terms and click Register My Salesforce Site Domain. The domain looks like
yourcompany.my.salesforce-sites.com. - Click New.
- Fill in: Site Label (for example Payment Callbacks), Site Name (filled automatically), Default Web Address (a short path such as
rpay— this becomes part of the address), and Active Site Home Page: click the lookup and choose any page, for example UnderConstruction. Nobody will visit this page. - Click Save, then Activate.
Write down the site's full address as shown in Site URL, for example https://yourcompany.my.salesforce-sites.com/rpay.
A site used only for webhooks. Its Site URL is what goes on the Pay Profile.
Part 2 — Give the site's guest user access
Every site has a guest user, the identity Salesforce uses for visitors who are not logged in. Payload's messages arrive as that user, so it must be allowed to run the REDA Pay class that receives them — one class for v1 and one for v2. Enable both, so a later change of the profile's version needs no further step.
- On the site's detail page, click Public Access Settings. This opens the guest user's profile.
- Scroll to Enabled Apex Class Access (called Apex Class Access in the enhanced profile interface) and click Edit.
- Move rpay.PayloadCallback (v1) and rpay.PayloadCallbackV2 (v2) from Available to Enabled, and click Save. The guest user needs nothing else: these classes only pass the message on to REDA Pay.
The guest user needs exactly these classes enabled: rpay.PayloadCallback for v1 and rpay.PayloadCallbackV2 for v2. If your org upgraded from an earlier REDA Pay version, the v2 class is not enabled until you add it here.
Part 3 — Put the site address on the Pay Profile
- Open the REDA Pay app → Pay Profiles → your profile → Edit.
- In Webhook API Base URL, paste the site's address from Part 1, including
https://and the path, for examplehttps://yourcompany.my.salesforce-sites.com/rpay. - Save.
REDA Pay appends the rest of the address itself, and chooses the v1 or v2 ending from the profile's Payload API Version. You never type the full webhook address.
Part 4 — Give the Automated Process user access
When a message arrives, Salesforce hands it to a built-in system user called Automated Process to do the work: read the message, find the Pay Transaction, ask Payload for its latest status and update the record. That user has no access to REDA Pay records until you give it some, and it does not appear in the normal Users list, so the access is granted with a short script.
- Open Setup → Permission Sets, open REDA Pay - Admin User, and click Clone. Name the copy REDA Pay - Automated Process and Save.
- Copy the clone's Id from its address bar (the 18-character value after
/lightning/setup/PermSets/, or the 15 characters afterid=). - Open the Developer Console (gear icon → Developer Console), then Debug → Open Execute Anonymous Window, paste the line below with your Id, and click Execute:
insert new PermissionSetAssignment(
AssigneeId = [SELECT Id FROM User WHERE Alias = 'autoproc' LIMIT 1].Id,
PermissionSetId = '0PS000000000000AAA' // the Id of your REDA Pay - Automated Process permission set
);
The window reports success. If it reports that the assignment already exists, the step was done before.
Part 5 — Set the webhook signing secret (v2)
On a v2 profile, Payload can sign every message it sends with a secret you choose, and REDA Pay then rejects any message whose signature does not match. It is optional — a v2 profile without a secret accepts messages without a signature check — but recommended for production.
- Choose a secret of up to 64 characters (letters, digits and punctuation). Keep it somewhere safe outside Salesforce; it is never shown again.
- On the Pay Profile, click Update Webhook Secret. The dialog Update Webhook Secret opens with one box, Webhook Signing Secret, and, behind its ⓘ icon, the help text "Up to 64 characters. Payload signs every webhook delivery with it. Run Setup Webhooks after saving."
- Paste the secret and click Update Secret. The message "Webhook signing secret updated successfully. Run Setup Webhooks to apply it." confirms it, and the Webhook Signing Secret field on the record now holds an encrypted value.
- Continue with Part 6: the secret reaches Payload only when the webhooks are registered.
Never type the secret into the Webhook Signing Secret field with Edit: the action is what encrypts it, and a value typed directly does not match what Payload signs with. A v1 profile ignores the field.
The secret is set here and nowhere else. Run Setup Webhooks afterwards.
Part 6 — Register the webhooks with Payload
⚠️ On a v1 profile, Setup Webhooks first deletes every webhook registered under your Payload API key, then creates REDA Pay's. If the same API key is used by another system — another Salesforce org, a website, an accounting integration — that system's webhooks are removed and it stops receiving Payload's messages. Use a separate Payload API key per system, or re-register the other system's webhooks afterwards. On a v2 profile, Setup Webhooks removes only the webhooks it registered for this profile and leaves other systems alone.
- On the Pay Profile, click Setup Webhooks.
- Read the dialog: "System will delete all the existng webhooks and create new webhook setup."
- Click Setup Webhooks. Wait for "Webhook setup created successfully." and close the dialog.
- Open the profile's Webhook Setup tab. It lists one Pay Profile Webhook record per event, each with the Webhook Id Payload assigned and the Webhook URL REDA Pay registered. Webhook Setup Datetime [Payload] on the profile is filled.
| Profile version | Rows on the Webhook Setup tab | Events | Webhook URL ends in |
|---|---|---|---|
| v1 (or blank) | Ten | payment, processed, authorized, credit, refund, reversal, void, decline, deposit, reject | /services/apexrest/rpay/payload/<Pay Profile Id> |
| v2 | Eleven | payment, processed, authorized, payout, refund, withdraw, reversal, void, decline, deposit, reject | /services/apexrest/rpay/payloadv2/<Pay Profile Id> |
A v1 profile: ten webhooks, one per Payload event. A v2 profile lists eleven. If fewer appear, the registration failed part-way: fix the cause and run Setup Webhooks again.
The same tab on a v2 profile: eleven rows, and the address contains /payloadv2/.
Run Setup Webhooks again whenever you change the Webhook API Base URL, replace the API key, change the Payload API Version, or set a new signing secret.
Check that it works
Take a small test payment (see Take a payment) and open its Pay Transaction. Within a few minutes the Status, Status Code and Funding Status fields update without anyone pressing Sync Transaction. For a bank payment, the funding status moves from pending to batched when Payload batches it, and a deposit to your bank account later creates a Statement Activity — see Reconcile deposits and payouts.
If nothing updates, check in this order:
| Check | Where | What to look for |
|---|---|---|
| The site is active | Setup → Sites | Status Active |
| Guest user has the class for the profile's version | Site → Public Access Settings → Enabled Apex Class Access | rpay.PayloadCallback (v1) and rpay.PayloadCallbackV2 (v2) enabled |
| Base URL matches the site | Pay Profile → Webhook API Base URL | Same scheme, domain and path as the Site URL, nothing added |
| Webhooks exist at Payload for the right version | Pay Profile → Webhook Setup tab | Ten (v1) or eleven (v2) records with Webhook Ids; the URL ends in /payload/ or /payloadv2/ to match the profile's version |
| The signing secret matches | Pay Profile → Update Webhook Secret, then Setup Webhooks | If the secret was changed without re-registering, messages are rejected: set it again and run Setup Webhooks |
| Messages are being processed | REDA Pay app → REDA Pay Logs → Attention Needed | A log naming a sync or statement process with an error |
| Automated Process has access | Part 4 | Re-run the script; if it reports the assignment exists, access is in place |
What the messages contain
A message tells REDA Pay only which transaction changed. REDA Pay then asks Payload for that transaction's current state and stores the answer, so the record always reflects Payload, not the message. Messages about transactions Salesforce has never seen are ignored. Deposit and withdrawal messages create or refresh a Statement Activity. On v2, a message whose signature does not match the profile's secret is refused before any of this happens.
Mistakes to avoid
| Mistake | What happens | Fix |
|---|---|---|
| Pressing Setup Webhooks on a v1 profile whose API key is shared with another system | The other system stops receiving Payload's messages | Use one API key per system, or re-register the other system's webhooks |
| Base URL that is not the site address — a page path added, or the full callback address pasted in | REDA Pay appends its own path to whatever you enter, so the registered address is wrong and messages never arrive | Enter only the site address, exactly as shown in Site URL |
| Guest user without the class for the profile's version | Payload's messages are rejected; statuses never update | Enable rpay.PayloadCallback and rpay.PayloadCallbackV2 on the guest profile |
| Switching the profile to v2 without running Setup Webhooks | Payload keeps posting to the v1 address | Run Setup Webhooks after changing the version |
| Typing the signing secret into the field instead of using the action | The stored value does not match Payload's; v2 messages are refused | Use Update Webhook Secret, then Setup Webhooks |
| Skipping Part 4 | Messages arrive but the update fails; a REDA Pay Log may show the error | Assign the cloned permission set to the Automated Process user |
| Changing the API key and not re-registering | Webhooks stay registered under the old key | Run Setup Webhooks again |
FAQ
Any active Salesforce site address works, as long as its guest user has the classes enabled. A dedicated site keeps the integration's guest user separate from your portal's.
It contains your site domain and the Pay Profile's record Id, nothing more. Messages only name a transaction; REDA Pay re-reads the transaction from Payload before changing anything, and on v2 it checks the signature first.
Payments are recorded without them. Webhooks keep the records current afterwards — declines, rejections, refunds made outside Salesforce, deposits — so every production org should have them.
On v1, no: Setup Webhooks on either profile removes the other's webhooks, so only the profile that registered last receives messages. On v2 each profile keeps its own set. Prefer one API key per profile.
Where to go next
- How payment statuses stay current — what each event does to the records.
- Turn on failed-payment recovery — the job that covers payments whose outcome was never received.
- Choose the Payload API version — switching a profile between v1 and v2.