Stripe Salesforce Integration Chargent

Integrating Stripe and Salesforce using Chargent

This guide shows you how you can easily connect Salesforce to Stripe using the Chargent Payment Processing for Salesforce application. Chargent will allow you to initiate Stripe payments (charge credit cards or ACH / eChecks) directly from Salesforce, either via embedded buttons or scheduled batches for recurring payments.

Note: This is primarily a synchronous integration, meaning that transactions sent to Stripe from Salesforce will update 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 Chargent Payment Processing for Salesforce into your Salesforce org.

  2. Configure Chargent according to the step by step documentation.

  3. Add a Gateway record for Stripe

    1. Navigate to the "Gateways" tab in Chargent and click "New"

    2. Add a Stripe Gateway record

    3. Select "Stripe" as the record type from the list of prebuilt payment gateway integrations.

    4. Log into your Stripe Account and select "Account Settings" from the "Your Account" drop down menu in the top right hand corner. Navigate to the "API Keys" tab.

    5. If you do not yet have a Stripe account, you can sign up for a developer account in just seconds -- all you need is an email address. Of course, if you wish to process real (live) transactions, you will need to open a full account and provide more information including financial information.

    6. Copy the "Test Secret Key"

    7. All Stripe transactions use the same server endpoint (, 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 for test and production, to keep both test and live options. 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.

      Stripe API Keys

    8. Return to the Chargent application inside Salesforce, and enter a name for the new Gateway record (eg. "Stripe Test Gateway"). Paste the "Test Secret Key" you copied from Stripe into BOTH the "Merchant ID" and "Merchant Security Key" fields. Click "Save"

    9. Stripe Gateway Setup in Chargent

    10. In Stripe, double check to make sure your account is in Test Mode.

    11. If you signed up for a developer account, you won't be able to use Stripe in live mode until you fully activate your account, so this is not a concern. But it is always best to check, since payment gateways typically have a setting to control test / live, in addition to changes made on the integration side (for example, using the Stripe "Test Secret Key" instead of the "Live Secret Key" in the Salesforce gateway record).

      Stripe Test Mode

  4. Create a test transaction record in Salesforce.

    1. Chargent Payment Processing for Salesforce embeds its payment fields in either the Salesforce Opportunity, Case or Chargent Orders (custom) object. For this documentation we will be using the Chargent Orders object because it is a stand alone object, but the fields are the same as those you would add to the Opportunity or Case page layout in Salesforce should you choose to use one of those packages.

    2. Create a new Order record and enter sample data to run a test transaction.

      1. Name
      2. Amount
      3. Billing Address
      4. Stripe's suggested test credit card numbers.
      5. Any expiration date in the future.

    3. By default, passing address or CVC data with the card number will cause the address and CVC checks to succeed.

    4. If you have more than one Active gateway record in Chargent, you will need to specify which one to use in the Order record. Otherwise, you can leave the gateway lookup field blank.

    Stripe Chargent Order

  5. Run a test transaction

    1. Click the "Charge" button in your newly created Salesforce order record. You should receive a popup in a few moments with the response from Stripe.

    2. Stripe Charge Approved in Salesforce

    3. When you click "Ok" on the popup dialog box, the Salesforce page will refresh and you can then scroll down and see the Transactions related list, with the response and the Gateway ID that was sent back to Salesforce by Stripe.

    4. Stripe Transactions Related list in Salesforce

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

    6. Stripe Dashboard


    Chargent Payment Processing for Salesforce supports Stripe's secure tokenization feature. Tokenization helps you meet PCI compliance, 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.

    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 generally.

    Stripe tokens 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.

    Stripe Salesforce Tokenization

  6. Enabling Stripe Tokenization in Chargent

    • Check the Use Tokenization box on the Stripe Gateway Record in Salesforce
    • Set the Credit Card Handling field
      • 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: 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 feature, the card number was never stored during the generation of the token).

  7. That's it!

  8. You have now successfully integrated Salesforce and Stripe, via the Chargent Payment Processing for Salesforce app. There are many more options for integrating business processes, as well as ways to customize Chargent further. But the basic connection is now in place, and you can process one-time or recurring credit card payments through Stripe directly from Salesforce.

Sending Live Transactions from a Salesforce Sandbox

When Chargent is installed in a Salesforce Sandbox, transactions are always sent to the payment gateway's test / sandbox / development environment, regardless of whether Chargent's Test Endpoint checkbox is checked. This is done as a security precaution, to prevent real transactions from being accidentally sent from a Salesforce Sandbox.

When Chargent is installed in a production or developer Salesforce org, the Test Endpoint checkbox on the Gateway record will select between sending to the payment gateway's live and test environments. (There are a few exceptions, such as Stripe, which has a single endpoint to send transactions to, and different credentials for live versus test transactions).

If you wish to send live transactions from a Salesforce Sandbox, as a final step in testing, simply use Chargent's Endpoint Override field on the Gateway record, and enter the production endpoint of your chosen gateway there.

Here is the production endpoint URL for Chargent's integration with Stripe:

Note that the full endpoint URL must be entered in the Endpoint Override field, and the domain must be present in the Remote Site Settings (for standard Chargent integrations it should be already present).