Stripe Integration with Salesforce

Stripe Integration with Salesforce

So firstly what is stripe? Stripe is the most commonly used payment gateway. Stripe is widely used by e-commerce, subscription based services and by many small as well as large scale businesses to manage their payments and subscriptions. With the help of Rest API’s Stripe makes it easy for us to manage our payments.

While I was integrating Salesforce to stripe I faced many challenges, with the help of this article I would like to share my learning and the steps for Salesforce to Stripe integration using input from a LWC component. I have also attached the link to my GIT for reference to code.

Some key use cases of Stripe:

  1. Manage customers.
  2. Manage their payment methods and also save the primary payment source.
  3. Initiate transaction from Salesforce.

Key Challenge:

Despite detailed documentation provided by Stripe, integration with Stripe using Apex was challenging while passing the nested object structure in url encoded format.

How we usually pass nested object structure in JSON.


How Stripe accepts nested objects(check the link to git for complete code)


Steps to integrate Stripe with Salesforce.

Firstly you would need the secret key from your stripe account. To get the secret key go to Developers->API key-> check on reveal key to get it.

  1. Once you have the key you can store it in your environment(I used a custom metadata to store it)
  2. Creating a screen for the inputs required for the integration, which will be calling the Helper for creating the customer, payment method and initiates the payments. I have shared the code which uses a Stripe helper to create the request and call Stripe API for customers, payment methods and then to initiate the payments.

3. Once the payment is processed check your stripe account for all the records and store the transaction Id in Salesforce for future reference(eg. Lead, if making payments for a lead record.)

Contribute to sanjeet2401/Salesforce development by creating an account on GitHub.



Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter
Subscribe to our email newsletter today to receive updates on the latest news, tutorials and special offers!
Thanks for signing up. You must confirm your email address before we can send you. Please check your email and follow the instructions.
We respect your privacy. Your information is safe and will never be shared.
Don't miss out. Subscribe today.
WordPress Popup Plugin