Integrating Stripe and Salesforce using Chargent

Stripe

If you do not already have a Stripe account, you can sign up for an account in just seconds.

This guide shows you how to connect Salesforce to Stripe using Chargent. Chargent will allow you to initiate Stripe card payments directly from Salesforce, as well as being able to manage Stripe refunds from Salesforce.

Note: Chargent’s integration to Stripe from Salesforce sends transactions to Stripe, and updates Salesforce with the Stripe responses (approved / declined with related information), but historical data or transactions that are not initiated from Salesforce will not be synced from Stripe to Salesforce.

  1. Install both Chargent Base and Chargent Transactions into your Salesforce org.
  2. Configure Chargent according to the step-by-step Installation and Setup Guide.
  3. Activate the Remote Site Settings in Salesforce if they aren’t already active for Stripe.
    • Click the gear icon on the top right and select Settings
    • Under Security select Remote Site Settings
    • Locate Stripe and click edit
    • Check the Active box
    • Click Save
Connect Stripe and Salesforce with Chargent

See all Stripe transactions, manage refunds, send payment links and more, all inside Salesforce with Chargent, the top rated payments app on the Salesforce AppExchange.

Not yet a Chargent customer?

Contact us for a no-obligation 30 day trial, and see for yourself!

Connecting Stripe & Salesforce using the Chargent Setup Wizard

  1. Click on the App Launcher on the top left side in Salesforce.
    App Launcher
  2. Select Chargent as the App
  3. Select the Chargent Settings Tab
  4. Choose Chargent Setup Wizard
  5. Follow the prompts to configure your gateway
    Payment Gateway

Once you click Yes and select Stripe as your payment gateway, you will need the following information to configure the gateway setup:

  • Secret Key from Stripe (either Live or Test)
    • In your Stripe dashboard, go under Developers and select API keys (For testing, toggle the “View Test Data” button to get the Test Secret Key). Click Reveal test key token and copy the token into the Wizard.
      Secret Key
  • What currency you will be using
  • What Payment Methods you will be accepting. Our Stripe gateway integration currently supports card transactions only.

All Stripe transactions use the same server endpoint (https://api.stripe.com), so test transactions should be sent using the “Test Secret Key”, and live transactions should be sent using the “Live Secret Key”. We recommend creating two different Gateway records in Chargent. One for testing and another for live production. You can easily deactivate the test gateway record in Salesforce when you are ready to process live credit card transactions, but you may wish to use it again for future testing at some point.

Note: The above video mentions ACH and Direct Debit payments. Due to current technical limitations, our Stripe integration no longer accepts ACH or Direct Debit.

Stripe Settings Required for Chargent

In order to allow credit card transactions to be sent from Salesforce to Stripe, you must comply with Stripe’s policy for enabling access to raw card data APIs. For more information about this requirement, see our Knowledge Article about Stripe’s Raw Credit Card Transaction Policy.

If you have any questions about the requirement, please contact us.

Testing using Chargent Anywhere

Testing with Payment Console

To test using the Payment Console, you want to navigate to any record in your Sandbox that has the Chargent Anywhere Component enabled.

  1. Click the [PaymentConsole] button
  2. If you are using multiple gateways select your gateway from the dropdown otherwise continue to step 3
  3. Enter all the Billing Information and click [Next]
  4. Enter in a test credit card number, expiration date, and CVC code based on the Stripe test credit card numbers.
  5. Click the [Charge] button.

You should receive a green box showing Approved.

Stripe Charge

Testing using Payment Request

To test using a Payment Request you want to be sure you have the Chargent Payment Request feature set up as outlined in our documentation.

  1. Click the [Send Payment Request] button
  2. If you have multiple Payment Request templates set up you will first choose what template you want to use.
  3. Enter an email address where you want to send the test Payment Request along with any amount.
  4. Enter a Contact name (Optional)
  5. Click the [Send Request] button

Send Payment Request

When you receive the email, click the secure link for the Payment Request. Use one of Stripe’s credit cards to complete the payform and submit the payment.

You should receive a green box showing Approved.

Card Bank Payment

You should receive a green box confirmation

Card Bank payment

Go back to Stripe and confirm that you see the test transaction from Salesforce in your Stripe dashboard.

Salesforce Filter

That’s it! You have now setup and tested your Stripe integration.

Tokenization

Chargent Payment Processing for Salesforce supports Stripe’s secure tokenization feature. Tokenization helps you decrease PCI compliance scope and improve security, by storing transaction data such as credit card numbers on Stripe’s servers, and associating it with a token Chargent stores in Salesforce for use in future transactions.

The token returned by Stripe is stored in the Token field on the Chargent Order record in Salesforce.

 

Customer Token Migration

You can also use the tokenization feature when migrating existing customers in Stripe to Chargent. This is useful because the customer tokens can easily be exported and imported into Salesforce, whereas credit card numbers cannot.

Stripe tokens are strings of letters and numbers that start with cus_. Click Customers on the left and export on the upper right to get the data you need to import your customers into Salesforce. Insert the id column in the export file to the Chargent Token field to complete the migration. We recommend setting a Stripe test gateway record in Salesforce using the test credentials from Stripe, per the instructions above, then running it in parallel to your current system for a full month to validate that all is correct.

Customer Migration

If you didn’t enable tokenization when setting up Stripe using the Gateway Setup Wizard, you can enable tokenization by following these steps.

  1. Click on the App Launcher in the top left hand side of Salesforce.
  2. Search for Gateways.
  3. Edit the Stripe Gateway record.
  4. Check the box that says Use Tokenization.

You can then set the Credit Card Handling field to one of the following

  • Never Clear: Chargent will not remove any card data automatically.
  • Clear After Successful Charge: Chargent will clear the credit card number, expiration dates and card security code only after a successful charge is run.
  • Clear After All Transactions: The credit card number, expiration date and card security code will be erased after any approved transaction (Charge, Void, Refund)
  • Clear When Token Present: (Recommended) Only when a token is present in the token field, will the credit card number, expiration date and card security code be cleared.
    • When your first successful charge goes through, the Credit Card Number field in Salesforce will be deleted, and a token will be stored for future transactions in the Chargent Token field.
    • If you are using Chargent’s Payment Console or Payment Request feature, the card number will never be stored during the generation of the token.

Sending Live Transactions from a Salesforce Sandbox

Chargent is configured to always send transactions from a Salesforce Sandbox as test transactions, regardless of whether it is set to test or live. Since Stripe always sends transactions to the same endpoint, however, you only need to setup a Stripe Gateway using your Live Secret Key. Once you have your new gateway setup with your live credentials you will be able to send live transactions from your sandbox account.

Gateway Mapping

Chargent Order Field Stripe Field
Amount > amount
Order Information > description
Billing First Name > card[name]
Billing Last Name > card[name]
Billing Country > card[address_country]
Billing Email > email
Currency < currency
Token < customer

For Stripe, the ID number is reflected for the Gateway ID, Customer ID, and Payment ID. This number is the same with a different prefix.

Example:
Gateway ID = ch_1H9vDaDI21N91uCjGNc6sWTK
Token = cus_1H9vDaDI21N91uCjGNc6sWTK
Payment ID = card_1H9vDaDI21N91uCjGNc6sWTK