SALT Client Libraries

SALT provides client libraries in several programming languages that you can use to connect to the SALT Payment Gateway.

You'll need a SALT account to use our client libraries. You can create a free Sandbox account by following the link below!

Create a SALT Sandbox Account

Java Client Library

Download and Build

  1. Clone our Git Repository or download the source as a zip file.
  2. Build JAR File:
    • Maven:
      1. On the command line, execute: mvn install
    • Intellij:
      1. Open a new project in Intellij by opening pom.xml.
      2. Open the maven tab (located at the left side).
      3. Run the lifecycle named "clean" followed by the lifecycle named "install".
    • Eclipse:
      1. Run the project as "Maven clean"
      2. Run the project as "Maven install"

The built JAR file can be found in the target/ folder of the project.

Examples

The Java source comes with several working code examples. To run the examples:

  1. Set your apiToken and merchantId in the project configuration.
    1. Open merchant.properties located at salt-payment-client-java\src\main\resources\merchant.properties
    2. Replace the values of merchant.Id and merchant.apiToken with your credentials.
  2. Run the Examples:
    • Maven:
      1. To run an example single purchase execute: mvn install -Psingle-purchase
      2. To run an example secure storage execute: mvn install -Psecure-storage
      3. To run an example recurring purchase execute: mvn install -Precurring-purchase

.NET Client Library

  • Coming Soon

PHP Client Library

Dependencies

SALT's PHP library requires PHP version 5.3.0 or higher.

Download & Install

Clone our Git Repository or download the source as a zip file.

Usage

To use this library, include the SALT.php file and start using the library.

//Include the salt library
include 'path/to/SALT/lib/SALT.php';

//Include the classes you want to use from the SALT namespace.
use \SALT\Merchant;
use \SALT\HttpsCreditCardService;

...

//Initialize the SALT library (HttpsCreditCardService is the key class here)
$url = 'https://test.saltpayments.com/gateway/creditcard/processor.do';
$merchant = new Merchant ('Merchant ID', 'API Key');
$service = new HttpsCreditCardService($merchant, $url);
...

// Perform charges, refunds, etc. See Client Library API for info.

Exceptions & Error Handling

Any transaction errors, validation errors, connection errors, or other types of errors will cause a \SALT\SaltError (Exception). Make sure to catch these exceptions and handle them appropriately.

Testing

To run the tests, you'll need PHPUnit. Run the following on your command line from the root directory of this project:

phpunit --bootstrap lib/Salt.php tests/

Ruby Client Library

  1. Clone our Git Repository or download the source as a zip file.
  2. Include the library in your code. E.g. require('lib/HttpsCreditCardService.php')