PHPackages                             cybersource/sdk-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. cybersource/sdk-php

ActiveLibrary[API Development](/categories/api)

cybersource/sdk-php
===================

CyberSource PHP SOAP client

1.0.4(1y ago)592.4M↓14.2%59[18 issues](https://github.com/CyberSource/cybersource-sdk-php/issues)[1 PRs](https://github.com/CyberSource/cybersource-sdk-php/pulls)1proprietaryPHPPHP &gt;=7.3CI passing

Since Dec 30Pushed 1y ago22 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (6)Used By (1)

CyberSource PHP Client
======================

[](#cybersource-php-client)

This is the PHP client for the [CyberSource Simple Order API](https://www.cybersource.com/en-us/support/technical-documentation/apis-and-integration.html#simple).

Important Notice
----------------

[](#important-notice)

From version 1.0.4, the CyberSource PHP SDK has completely shifted to P12 authentication.

You can upgrade to P12 Authentication in your application by doing the following:

- Create a P12 certificate.
- Update the files in your project directory.
- Add your certificate information to your code.

You must upgrade the SOAP Authentication to use P12 by February 13, 2025.

### Prerequisites

[](#prerequisites)

You must create a P12 certificate. See the [REST Getting Started Developer Guide](https://developer.cybersource.com/docs/cybs/en-us/platform/developer/all/rest/rest-getting-started/restgs-jwt-message-intro/restgs-security-p12-intro.html).

> > **IMPORTANT : This P12 certificate is considered as a sensitive data. It is advised to store this in a secure manner. If the certificate is compromised, immediately revoke the certificate from EBC and request a new certificate.**

Packagist
---------

[](#packagist)

The cybersource/sdk-php is available at [Packagist](https://packagist.org/packages/cybersource/sdk-php).

If you want to install SDK from Packagist,add the following dependency to your application's `composer.json`.

```
"require": {
  "cybersource/sdk-php": "*"
},
```

Prerequisites
-------------

[](#prerequisites-1)

- PHP 7.3 or above

    - [curl](http://php.net/manual/en/book.curl.php), [openssl](http://php.net/manual/en/book.openssl.php), [soap](http://php.net/manual/en/book.soap.php) extensions must be enabled
- A CyberSource account. You can create an evaluation account [here](http://www.cybersource.com/register/).
- A P12 certificate. Instructions on obtaining a P12 certificate can be found [here](https://developer.cybersource.com/docs/cybs/en-us/platform/developer/all/rest/rest-getting-started/restgs-jwt-message-intro/restgs-security-p12-intro.html).

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

[](#installation)

You can install the client either via [Composer](https://getcomposer.org/) or manually.

Before installing, make sure that the following data is present in the `cybs.ini` file:

```
merchant_id     = "YOUR_MERCHANT_ID"

; Modify the URL to point to either a live or test WSDL file with the desired API version.
wsdl            = "https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.219.wsdl"

; Modify the URL to point to either a live or test WSDL file with the desired API version for the name-value pairs transaction API.
nvp_wsdl        = "https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_NVP_1.219.wsdl"

[SSL]
KEY_ALIAS       = 'YOUR_KEY_ALIAS'
KEY_FILE        = 'YOUR_CERTIFICATE_FILE'
KEY_PASS        = 'YOUR_KEY_PASS'
KEY_DIRECTORY   = 'PATH_TO_CERTIFICATE'

```

By default, the WSDL file for the client is for API version **1.219**. Available WSDL file URLs can be browsed at the following locations:

- [Test Endpoints](https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/)
- [Live Endpoints](https://ics2ws.ic3.com/commerce/1.x/transactionProcessor/)

### Installing with Composer

[](#installing-with-composer)

You'll first need to make sure you have Composer installed. You can follow the instructions on the [official website](https://getcomposer.org/download/).

Once Composer is installed, you can enter the project root and run:

- On Windows:

    ```
    composer install
    ```
- On Linux:

    ```
    composer.phar install
    ```

If you already have composer installed for the project, you'll need to run the `update` command as below:

- On Windows:

    ```
    composer update
    ```
- On Linux:

    ```
    composer.phar update
    ```

Then, to use the client, you'll need to include the Composer-generated autoload file:

```
require_once('/path/to/project/vendor/autoload.php');
```

### Manual installation

[](#manual-installation)

To use the client manually, include the CyberSource client in your project:

```
require_once('//lib/CybsSoapClient.php');
```

Getting Started
---------------

[](#getting-started)

The PHP client will generate the request message headers for you, and will contain the methods specified by the WSDL file.

### Creating a simple request

[](#creating-a-simple-request)

The main method you'll use is `runTransaction()`.

To run a transaction, you'll first need to construct a client to generate a request object, which you can populate with the necessary fields (see [documentation](http://www.cybersource.com/developers/integration_methods/simple_order_and_soap_toolkit_api/soap_api/html/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Intro.04.4.html) for sample requests).

The object will be converted into XML, so the properties of the object will need to correspond to the correct XML format.

```
$client = new CybsSoapClient();
$request = $client->createRequest();

$card = new stdClass();
$card->accountNumber = '4111111111111111';
$card->expirationMonth = '12';
$card->expirationYear = '2035';
$request->card = $card;

// Populate $request here with other necessary properties
$reply = $client->runTransaction($request);
```

### Creating a request from XML

[](#creating-a-request-from-xml)

You can also create a request from XML either in a file or from an XML string. The XML request format is described in the **Using XML** section [here](http://apps.cybersource.com/library/documentation/dev_guides/Simple_Order_API_Clients/Client_SDK_SO_API.pdf).

Here's how to run a transaction from an XML file:

```
$referenceCode = 'your_merchant_reference_code';
$client = new CybsSoapClient();
$reply = $client->runTransactionFromFile('path/to/file.xml', $referenceCode);
```

Or, you can create your own XML string and use that instead:

```
$xml = "";
// Populate $xml
$client = new CybsSoapClient();
$client->runTransactionFromXml($xml);
```

### Using name-value pairs

[](#using-name-value-pairs)

In order to run transactions using name-value pairs, make sure to set the value for the WSDL for the NVP transaction processor in `cybs.ini`.

Then use the `CybsNameValuePairClient` as follows:

```
$client = new CybsNameValuePairClient();
$request = array();
$request['ccAuthService_run'] = 'true';
$request['merchantID'] = 'my_merchant_id';
$request['merchantReferenceCode'] = $'my_reference_code';

// Populate $request
$reply = $client->runTransaction($request);
```

Running the Samples
-------------------

[](#running-the-samples)

After configuring your merchant ID and transaction key in `cybs.ini`, the samples in the `samples` directory can be run from the project root.

For example:

```
php samples/Sale.php
```

The samples will output the response object for each request if successful.

> > **Note that the samples contain test data and should *NOT* be run in a live environment.**

Meta Key support
----------------

[](#meta-key-support)

Meta Key is a key generated by an entity that can be used to authenticate on behalf of other entities provided that the entity which holds the key is a parent entity or associated as a partner.

SOAP PHP SDK supports meta key by default.

### Additional detail regarding `cybs.ini` changes.

[](#additional-detail-regarding-cybsini-changes)

```
merchant_id =

[SSL]
KEY_ALIAS       = 'KEY_ALIAS_GENERATED_FOR_CERTIFICATE'
KEY_FILE        = 'CERTIFICATE_FILE_GENERATED_FOR_CERTIFICATE'
KEY_PASS        = 'KEY_PASS_GENERATED_FOR_CERTIFICATE'
KEY_DIRECTORY   = 'PATH_TO_CERTIFICATE_GENERATED_FOR_METAKEY'

```

Note that the transacting merchant ID needs to be sent in the sample request.

Tests
-----

[](#tests)

In order to run tests, you'll need [PHPUnit](https://phpunit.de).

You'll also need to use [Composer](https://getcomposer.org/) for autoloading.

If you used Composer to install the client, this should already be set up.

Otherwise, to use Composer for autoloading only, from the project root run:

- On Windows:

    ```
    composer dump-autoload
    ```
- On Linux:

    ```
    composer.phar dump-autoload
    ```

If you installed PHPUnit with Composer, run the tests from the project root with the command `vendor/bin/phpunit`.

Documentation
-------------

[](#documentation)

For more information about CyberSource services, see

For all other support needs, see

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity57

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~910 days

Total

5

Last Release

518d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3

1.0.3PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![djvaldez](https://avatars.githubusercontent.com/u/1976701?v=4)](https://github.com/djvaldez "djvaldez (29 commits)")[![gnongsie](https://avatars.githubusercontent.com/u/14273863?v=4)](https://github.com/gnongsie "gnongsie (12 commits)")[![brianmc](https://avatars.githubusercontent.com/u/1022976?v=4)](https://github.com/brianmc "brianmc (10 commits)")[![senagant](https://avatars.githubusercontent.com/u/9449919?v=4)](https://github.com/senagant "senagant (3 commits)")[![gauravmokhasi](https://avatars.githubusercontent.com/u/4758435?v=4)](https://github.com/gauravmokhasi "gauravmokhasi (1 commits)")[![dhimandeepak](https://avatars.githubusercontent.com/u/3957626?v=4)](https://github.com/dhimandeepak "dhimandeepak (1 commits)")[![amie-gao](https://avatars.githubusercontent.com/u/16122393?v=4)](https://github.com/amie-gao "amie-gao (1 commits)")[![mahendya1002](https://avatars.githubusercontent.com/u/29275154?v=4)](https://github.com/mahendya1002 "mahendya1002 (1 commits)")

---

Tags

cybersourcemerchantspaymentpayment-gatewaypayment-integrationpayment-methodspayment-modulepayment-processingpayment-requestpayment-servicepaymentsphpphp-clientsdk-phpsoap-apivisaapipaymentscybersource

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cybersource-sdk-php/health.svg)

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

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[openbuildings/paypal

PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.

31176.0k](/packages/openbuildings-paypal)[samerior/mobile-money

Mobile payments API - Kenya

252.3k](/packages/samerior-mobile-money)

PHPackages © 2026

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