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).
20
+
21
+
> > **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.**
5
22
6
23
## Packagist
24
+
7
25
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'.
26
+
27
+
If you want to install SDK from Packagist,add the following dependency to your application's `composer.json`.
28
+
9
29
```json
10
30
"require": {
11
31
"cybersource/sdk-php": "*"
12
-
},
32
+
},
13
33
```
34
+
14
35
## Prerequisites
15
36
16
37
- PHP 7.3 or above
38
+
17
39
-[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
40
+
18
41
- 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).
42
+
43
+
- 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
44
21
45
## 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
48
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
49
+
Before installing, make sure that the following data is present in the `cybs.ini` file:
50
+
51
+
```text
52
+
merchant_id = "YOUR_MERCHANT_ID"
53
+
54
+
; 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/).
75
+
76
+
Once Composer is installed, you can enter the project root and run:
77
+
78
+
- On Windows:
79
+
```cmd
80
+
composer install
81
+
```
82
+
83
+
- On Linux:
84
+
```bash
85
+
composer.phar install
86
+
```
87
+
88
+
If you already have composer installed for the project, you'll need to run the `update` command as below:
89
+
90
+
- On Windows:
91
+
```cmd
92
+
composer update
93
+
```
94
+
95
+
- On Linux:
96
+
```bash
97
+
composer.phar update
98
+
```
99
+
39
100
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
117
55
118
### 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.
119
+
120
+
The main method you'll use is `runTransaction()`.
121
+
122
+
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).
123
+
124
+
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
137
$reply = $client->runTransaction($request);
71
138
```
72
139
73
140
### 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:
141
+
142
+
You can also create a request from XML either in a file or from an XML string.
143
+
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:
163
+
164
+
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`.
165
+
166
+
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
180
107
-
```
181
+
After configuring your merchant ID and transaction key in `cybs.ini`, the samples in the `samples` directory can be run from the project root.
182
+
183
+
For example:
184
+
185
+
```bash
108
186
php samples/Sale.php
109
187
```
110
188
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.
189
+
The samples will output the response object for each request if successful.
190
+
191
+
> > **Note that the samples contain test data and should *NOT* be run in a live environment.**
112
192
113
193
## 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
194
116
-
SOAP PHP SDK supports meta key by default. Additional detail regarding cybs.ini changes.
195
+
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
196
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
201
+
```text
202
+
merchant_id = <Refers to portfolio or account MID>
0 commit comments