SDKs overview

Veriphone provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its phone number validation API. These SDKs abstract the direct HTTP request and response handling, allowing developers to integrate phone number validation capabilities into their applications with less boilerplate code. The official SDKs support several widely used programming languages, ensuring broad compatibility for development teams. In addition to official offerings, community-driven libraries may also emerge, extending support or providing custom functionalities based on the Veriphone API.

The primary function of these SDKs is to simplify the process of sending phone numbers to the Veriphone API endpoint and parsing the JSON responses, which contain validation results such as validity status, line type, carrier, and country information. This approach streamlines development, enabling faster implementation of features like user input validation, fraud detection, and data hygiene processes within various applications and services.

For detailed API specifications and comprehensive usage instructions, developers should consult the Veriphone API documentation, which includes specific examples and parameters for all supported operations. Understanding the underlying RESTful API principles can further aid in utilizing the SDKs effectively.

Official SDKs by language

Veriphone offers official SDKs for a selection of popular programming languages, providing tested and maintained client libraries to integrate its phone number validation service. These libraries are typically distributed through standard package managers specific to each language, simplifying dependency management and installation. Each SDK is designed to reflect the API's functionality, offering methods to perform validation requests and receive structured responses.

The following table outlines the officially supported SDKs, their typical package names, and common installation commands:

Language Package Name (Typical) Install Command (Typical) Maturity
Python veriphone-python pip install veriphone-python Stable
PHP veriphone/php-sdk composer require veriphone/php-sdk Stable
Node.js veriphone-node npm install veriphone-node Stable
Ruby veriphone-ruby gem install veriphone-ruby Stable
Go github.com/veriphone/go-sdk go get github.com/veriphone/go-sdk Stable
Java com.veriphone:java-sdk (Maven/Gradle dependency) Stable

For the most current package names, installation instructions, and specific versioning, always refer to the official Veriphone documentation portal.

Installation

Installation of Veriphone SDKs is typically straightforward, leveraging each language's native package management system. Below are example installation commands for the primary supported languages. Ensure you have the respective language runtime and package manager installed on your system before proceeding.

Python

The Python SDK can be installed using pip, the standard package installer for Python:

pip install veriphone-python

After installation, you can import the library into your Python projects to begin making API calls.

PHP

For PHP projects, the Veriphone SDK is typically installed via Composer, the dependency manager for PHP:

composer require veriphone/php-sdk

This command adds the SDK to your project's composer.json file and installs it into your vendor/ directory. You will then use Composer's autoloader to load the library.

Node.js

The Node.js SDK is available through npm, the package manager for JavaScript:

npm install veriphone-node

This command will add the veriphone-node package to your node_modules directory and update your package.json file. You can then require it in your JavaScript or TypeScript files.

Ruby

Ruby developers can install the Veriphone SDK using RubyGems, Ruby's package manager:

gem install veriphone-ruby

Once installed, you can require the gem in your Ruby scripts or applications.

Go

For Go projects, the SDK can be fetched using the go get command:

go get github.com/veriphone/go-sdk

This command downloads the package into your module cache, making it available for import in your Go source files.

Java

Java SDKs are commonly managed with build automation tools like Maven or Gradle. Below are example dependency configurations:

Maven

<dependency>
    <groupId>com.veriphone</groupId>
    <artifactId>java-sdk</artifactId>
    <version>1.0.0</version> <!-- Check for latest version -->
</dependency>

Gradle

implementation 'com.veriphone:java-sdk:1.0.0' <!-- Check for latest version -->

Always verify the latest version numbers directly from the Veriphone documentation or repository.

Quickstart example

This section provides a basic quickstart example using the Python SDK to demonstrate how to validate a phone number. This example assumes you have your Veriphone API key available and the Python SDK installed.

Python Quickstart

First, ensure you have an API key from Veriphone, which can be obtained by signing up on their homepage. Replace YOUR_API_KEY with your actual key and +12125550100 with the phone number you wish to validate.


import veriphone

# Initialize Veriphone client with your API key
api_key = "YOUR_API_KEY"
client = veriphone.Client(api_key)

# The phone number to validate
phone_number = "+12125550100"

try:
    # Make the validation request
    response = client.validate_phone_number(phone_number)

    # Print validation results
    print(f"Phone Number: {response.phone_number}")
    print(f"Valid: {response.valid}")
    print(f"Country Code: {response.country_code}")
    print(f"Country Name: {response.country_name}")
    print(f"Carrier: {response.carrier}")
    print(f"Line type: {response.line_type}")
    print(f"International format: {response.international_format}")
    print(f"Local format: {response.local_format}")

except veriphone.VeriphoneException as e:
    print(f"Error validating phone number: {e}")

This snippet demonstrates basic API client initialization, a validation call, and structured access to the response data. The VeriphoneException class handles potential errors during the API call, such as invalid API keys or rate limit issues.

Similar quickstart guides for other languages can be found in the Veriphone API documentation, detailing language-specific syntax and error handling patterns.

Community libraries

While Veriphone provides official SDKs, the open-source nature of many development ecosystems often leads to the creation of community-contributed libraries and wrappers. These might offer alternative language support, specific framework integrations, or specialized functionalities not present in the official SDKs. Community libraries can be found on platforms like GitHub, GitLab, or language-specific package repositories.

Developers considering community libraries should evaluate them based on several factors:

  • Maintenance Status: Is the library actively maintained and compatible with the latest Veriphone API versions?
  • Documentation: Is there clear and sufficient documentation for installation, usage, and examples?
  • Community Support: Is there an active community that can provide assistance or contribute improvements?
  • Security: Has the library been audited or reviewed for security vulnerabilities, especially when handling sensitive data like API keys?
  • Licensing: Does the library's license align with your project's requirements?

Although community libraries can provide valuable alternatives or extensions, the official Veriphone SDKs are generally recommended for their direct support from Veriphone and guaranteed compatibility with the API. For projects requiring specific customizations or integrations, exploring community solutions may be beneficial after careful review. Developers utilizing third-party libraries should also be aware of the HTTP status codes that the Veriphone API returns, as these can provide insights into potential issues regardless of the SDK used.