You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the PHP client for the [CyberSource SOAP Toolkit API](http://www.cybersource.com/developers/getting_started/integration_methods/soap_toolkit_api).
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).
4
+
5
+
## Important Notice
6
+
7
+
From version 1.0.4, the CyberSource PHP SDK has completely shifted to P12 authentication.
8
+
9
+
You can upgrade to P12 Authentication in your application by doing the following:
10
+
11
+
- Create a P12 certificate.
12
+
- Update the files in your project directory.
13
+
- Add your certificate information to your code.
14
+
15
+
You must upgrade the SOAP Authentication to use P12 by February 13, 2025.
16
+
17
+
### Prerequisites
18
+
19
+
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).
5
20
6
21
## Packagist
22
+
7
23
The cybersource/sdk-php is available at [Packagist](https://packagist.org/packages/cybersource/sdk-php).
8
-
If you want to install SDK from Packagist,add the following dependency to your application's 'composer.json'.
24
+
25
+
If you want to install SDK from Packagist,add the following dependency to your application's `composer.json`.
26
+
9
27
```json
10
28
"require": {
11
29
"cybersource/sdk-php": "*"
12
-
},
30
+
},
13
31
```
32
+
14
33
## Prerequisites
15
34
16
35
- PHP 7.3 or above
36
+
17
37
-[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
38
+
18
39
- A CyberSource account. You can create an evaluation account [here](http://www.cybersource.com/register/).
19
-
- A CyberSource transaction key. You will need to set your merchant ID and transaction key in the ````cybs.ini```` file in ````lib/conf````. Instructions on obtaining a transaction key can be found [here](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.3.html).
40
+
41
+
- 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).
20
42
21
43
## Installation
22
-
You can install the client either via [Composer](https://getcomposer.org/) or manually. Before installing, make sure to configure the merchant ID, transaction key, and the appropriate WSDL file URL in ````cybs.ini````. By default, the WSDL file for the client is for API version 1.120 (the latest when this package was updated). Available WSDL file URLs can be browsed at the following locations:
You can install the client either via [Composer](https://getcomposer.org/) or manually.
26
46
27
-
### Installing with Composer
28
-
You'll first need to make sure you have Composer installed. You can follow the instructions on the [official web site](https://getcomposer.org/download/). Once Composer is installed, you can enter the project root and run:
29
-
```
30
-
Linux: composer.phar install
31
-
Windows: composer install
32
-
```
33
-
If you already have composer installed for the project, you'll need to run the update command as below
34
-
```
35
-
Linux: composer.phar update
36
-
Windows: composer update
47
+
Before installing, make sure that the following data is present in the `cybs.ini` file:
48
+
49
+
```text
50
+
merchant_id = "YOUR_MERCHANT_ID"
51
+
52
+
; Modify the URL to point to either a live or test WSDL file with the desired API version.
You'll first need to make sure you have Composer installed. You can follow the instructions on the [official website](https://getcomposer.org/download/).
73
+
74
+
Once Composer is installed, you can enter the project root and run:
75
+
76
+
- On Windows:
77
+
```cmd
78
+
composer install
79
+
```
80
+
81
+
- On Linux:
82
+
```bash
83
+
composer.phar install
84
+
```
85
+
86
+
If you already have composer installed for the project, you'll need to run the `update` command as below:
87
+
88
+
- On Windows:
89
+
```cmd
90
+
composer update
91
+
```
92
+
93
+
- On Linux:
94
+
```bash
95
+
composer.phar update
96
+
```
97
+
39
98
Then, to use the client, you'll need to include the Composer-generated autoload file:
The PHP client will generate the request message headers for you, and will contain the methods specified by the WSDL file.
54
115
55
116
### Creating a simple request
56
-
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.
117
+
118
+
The main method you'll use is `runTransaction()`.
119
+
120
+
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).
121
+
122
+
The object will be converted into XML, so the properties of the object will need to correspond to the correct XML format.
// Populate $request here with other necessary properties
69
-
70
135
$reply = $client->runTransaction($request);
71
136
```
72
137
73
138
### Creating a request from XML
74
-
You can 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:
139
+
140
+
You can also create a request from XML either in a file or from an XML string.
141
+
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).
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 so:
161
+
162
+
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`.
163
+
164
+
Then use the `CybsNameValuePairClient` as follows:
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:
106
178
107
-
```
179
+
After configuring your merchant ID and transaction key in `cybs.ini`, the samples in the `samples` directory can be run from the project root.
180
+
181
+
For example:
182
+
183
+
```bash
108
184
php samples/Sale.php
109
185
```
110
186
111
-
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.
187
+
The samples will output the response object for each request if successful.
188
+
189
+
> > **Note that the samples contain test data and should *NOT* be run in a live environment.**
112
190
113
191
## Meta Key support
114
-
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 key is a parent entity or associated as a partner.
115
192
116
-
SOAP PHP SDK supports meta key by default. Additional detail regarding cybs.ini changes.
193
+
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.
117
194
118
-
merchantID=\<Refers to portfolio or account MID> <br>
119
-
transaction_key=\<Soap password generated for meta key><br>
120
-
Send transacting merchantID in the sample request.
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
125
-
```
126
-
composer.phar dump-autoload
199
+
```text
200
+
merchant_id = <Refers to portfolio or account MID>
0 commit comments