Close Menu
SalesforceCodex
    Facebook X (Twitter) Instagram
    Trending
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    • Top 10 PMD Issues Salesforce Developers Should Focus on in Apex
    • How to Use Graph API for Outlook-Salesforce Connection
    Facebook X (Twitter) Instagram
    SalesforceCodex
    Subscribe
    Thursday, May 29
    • Home
    • Architecture
    • Salesforce
      • News
      • Apex
      • Integration
      • Books Testimonial
    • Questions
    • Certification
      • How to Prepare for Salesforce Integration Architect Exam
      • Certification Coupons
    • Integration Posts
    • Downloads
    • About Us
      • Privacy Policy
    SalesforceCodex
    Home»Salesforce»Apex»Ultimate Guide to Integrate Stripe with Salesforce CRM

    Ultimate Guide to Integrate Stripe with Salesforce CRM

    Dhanik Lal SahniBy Dhanik Lal SahniJuly 15, 2024Updated:May 6, 2025No Comments5 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    https://res.cloudinary.com/salesforcecodex/image/upload/v1721055922/FF/Salesforce-Stripe-Integration-SalesforceCodex_bbyc30.webp
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Businesses need payment integration to streamline operations and increase efficiency and revenue growth. Salesforce CRM supports integration with many payment systems like Paypal, Stripe, Payoneer, Square etc. These payment systems are integrated using configuration or using AppExchange products in Salesforce. This post will explain how to Integrate Stripe with Salesforce CRM using Apex Code.

    What is Stripe?

    Stripe is a global online payment processing platform that allows businesses to accept payments securely and efficiently. It can handle all the technical complexities of payment processing and allow businesses to focus on their business. business. Businesses can use Stripe for credit card payment, debit card payment, Apple Pay, Google Pay, recurring billing or ACH payment. Stripe also offers a suite of APIs that allow businesses to accept payments, manage subscriptions, handle payouts, and much more.

    Use Case

    XYZ Company is running an e-commerce business. Sometimes customers call customer care and ask for a payment link to purchase some products. The customer support executive should be able to provide a shareable payment link to customers for purchasing directly on the Stripe website.

    Solution

    Payment links enable businesses to create a payment page and send the link directly to customers, on social campaigns or in email. There are two ways to generate payment links.

    1. We can create a payment link on the Stripe dashboard page. This is no code approach and the user can directly generate a payment link on Stripe.
    2. We can generate payment links using Stripe REST API.

    In the first approach, support executives will require stripe dashboard access. Businesses normally hesistate to give stripe dashboard access to them. In the second approach, the executive can create a link from Salesforce. In this post, we will generate a payment link using Stripe API in Salesforce Apex

    Integrate Stripe with Salesforce CRM

    The below steps need to be performed to integrate Stripe in Salesforce CRM.

    1. Stripe API Credential
    2. Create Named Credential and External Credential
    3. Create Apex Class for Stripe Integration
    4. Test Page

    1. Stripe API Credential

    We will integrate Stripe REST API in Salesforce to generate payment links. To handle this we need the Stripe API URL and its credentials. Payment link required a product and it’s price that is being sold using the link. You can get a price list from Stripe Admins. Price Lists are created for products for their sale price at a specific time. We can also create prices and products using product and price Strip API. For this post, I am only focusing on payment link generation. If you need help in creating prices and products using REST API, you can ping me on LinkedIn.

    Payment Link API – https://api.stripe.com/v1/payment_links

    Credential

    You can get API credentials from the Stripe Administrator. It is available on the Stripe Developer dashboard page. If you have access then you can also generate. For testing and development always use test mode. Production API key starts with pk_live and the development/testing mode starts with pk_test.

    2. Named Credential

    Salesforce’s Named Credentials securely store and manage authentication credentials for external services or endpoints. We can create a Named Credential and External Credential using the above-mentioned URL and credentials. Check out our video Deep Dive into Salesforce Named Credential to learn about named credentials.

    Create an External Credential in Salesforce

    External Credentials contain authentication protocols, authentication parameters, and permission set information for accessing external systems. Let us create an external credential Stripe EC(StripeEC) to connect Stripe System.

    Stripe External Credential for Stripe Integration

    Create a named principal that will be used to assign external credentials in permission sets. Refer to our other post Accessing External Credential Parameters of Named Credential in Salesforce Apex to use authentication parameters.

    Custom Headers

    We will add two customer headers in the External Credential Custom Header section.

    NameValue
    Content-Typeapplication/x-www-form-urlencoded
    Authorization<Your API key>

    Create Named Credential

    Create a named credential Stripe NC (StripeNC) and assign the above-created External Credential to it. Check Generate Authorization Header and Allow Formulas in HTTP Header in Callout Options to pass external credential parameters at runtime to callout.

    Named Credential for Stripe Integration in Salesforce

    Create a Permission Set and Assign it to yourself

    Create a permission set Stripe User PS and add the above external credentials to the External Credential Principal Access section. Once the permission set is created assign this to the required user.

    3. Create Apex Class for Stripe Integration

    Once the initial setup is ready, we can create an apex class StripePaymentLinkService to integrate Stripe in Salesforce. This class uses the named credential StripeNC. Payment Link API requires price and quantity. So create a request body to pass these values dynamically.

    Apex class StripePaymentLink is response wrapper class. Response data will be saved in this object. There are other information also in payment link respose, but we require few informaition only. If you need all details,then you can get detail from here.

    It will generate a payment link based on the passed quantity and price list ID. If the wrong price list ID is passed then API will return the error “No such price: ‘price_1Pdf3WQLME5sGA4KeKvIGxqq1d’

    Create Controller Class to call Service Class

    Create a controller class to call the above method StripePaymentLinkService.createPaymentLink. We can add a price list for each product in custom metadata types. Based on a product we can extract the price list ID and pass this to StripePaymentLinkService.createPaymentLink to generate a payment link.

    4. Test Page

    When we call StripePaymentLinkController.generatePaymentLink with valid detail it will return the payment link URL similar to below page.

    Payment Link to Integrate Stripe with Salesforce

    References

    Payment Link

    Stripe Authentication

    Related Posts

    How to Seamlessly Integrate Shopify with Salesforce

    Automating data synchronization between Salesforce and Amazon Seller

    Shopify integration with Salesforce using Webhook

    Extract Text From Images using Google Cloud Vision

    Seamless YouTube Video API Integration in Salesforce

    Integrate Slack in Salesforce for Real-Time Notifications

    The Ultimate List of Salesforce Integration Resources

    Stripe Implementation Required?

    If you need stripe implementation in your salesforce org, you can contact us for implementation.

    apex external credential integration named credential rest api salesforce salesforce apex stripe stripe integration
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleHow to Seamlessly Integrate Shopify with Salesforce
    Next Article The Ultimate Checklist for Efficiently Querying Large Data Sets
    Dhanik Lal Sahni
    • Website
    • Facebook
    • X (Twitter)

    With over 18 years of experience in web-based application development, I specialize in Salesforce technology and its ecosystem. My journey has equipped me with expertise in a diverse range of technologies including .NET, .NET Core, MS Dynamics CRM, Azure, Oracle, and SQL Server. I am dedicated to staying at the forefront of technological advancements and continuously researching new developments in the Salesforce realm. My focus remains on leveraging technology to create innovative solutions that drive business success.

    Related Posts

    By Dhanik Lal Sahni4 Mins Read

    How to Build a Generic Modal Window in Lightning Web Component

    May 26, 2025
    By Dhanik Lal Sahni6 Mins Read

    Top 10 Salesforce Flow Features of Salesforce Summer ’25

    May 11, 2025
    By Dhanik Lal Sahni6 Mins Read

    Unlock the Power of Vibe Coding in Salesforce

    April 30, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (111) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) file upload (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (30) Lightning web component (62) lwc (51) named credential (8) news (4) optimize apex code (4) Permission set (4) pmd (3) Queueable (9) rest api (23) S3 Server (4) salesforce (141) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (111) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) file upload (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (30) Lightning web component (62) lwc (51) named credential (8) news (4) optimize apex code (4) Permission set (4) pmd (3) Queueable (9) rest api (23) S3 Server (4) salesforce (141) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn Reddit Telegram
    © 2025 SalesforceCodex.com. Designed by Vagmine Cloud Solution.

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.