Salesforce Package
Install the LostChurn managed package to track payment recovery directly in Salesforce.
The LostChurn Salesforce managed package installs custom objects, Lightning Web Components, and a webhook handler into your Salesforce org. Your sales and success teams see recovery data on Account and Contact pages without switching tools.
What You Get
After installation, the package adds:
- Custom Object (
LostChurn_Recovery__c) -- Tracks every recovery attempt with status, amount, decline code, retry count, and timestamps. - Recovery Panel LWC -- A data table of recovery records that appears on Account and Contact record pages.
- Recovery Timeline LWC -- A detailed timeline view on
LostChurn_Recovery__crecord pages showing each retry attempt and outcome. - Webhook Handler -- A REST endpoint that receives LostChurn webhooks and upserts Recovery records automatically.
- API Client -- An Apex class that queries the LostChurn REST API for on-demand data sync.
- Scheduled Sync -- A schedulable Apex job that syncs pending recoveries every 4 hours.
- Connected App -- Pre-configured OAuth for secure API communication.
Prerequisites
- A Salesforce org (Essentials, Professional, Enterprise, or Unlimited edition)
- System Administrator profile or the "Customize Application" and "Manage Connected Apps" permissions
- A LostChurn account with at least one active payment processor connected
LostChurn supports both Production and Sandbox Salesforce orgs. Choose your environment when connecting.
Install the Managed Package
- In your LostChurn dashboard, go to Settings > CRM and click Connect Salesforce.
- Select your environment: Production or Sandbox.
- You are redirected to Salesforce's OAuth login page. Sign in with your admin credentials.
- Review the requested permissions and click Allow.
- LostChurn installs the managed package in your org, which creates the custom object, LWC components, and Apex classes.
- You are redirected back to LostChurn with your Salesforce org ID and org name confirmed.
The following OAuth scopes are requested:
api-- REST API access for CRUD operationsrefresh_token-- offline access for background sync
Set Up Named Credentials
The package uses Named Credentials to securely call the LostChurn API from Apex:
- In Salesforce Setup, go to Security > Named Credentials.
- The LostChurn Named Credential is created automatically during package installation with the endpoint
https://api.lostchurn.com. - Verify the credential shows "Authenticated" status.
If the credential was not created automatically:
- Click New Named Credential.
- Set Label to
LostChurnand URL tohttps://api.lostchurn.com. - Set Identity Type to "Named Principal" and Authentication Protocol to "OAuth 2.0".
- Enter the client credentials from your LostChurn dashboard (Settings > CRM > Salesforce > API Credentials).
Assign Permission Sets
The package includes a permission set called LostChurn_User that grants access to the custom object and LWC components.
- In Salesforce Setup, go to Users > Permission Sets.
- Click LostChurn_User.
- Click Manage Assignments and add the users who should see recovery data.
Without this permission set, users will not see the Recovery Panel or Timeline components on record pages.
Configure LWC Components
Recovery Panel on Account/Contact Pages
- Navigate to any Account or Contact record page.
- Click the gear icon and select Edit Page.
- Drag the LostChurn Recovery Panel component from the component palette onto the page layout.
- Click Save and Activate.
Recovery Timeline on Recovery Record Pages
- Navigate to any
LostChurn_Recovery__crecord. - Click the gear icon and select Edit Page.
- The LostChurn Timeline component should already be present. If not, drag it onto the layout.
- Click Save and Activate.
Custom Object Fields
The LostChurn_Recovery__c object includes these fields:
| Field | API Name | Type |
|---|---|---|
| Recovery ID | Recovery_ID__c | Text (External ID) |
| Status | Status__c | Picklist (Started, Retrying, Recovered, Exhausted) |
| Decline Code | Decline_Code__c | Text |
| Decline Category | Decline_Category__c | Text |
| Retry Count | Retry_Count__c | Number |
| Recovered Amount | Recovered_Amount__c | Currency |
| Started At | Started_At__c | DateTime |
| Completed At | Completed_At__c | DateTime |
| Contact | Contact__c | Lookup(Contact) |
| Opportunity | Opportunity__c | Lookup(Opportunity) |
What Gets Synced
| LostChurn Event | Salesforce Action |
|---|---|
| Recovery started | Creates LostChurn_Recovery__c record, publishes Platform Event |
| Retry attempted | Updates retry count and status on Recovery record |
| Recovery succeeded | Sets status to Recovered, creates Opportunity (Closed Won) |
| Recovery exhausted | Sets status to Exhausted, creates Opportunity (Closed Lost) |
| Customer data updated | Updates custom fields on Contact (MRR, churn risk, recovery count) |
Platform Events (LostChurn_Recovery_Event__e) are published for each recovery event. Use these in Flows, Process Builder, or Apex triggers for custom automation.
Webhook Handler
The package includes a REST endpoint at /services/apexrest/lostchurn/webhook that receives recovery events from LostChurn. Webhook payloads are verified using HMAC-SHA256 to prevent spoofing.
The webhook handler:
- Upserts
LostChurn_Recovery__crecords byRecovery_ID__c - Links records to Contacts by email address
- Publishes Platform Events for downstream automation
Troubleshooting
"INVALID_SESSION_ID" error
Your Salesforce session has expired. Go to Settings > CRM > Salesforce in LostChurn and click Reconnect.
Custom object not created
- Go to Settings > CRM > Salesforce in LostChurn.
- Click Install Custom Objects.
- Ensure the connecting user has the "Customize Application" permission.
LWC components not visible
- Confirm the user has the
LostChurn_Userpermission set assigned. - Verify the components were added to the page layout via Lightning App Builder.
Duplicate contacts
LostChurn matches contacts by email. If you have duplicates, LostChurn updates the first match returned by Salesforce. Use Salesforce's duplicate management rules to merge duplicates.
Scheduled sync not running
- In Setup, go to Apex Jobs and confirm
LostChurnScheduleris scheduled. - If not, open the Developer Console and run:
System.schedule('LostChurn Sync', '0 0 */4 * * ?', new LostChurnScheduler());
Disconnecting
- Go to Settings > CRM > Salesforce in LostChurn.
- Click Disconnect.
- Choose whether to keep or remove custom objects and fields.
Removing custom objects deletes all LostChurn_Recovery__c records in your org. This cannot be undone.
Next Steps
- HubSpot integration -- alternative CRM integration
- CRM sync settings -- configure sync behavior and field mapping
- Outbound webhooks -- build custom integrations