
ACCURATE STRIPE PAYMENT TRACKING IN SALESFORCE WITH APEX
OVERVIEW
After receiving payment events from Stripe, a leading radio news station needed Salesforce to process the JSON data and create structured records. The challenge was handling missing metadata, associating payments with the correct accounts, and automatically generating related opportunities and payment records. We developed an Apex solution that parses each payment event, retrieves additional data via the Stripe API, and creates all necessary Salesforce records in a streamlined workflow.
THE CHALLENGE
Stripe payment events did not include all the information required for Salesforce records, such as invoice numbers or complete customer metadata. This necessitated manual intervention to supplement the data, link payments to the correct accounts and contacts, and create related opportunities and payment records. The station needed a fully automated, scalable solution that ensured accurate recording of every donation.

OUR SOLUTION
We built custom Apex code to receive JSON payloads from Stripe webhooks and create staging records in Salesforce. For subscription payments, the Apex logic makes API calls to Stripe’s invoices and customers endpoints to retrieve missing metadata. The code then matches or creates Account, Contact, and Opportunity records before generating the Payment record. Triggers on the staging object ensure proper order of processing for subscriptions, lump sum payments, and refunds.
KEY FEATURES
- • Apex code parses Stripe’s JSON payment data
• API callouts to Stripe invoices and customers endpoints for missing info
• Automatic creation or matching of Account, Contact, Opportunity, and Payment records
• Supports multiple payment types: subscription, lump sum, refund
• Staging object and triggers ensure structured and reliable processin
GLOBAL IMPACT/RESULTS
- • Fully automated record creation eliminates manual imports
• Accurate linking of payments to donor accounts and opportunities
• Consistent processing across all payment types
• Improved data integrity and reporting in Salesforce
• Scalable framework supports future donation growth
TECHNOLOGIES & SERVICES
Salesforce Apex — parsing JSON and orchestrating record creation
Stripe REST API — retrieving invoices and customer metadata
Custom REST Resource — secure endpoint for webhook ingestion
Triggers — structured processing of staging records
CONCLUSION
This Apex-driven solution ensures that every donation is fully processed, accurately linked, and immediately available in Salesforce. The radio station now benefits from a robust, scalable framework that simplifies payment management, strengthens donor insights, and supports future fundraising growth.