Stripe Salesforce Integration

Stripe provides us the great APIs to do recurring billing and online payments. Ideal for subscription and e-commerce business to accept payments from around the world While Salesforce is a leading cloud sales platform with diverse CRM functionality on multiple devices and robust app marketplace.

We are working on a Salesforce Org in which we have installed Nonprofit Success Pack(NPSP) and Our client wants to sync all the payments & customer from stripe into Salesforce Payment & contact object. To sync all the payments & customers we decided to do Stripe Salesforce Integration.

You can use the Stripe API in test mode, which does not affect your live data or interact with the banking networks. API key we use to authenticate the request determines whether the request made is in live mode or test mode.

Authentication

To authenticate the requests in Stripe API you have to use API keys. From Stripe Dashboard you can view and manage your API keys. Live mode secret keys have the prefix sk_live_ and test mode secret keys have the prefix sk_test_ Alternatively, you can also use restricted API keys for the granular permissions.

Using your account’s API keys Stripe authenticates your API requests. Stripe returns an error if you make the API request without including you API key , or use the one that is incorrect or outdated. Every Stripe account is provided with separate keys for running live transactions and for testing.

Obtaining your API keys from Stripe

Stripe have two types of API keys :-

  1. Publishable API keys are used to identify your account with Stripe, they are not secret. In other words, Publishable API keys can safely be published in places like your Stripe.js JavaScript code, or in an Android or iPhone app. These keys only have the power to create tokens.
  2. Secret API keys only stored on your own servers and should be kept confidential. You can perform any API request to Stripe without restriction using your account’s secret API key.

Stripe SalesForce Integration functionality:-

  1. Stripe and Salesforce syncing : We obtain secret keys from stripe dashboard to sync the stripe and Salesforce.

    Stripe Salesforce Image

  2. Fetching the Stripe customer and payment details from stripe : We used stripe API keys to fetch the Customer and payments from stripe. There is no need to do any extra authentication because stripe provides us their API to be used for authentication. With the help of Stripe APIs we fetched the Customer and Payment info. Information fetched was in JSON format so you have to parsed it and displayed it on Salesforce side in the respective Salesforce objects.

    Stripe Salesforce Image

  3. Method used for syncing the Stripe and Salesforce : We created an Apex batch class to sync the data from stripe into Salesforce. We schedule this batch class to be run every hour and sync the stripe data created in the past one hour into Salesforce.
  4. Customer and Payment Records creation in Salesforce: After the successful completion of Apex job in Salesforce, Customer and payment records are created into Salesforce
    Customer information in Salesforce :-

    Stripe Salesforce Image
    Payment Information in Salesforce :-

    Stripe Salesforce Image

Now the Stripe Integration is precisely tested and it is working fine As the Customer and Payment information are successfully saved in the Salesforce Contact and payment object as per the Client’s Business logic.