PHPackages                             centarro/cybersource-rest-client-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. centarro/cybersource-rest-client-php

ActiveLibrary[API Development](/categories/api)

centarro/cybersource-rest-client-php
====================================

CyberSource PHP REST API client with dependency updates for Drupal compatibility (until fixed upstream).

019.4k↓26.7%PHP

Since Nov 9Pushed 2y agoCompare

[ Source](https://github.com/centarro/cybersource-rest-client-php)[ Packagist](https://packagist.org/packages/centarro/cybersource-rest-client-php)[ RSS](/packages/centarro-cybersource-rest-client-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Client SDK for CyberSource REST APIs
========================================

[](#php-client-sdk-for-cybersource-rest-apis)

The CyberSource PHP client provides convenient access to the [CyberSource REST API](https://developer.cybersource.com/api/reference/api-reference.html) from your PHP application.

[![Version         ](https://camo.githubusercontent.com/96b6cef9e655e143a49091197cafc2cff0c55f1858e890330c5dec7a02fba43f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6379626572736f757263652f726573742d636c69656e742d7068702e737667)](https://packagist.org/packages/cybersource/rest-client-php)

Requirements
------------

[](#requirements)

- PHP 8.0.0+
- Enable cURL PHP Extension
- Enable JSON PHP Extension
- Enable OpenSSL PHP Extension
- Enable Zip PHP Extension
- Enable MBString PHP Extension
- Enable PHP\_APCU PHP Extension. You will need to download it for your platform (Windows/Linux/Mac)
- [CyberSource Account](https://developer.cybersource.com/api/developer-guides/dita-gettingstarted/registration.html)
- [CyberSource API Keys](https://prod.developer.cybersource.com/api/developer-guides/dita-gettingstarted/registration/createCertSharedKey.html)

Dependencies
------------

[](#dependencies)

- PHP-JWT : JWT token Generation
- CURL : Http communication with the payment gateway
- PHP\_APCU : Caching
- phpunit-5.7.25 : unit testing
- phpunit-5.7.25 code coverage : Sonar coverage

Installation
------------

[](#installation)

### Composer

[](#composer)

We recommend using [`Composer`](http://getcomposer.org). *(Note: we never recommend you override the new secure-http default setting)*. *Update your composer.json file as per the example below and then run `composer update`.*

```
{
  "require": {
  "php": ">=8.0.0",
  "cybersource/rest-client-php": "0.0.44"
  }
}
```

Registration &amp; Configuration
--------------------------------

[](#registration--configuration)

Use of this SDK and the CyberSource APIs requires having an account on our system. You can find details of getting a test account and creating your keys [here](https://developer.cybersource.com/api/developer-guides/dita-gettingstarted/registration.html)

Once you have your keys, simply load them into the appropriate variables in your code, as per the below sample code dealing with the authentication part of the API request.

Remember this SDK is for use in server-side PHP applications that access the CyberSource REST API and credentials should always be securely stored and accessed appropriately.

SDK Usage Examples and Sample Code
----------------------------------

[](#sdk-usage-examples-and-sample-code)

To get started using this SDK, it's highly recommended to download our sample code repository:

- [Cybersource PHP Sample Code Repository (on GitHub)](https://github.com/CyberSource/cybersource-rest-samples-php)

In that respository, we have comprehensive sample code for all common uses of our API:

Additionally, you can find details and examples of how our API is structured in our API Reference Guide:

- [Developer Center API Reference](https://developer.cybersource.com/api/reference/api-reference.html)

The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

MetaKey Support
---------------

[](#metakey-support)

A Meta Key is a single key that can be used by one, some, or all merchants (or accounts, if created by a Portfolio user) in the portfolio.

The Portfolio or Parent Account owns the key and is considered the transaction submitter when a Meta Key is used, while the merchant owns the transaction.

MIDs continue to be able to create keys for themselves, even if a Meta Key is generated.

Further information on MetaKey can be found in [New Business Center User Guide](https://developer.cybersource.com/library/documentation/dev_guides/Business_Center/New_Business_Center_User_Guide.pdf).

To set your API credentials for an API request, configure the following information in ExternalConfiguration.php file:
----------------------------------------------------------------------------------------------------------------------

[](#to-set-your-api-credentials-for-an-api-request-configure-the-following-information-in-externalconfigurationphp-file)

Create a file in your application `ExternalConfiguration.php` inside a `Resources` folder and configure the following information as per requirement similar to [**this one**](https://github.com/CyberSource/cybersource-rest-samples-php/blob/master/Resources/ExternalConfiguration.php).

#### For Http Signature Authentication

[](#for-http-signature-authentication)

Configure the following information in `ExternalConfiguration.php` file

- Authentication Type: Merchant should enter "HTTP\_SIGNATURE" for HTTP authentication mechanism.
- Merchant ID: Merchant will provide the merchant ID, which has taken from EBC portal.
- MerchantSecretKey: Merchant will provide the secret Key value, which has taken from EBC portal.
- MerchantKeyId: Merchant will provide the Key ID value, which has taken from EBC portal.
- Enable Log: To start the log entry provide *true* else enter *false*.
- LogDirectory: Merchant will provide directory path where logs will be created.
- LogMaximumSize: Merchant will provide size value for log file.
- LogFilename: Merchant will provide log file name.

```
   $this->authType          = "HTTP_SIGNATURE";
   $this->runEnv            = "apitest.cybersource.com";
   $this->merchantID        = ;
   $this->apiKeyID          = ;
   $this->secretKey         = ;

   $this->enableLog         = true;
   $this->logSize           = ;
   $this->logFile           = ;
   $this->logFilename       = ;

   $this->proxyUrl          = ;
   $this->proxyHost         = ;

   $this->useMetaKey        = false;

```

#### For Jwt Signature Authentication

[](#for-jwt-signature-authentication)

Configure the following information in the `ExternalConfiguration.php` file

- Authentication Type: Merchant should enter "JWT" for JWT authentication mechanism.
- Merchant ID: Merchant will provide the merchant ID, which was taken from EBC portal.
- keyAlias: Alias of the Merchant ID, to be used while generating the JWT token.
- keyPassword: Alias of the Merchant password, to be used while generating the JWT token.
- keyFileName: Filename of the key generated from the EBC portal, without the extension part .P12
- keysDirectory: Path of the directory, where key is placed.
- Enable Log: To start the log entry provide *true* else enter *false*.
- LogDirectory: Merchant will provide directory path where logs will be created.
- LogMaximumSize: Merchant will provide size value for log file.
- LogFilename: Merchant will provide log file name.

```
   $this->authType            = "JWT";
   $this->runEnv              = "apitest.cybersource.com";
   $this->merchantID          = ;

   $this->keyAlias            = ;
   $this->keyPass             = ;
   $this->keyFilename         = ";
   $this->keyDirectory        = ;

   $this->enableLog           = true;
   $this->logSize             = ;
   $this->logFile             = ;
   $this->logFilename         = ;

   $this->proxyUrl            = ;
   $this->proxyHost           = ;

   $this->useMetaKey          = false;

```

#### For using MetaKey

[](#for-using-metakey)

MetaKey can be used for HTTP Signature and JWT authentication

For HTTP Signature Authentication

```
   $this->authType            = "HTTP_SIGNATURE";
   $this->merchantID          = ;
   $this->apiKeyID            = ;
   $this->secretKey           = ;
   $this->useMetaKey          = true;
   $this->portfolioID         = ;

```

For JWT Authentication

```
   $this->authenticationType  = "JWT";
   $this->merchantID          = ;
   $this->keyAlias            = ;
   $this->keyPass             = ;
   $this->keyFileName         = ;
   $this->keyDirectory        = ;
   $this->useMetaKey          = true;

```

### Switching between the sandbox environment and the production environment

[](#switching-between-the-sandbox-environment-and-the-production-environment)

CyberSource maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact duplicate of our production environment with the transaction authorization and settlement process simulated. By default, this SDK is configured to communicate with the sandbox environment. To switch to the production environment, set the appropriate property in Resources\\ExternalConfiguration.php.

For example:

```
   // For TESTING use
   // $this->runEnv = "apitest.cybersource.com";
   // For PRODUCTION use
   $this->runEnv = "api.cybersource.com";
```

The [API Reference Guide](https://developer.cybersource.com/api/reference/api-reference.html) provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

### Logging

[](#logging)

[![Generic badge](https://camo.githubusercontent.com/15d85e68c15b1a241e4c43757980ff0de9039b7fdb9b0184f40017a4c9e3574a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c4f4747494e472d4e45572d475245454e2e737667)](https://shields.io/)

Since v0.0.24, a new logging framework has been introduced in the SDK. This new logging framework makes use of Monolog, and standardizes the logging so that it can be integrated with the logging in the client application.

More information about this new logging framework can be found in this file : [Logging.md](Logging.md)

### PHP\_APCU PHP Extension

[](#php_apcu-php-extension)

Enable PHP\_APCU PHP Extension in php.ini file. You will need to download it for your platform (Windows/Linux/Mac) and add in extensions.

Official PHP\_APCU -

For Windows:

1. PHP v8.0: Download the applicable php\_apcu dll version v5.1.19 from the official pecl site.
2. PHP v8.1: Download the applicable php\_acpu dll version v5.1.21 from the official pecl site.
3. PHP v8.2: Download the applicable php\_acpu dll version v5.1.22 from the official pecl site. But dll is missing on the pecl site for php v8.2 Alternativly, you can refer to below stackoverflow link: Or can download the php\_apcu dll from below link:

For Mac/Linux/Unix:

Download the php\_apcu using pecl command: "pecl install apcu". It will auto download the applicable apcu extension for the PHP v8.0, v8.1, v8.2.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9df8398e993229a7e5bf34cca906b73d403cc66e391bb20ee4c10faaebec91a?d=identicon)[rszrama](/maintainers/rszrama)

---

Top Contributors

[![gnongsie](https://avatars.githubusercontent.com/u/14273863?v=4)](https://github.com/gnongsie "gnongsie (132 commits)")[![snavinch](https://avatars.githubusercontent.com/u/49395625?v=4)](https://github.com/snavinch "snavinch (40 commits)")[![rsachan8](https://avatars.githubusercontent.com/u/101696603?v=4)](https://github.com/rsachan8 "rsachan8 (29 commits)")[![gaubansa](https://avatars.githubusercontent.com/u/101095184?v=4)](https://github.com/gaubansa "gaubansa (23 commits)")[![ashtru](https://avatars.githubusercontent.com/u/14973353?v=4)](https://github.com/ashtru "ashtru (18 commits)")[![sachshet](https://avatars.githubusercontent.com/u/117903575?v=4)](https://github.com/sachshet "sachshet (11 commits)")[![kikmak42](https://avatars.githubusercontent.com/u/645401?v=4)](https://github.com/kikmak42 "kikmak42 (8 commits)")[![monu-kumar-visa](https://avatars.githubusercontent.com/u/138751796?v=4)](https://github.com/monu-kumar-visa "monu-kumar-visa (5 commits)")[![brianmc](https://avatars.githubusercontent.com/u/1022976?v=4)](https://github.com/brianmc "brianmc (4 commits)")[![SantoshShanmugam](https://avatars.githubusercontent.com/u/36918753?v=4)](https://github.com/SantoshShanmugam "SantoshShanmugam (3 commits)")[![rszrama](https://avatars.githubusercontent.com/u/17675?v=4)](https://github.com/rszrama "rszrama (1 commits)")[![chsriniv9](https://avatars.githubusercontent.com/u/35677727?v=4)](https://github.com/chsriniv9 "chsriniv9 (1 commits)")[![ssethumavisa](https://avatars.githubusercontent.com/u/45388836?v=4)](https://github.com/ssethumavisa "ssethumavisa (1 commits)")[![khaaldrogo](https://avatars.githubusercontent.com/u/35258595?v=4)](https://github.com/khaaldrogo "khaaldrogo (1 commits)")[![SYip](https://avatars.githubusercontent.com/u/6204506?v=4)](https://github.com/SYip "SYip (1 commits)")[![KatteriSharath](https://avatars.githubusercontent.com/u/147804309?v=4)](https://github.com/KatteriSharath "KatteriSharath (1 commits)")[![KasperFranz](https://avatars.githubusercontent.com/u/191405?v=4)](https://github.com/KasperFranz "KasperFranz (1 commits)")

### Embed Badge

![Health badge](/badges/centarro-cybersource-rest-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/centarro-cybersource-rest-client-php/health.svg)](https://phpackages.com/packages/centarro-cybersource-rest-client-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
