PayPal Salesforce Integration Chargent

Integrating PayPal Payflow Pro and Salesforce using Chargent

This guide shows you how you can easily connect the PayPal Payflow Pro payment gateway to Salesforce, in order to charge credit cards directly from Salesforce, either via embedded buttons or scheduled batches for recurring payments.

Payflow is PayPal's secure, open payment gateway. With Chargent's ability to send payments directly from Salesforce to Payflow using an API, you can have total control over the payment process. Payflow allows merchants to choose any Internet Merchant Account to accept debit or credit card payments and connect to any major processor. You can also select PayPal as your credit card processor (see PayPal Payments Pro).

Note: This is primarily a synchronous integration, meaning that transactions sent to PayPal Payflow Pro from Salesforce will receive the PayPal Payflow Pro responses (approved / declined with related information) and store them in Salesforce. Transactions that are not initiated from Salesforce (if any) will not be synced from PayPal Payflow Pro to Salesforce.

Once your connection between PayPal Payflow Pro and Salesforce is up and running with Chargent, however, you should not need to initiate any transactions from PayPal Payflow Pro (or really log into PayPal Payflow Pro for any reason other than needing to update security settings or approve transactions).

  1. Install Chargent Payment Processing for Salesforce into your Salesforce org.
    • Note that Chargent is a paid application, but it has a 30 day trial.

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

  3. Testing the Integration

  4. We recommend first creating a PayPal Payflow Pro test account, which is a separate, free account for testing purposes.

    • Select "I do not have a Processor. Setup test account." to get a test account.
    • PayPal Payflow Pro will send you an email. Login to confirm your account using the Merchant Login and Password you just created, and "PayPal" as the Partner.

    Login to PayPal Manager

  5. Add a Gateway record for PayPal Payflow Pro in Salesforce
    • Navigate to the Gateways tab in Chargent and click New

    Add the PayPal Payflow Pro Gateway in Chargent

    • Select PayPal Payflow Pro as the record type from the list of pre-integrated payment gateway Salesforce integrations that Chargent offers.

    • Complete the PayPal Payflow Pro gateway record as follows:

      • Gateway Name - Any name you choose, for example "PayPal Payflow Pro Test"
      • Merchant Reference- the Partner name provided by PayPal Payflow Pro (for the test account it will be "PayPal", but for production if you signed up through a Bank rather than directly with PayPal it may be different
      • Merchant ID - the Merchant Login name provided by PayPal Payflow Pro
      • Merchant Security Key - the password you chose when you signed up
      • Username - generally this can be left blank, unless you have set up additional users on the Payflow account
      • Active and Test Endpoint should both remain checked
      • Click Save

      PayPal Payflow Pro Gateway Settings for Chargent

  6. Configure your PayPal Fraud Settings

    • Even though you have set up a test account, PayPal uses the same security as their regular accounts, to provide as close to the live experience as possible. So you may need to adjust your Fraud Settings or you will sometimes receive an error with message "Under Review by Fraud Service" when submitting test transactions.

    • Go to Service Settings > Fraud Protection > Edit Standard Filters
    • Change the settings as desired for testing and click Deploy
    • Go to Account Administration > Transaction Settings to set a maximum amount per transaction as well.

    PayPal Payflow Pro Fraud Setup

  7. Create a test record in Salesforce.

    • Test transactions are simulated and do not incur any fees or have any money change hands. When you check the Test Endpoint box on the Gateway record in Salesforce, Chargent sends your transactions to a test server.
      • Production Server:
      • Test Endpoint Server:

    • Chargent Payment Processing for Salesforce adds its payment fields to 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 with its own page layout, 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.

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

      • Billing First Name / Billing Last Name
      • Subtotal (or Amount if using Opportunities / Cases)
        • ($0-$1000 recommended, > $2001 will be declined in tests)
      • Billing Address
      • PayPal Payflow Pro has test credit cards to use for testing. Other cards will produce errors during testing.
      • Any expiration date in the future in the format MM / YY

      • Payflow Pro Test Cards (PayPal Processor)
        • American Express 378282246310005
        • American Express 371449635398431
        • Amex Corporate 378734493671000
        • Australian BankCard 5610591081018250
        • Diners Club 30569309025904
        • Diners Club 38520000023237
        • Discover 6011111111111117
        • Discover 6011000990139424
        • JCB 3530111333300000
        • JCB 3566002020360505
        • MasterCard 5555555555554444
        • MasterCard 5105105105105100
        • Visa 4111111111111111
        • Visa 4012888888881881
        • Visa 4222222222222

      • Payflow Pro Test Cards (Other Processors)
        • American Express 378282246310005
        • American Express 371449635398431
        • American Express Corporate 378734493671000
        • Diners Club 38520000023237
        • Discover 6011111111111117
        • Discover 6011000990139424
        • JCB 3530111333300000
        • JCB 3566002020360505
        • MasterCard 5555555555554444
        • MasterCard 5105105105105100
        • Visa 4111111111111111
        • Visa 4012888888881881
        • Visa 4222222222222
      • To view the Credit Card Processor that you have selected for testing, see the PayPal Manager.

      • There are methods for testing the Card Security Code (CVV) and Address Verification Settings (AVS). For more details, please see the PayPal Payflow Gateway documentation.
        • For CVV approval, use a value 000-300
        • For AVS approval, use a zipcode < 50000 and first 3 digits of the street number < 333

      • If you have more than one Active gateway record configured in Chargent (which you should not at this point), you will need to specify which one to use in the Chargent Order record. Otherwise, you can leave the gateway lookup field blank (and may wish to hide it from the page layout in the future since non-administrator Salesforce users should not need to access it).

      • Although Chargent Payment Processing for Salesforce supports both credit card and ACH / eCheck payments from Salesforce, you may need to have ACH (electronic checks) enabled on your PayPal Payflow Pro account, so for this demo we are going to run test credit card transactions.

      Chargent Order custom object showing PayPal Payflow Pro sample Salesforce record

  8. Run a test transaction

    • Click the Charge button in your newly created Salesforce order record. You should receive a popup in a few moments with the response from PayPal Payflow Pro.

    Successful PayPal Payflow Pro Test Transaction in Salesforce

    • 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 PayPal Payflow Pro.

    PayPal Payflow Pro list of Transactions in Salesforce

    • If you receive an Error and the test transaction is not approved, you may need to adjust the Fraud settings in the PayPal Manager under Service Settings > Fraud Manager > Test Settings
      • You may need to disable AVS matching to get approved test transactions

    • Sign into the PayPal Manager interface to see the test transactions under Search Transactions

    PayPal Payflow Pro Transaction Search

  9. Your connection between Salesforce and PayPal Payflow Pro is now set up and working. Let's proceed to the final tests before the system goes live.

  10. 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 PayFlow Pro:

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

    Going into Production

    There are many options for additional customization of how Chargent works within Salesforce beyond the basic setup described above. Once you have configured Chargent to your satisfaction, and have completely set up and tested any integration or automation with your other business processes, it is time to move into production.

  11. Live versus Test Status

    • Your Payflow account and associated services can have either a Test or a Live status.

      • Test. All transaction information is sent to test servers at PayPal. You should run transaction or configure settings in Test status to get comfortable with the services. No money trades hands in test transactions. For services, when you purchase a service, it is in Test status. Configure the service as per your business needs when it is in Test status.
      • Live. All transactions that you submit are sent to the financial institutions for processing and that real money is transferred. For your services, the settings that you configured when in Test status go into effect, and impact your transactions accordingly.

    • Once you have completed your testing, you can activate your Payflow account by clicking on the Activate Your Account button on the Your Account Status section of the PayPal Manager Home page to transact actual currency. Active accounts perform Live transactions.

    PayPal Payflow Pro Account Status

  12. Live versus Test Mode

    • In addition to the Account Status (Live or Test), each PayPal service has a Mode.

      • For Payflow, PayPal cannot determine if you are performing test or live transactions (you can perform both) so it will show "--" as its mode.
      • When your account is active and Payflow is in Live Status, you still have the option to troubleshoot problems by submitting test transactions. Just check the Test Endpoint button on the Chargent Gateway record to send a transaction to the test server, and use a test credit card account number.
      • You may also wish to go to Service Settings in PayPal Manager and select Customize. Set the Transaction Process Mode field to TEST or LIVE, depending on the required mode.

  13. Once Payflow Status is Live, you may wish to run some additional Test transactions

    • Just leave the Test Endpoint checkbox in the gateway checked
    • Use the Test Credit Card Numbers and records in Step 6 above

  14. If your test transactions in both Test and Live Status were successful, you are ready to run Live transactions with PayPal's Payflow Pro and Salesforce.

    • Uncheck the Test Endpoint checkbox in your Salesforce Gateway record
    • Check to make sure the Transaction Process Mode in the PayPal Manager is set to LIVE
    • You can now run live transactions using valid credit card numbers

      • If you wish to test some live transactions with your own credit card, you can void them immediately after, to prevent the transactions from settling. Just go to the transaction record in Salesforce and click the Void button.
      • If you do run live transactions as a test, it is recommended to make them very low amounts to minimize any impact, in the event you forget to void them.
      • For Visa live transaction tests, you can submit $0.00 transactions

    Voiding a Transaction from PayPal Payflow Pro in Salesforce


    Tokenization with PayPal's Payflow Pro gateway operates differently than other payment gateway integrations in Chargent. This is because Payflow expires certain types of tokens (reference transactions) in 12 months.

    PayPal Payflow Pro requires you to have the Recurring Billing service enabled on their side in order to have tokenization enabled in Chargent.

    Chargent creates two kinds of tokens with PayPal, to ensure that future transactions can work without any issues around expiration.

    Chargent Token field = PayPal Reference Transaction
    Chargent Customer Token field = PayPal Recurring Profile ID

    New in Chargent 5.40 is the "PayFlow Use Recurring Profiles" setting on the Gateway record. If this field is checked, both Reference Transactions and Recurring Profiles will be created and used by Chargent for different situations.

    If enabled, Chargent establishes a Recurring Profile with PayPal and stores it in the Customer Token field, using it for any future transactions. Recurring charges will still be handled by Chargent. The Recurring Profile is simply used to create a perpetual token, not to make any recurring charges.

    Authorizations and Charge Authorized calls will use the Reference Transaction, stored in the Token field, since these transaction types are not supported by PayPal's Recurring Profiles. Charge transactions will use the Recurring Profile, unless this setting is disabled, in which case it will use the Reference Transaction. Note that Reference Transactions expire in 12 months, so the use of Recurring Profiles should be enabled for annual billing.

  15. To set up reference transactions / Tokenization in Salesforce:

    • Reference Transactions are disabled by default. Go to Account Administration > Transaction Settings to enable them
    • Check the Use Tokenization checkbox in the Chargent Gateway record you have set up for Payflow Pro
    • Check the PayFlow Use Recurring Profiles checkbox in the Chargent Gateway record if you wish to use tokens longer than 12 months

    • Set the Credit Card Handling field (unless you are using Payment Console)
      • 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 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 value will be deleted, and a token will be stored for future transactions (or if you are using Chargent's Payment Console feature, the card number was never stored during the generation of the token)

    • After a successful transaction, the Reference Transaction will be stored in the Token field
    • PayPal's Profile ID will be stored in the Customer Token field

    Enabling Reference Transactions in PayPal Payflow Pro

  16. Notes on Payflow Reference Transactions from Salesforce

    • The token returned in the original transaction is valid for use in reference transactions for 12 months.
    • Charge and authorization transactions can use a reference transaction as a source of transaction data. Payflow looks up the reference transaction and copies its transaction data into the new sale (charge) or authorization.
    • Fraud Protection Service filters do not screen reference transactions.
    • The Billing Name and Address, and Card Expiration Date are copied from the reference transaction into the new charge or authorization transaction (if they exist in the original transaction). If you provide a value for any of these parameters when submitting the new transaction, then the new value is used.
    • Reference transactions can be used for recurring billing, or to capture additional funds as part of a transaction (for example, capturing an upgrade charge that comes after an initial transaction).

    Salesforce to PayPal Field Mapping

    Here are a few relevant fields and their mappings between the Chargent software in Salesforce and the PayPal Payflow Pro system.

    Salesforce Direction PayPal
    Gateway ID < Transaction ID
    Authorization < Authorization Code
    Invoice Number > Supplier Reference #
    Description > Comment 1
    Salesforce record ID (of Chargent Order, Opportunity, or Case) > Customer Code

  17. Congratulations! You have successfully integrated Salesforce and PayPal Payflow Pro, using the Chargent Payment Processing for Salesforce software. You can now process one-time or recurring credit card payments through PayPal Payflow Pro directly from Salesforce.
    If you have any questions or need assistance, please contact us.