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
Copy file name to clipboardExpand all lines: README.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,19 @@
1
1
#CyberSource PHP Client
2
2
3
-
This is the PHP client for the CyberSource SOAP Toolkit API.
3
+
This is the PHP client for the [CyberSource SOAP Toolkit API](http://www.cybersource.com/developers/getting_started/integration_methods/soap_toolkit_api).
4
4
5
5
6
6
##Prerequisites
7
7
8
8
- PHP 5.3 or above
9
9
-[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
10
-
- A CyberSource merchant ID and transaction key. You will need to set these in the cybs.ini file in ````lib/conf````.
10
+
- A CyberSource account. You can create an evaluation account [here](http://www.cybersource.com/register/).
11
+
- 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/).
11
12
12
13
13
14
##Installation
14
15
15
-
You can install the client either via [Composer](https://getcomposer.org/) or manually.
16
+
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 WSDL file URL in ````cybs.ini````. By default, the WSDL file for the client is for API version 1.109.
16
17
17
18
###Installing with Composer
18
19
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:
The PHP client will generate the request message headers for you, and will contain the methods specified by the WSDL file. 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/) 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.
39
+
40
+
```php
41
+
$client = new CybsSoapClient();
42
+
$request = $client->createRequest();
43
+
44
+
$card = new stdClass();
45
+
$card->accountNumber = '4111111111111111';
46
+
$card->expirationMonth = '12';
47
+
$card->expirationYear = '2020';
48
+
$request->card = $card;
49
+
50
+
// Populate $request here with other necessary properties
51
+
52
+
$reply = $client->runTransaction($request);
53
+
```
54
+
36
55
##Running the Samples
37
-
The samples in the ````samples```` directory can be run from the project root. For example:
56
+
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:
38
57
39
58
```
40
59
php samples/Sale.php
41
60
```
42
61
62
+
The samples will output the response object for each request if successful.
63
+
43
64
##Tests
44
65
45
66
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
0 commit comments