So firstly what is a 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 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 the code.
Some key use cases of Stripe:
- Manage customers.
- Manage their payment methods and also save the primary payment source.
- Initiate transactions 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 the reveal key to get it.
- Once you have the key you can store it in your environment(I used a custom metadata to store it)
- Creating a screen for the inputs required for the integration, which will be calling the Helper for creating the customer, and payment method and initiating 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 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.)
sanjeet2401/Salesforce
Contribute to sanjeet2401/Salesforce development by creating an account on GitHub.
github.com
Checkout the below video to know more:
Kizzy Consulting
Kizzy Consulting is a Salesforce Consulting Partner based in Panchkula, India. Kizzy has successfully implemented 100+ Salesforce projects for 100+ clients across sectors like Financial Services, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Germany, and Australia. Get a free consultation now by emailing us at sunidhi@kizzyconsulting.com or Contact us.