While learning about Stripe /Salesforce integration and implementing connectivity between the two systems for customers, payment methods and payments. I went ahead and explored subscriptions, invoicing as subscription has become an integral part of payment ecosystem. I have also attached the link to my GIT for reference to code which includes webhooks and Rest API’s for subscription and invoicing.
Some Key use cases for Salesforce Stripe integration for subscription and invoice:
- Manage subscription in Salesforce
- Receive invoice and payment updates to your Salesforce org whenever a subscription is processed every(month/year) using Stripe webhooks.
- Perform business logics around failed payments to help agents reach out to customers.
- Create Subscriptions, invoice, payment, customers in Salesforce using webhooks while being created/updated in Stripe from other peripheral systems.
Bidirectional sync for subscriptions between Salesforce and Stripe:
- In Order to connect Stripe with Salesforce and integrate customers, payment methods and payments check out the previous article.
2. Once Stripe is connected, create a custom object called subscription, which will be related to Account(customer) with some basic fields like start date, end date, stripe subscription/schedule id.
3. Configure products with prices in Stripe as well as Salesforce as they are required for subscription.
4. Using Triggers we can sync call the stripe schedule api end point, which will create a schedule in Stripe. Please note I would suggest going for a schedule rather than subscription API, as schedule can be modified. Refer to the code in my GIT repo below for schedule subscription api.
Note: For subscriptions, products need to be configured in stripe.
Contribute to sanjeet2401/Salesforce development by creating an account on GitHub.
4. Every month when a subscription is processed invoice and payment records are created which can be synced back to salesforce using webhooks.
What are Webhooks?
Webhooks are one of a few ways web applications can communicate with each other. It allows you to send real-time data transfer from one application to another whenever a given event occurs.
Steps to configure webhooks in Stripe:
- Go to the Developers->webhook-> click on add endpoint
- Enter the end point where you want to receive the webhook.
3. click on select events to add the events on which webhook should fire.
4. After configuration, whenever an event occurs, you will receive the payload on the configured endpoint.