Skip to main content

Authentication

Prerequisites​

Before we start, you need to have the following prerequisites:

  1. Salesforce Enterprise or Performance / Unlimited Edition
  2. Merchant account with one of our partner gateways
  3. Chargent installation and API and Payment Methods features enabled
  4. Salesforce Connected App to access the Chargent REST API
  5. Basic knowledge of REST, JSON, and web development, and of node.js and the JSForce library
  6. Development and test environments

Steps​

Install Chargent​

Learn more about Chargent Installation and Setup.

Configure a Salesforce Connected App​

Learm more about Salesforce Connected Apps.

Set up the environment​

Create a node.js project and install the necessary dependencies using a package manager. Make sure you have access to the Salesforce Connected App authentication credentials, and the authentication credentials for the Payment Gateway.

Any development environment may be used. Chargent postman collections are coming soon.

Authenticate with Salesforce​

To use the Chargent REST API, you need to use your client to authenticate with Salesforce. One available option, and the one used for some examples in this guide, is the JSforce JavaScript library to authenticate with Salesforce by passing the API credentials.

JSON Example
var jsforce = require('jsforce');
var conn = new jsforce.Connection({
loginUrl: 'https://login.salesforce.com'
});
conn.login(username, password, function(err, userInfo) {
if (err) { return console.error(err); }
console.log('Authenticated with Salesforce');
});