Skip to content

Commit 465a084

Browse files
committed
Modified Sample name and client library version
1 parent 0d3bbc3 commit 465a084

2 files changed

Lines changed: 80 additions & 1 deletion

File tree

lib/CybsSoapClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function createRequest($merchantReferenceCode)
115115
$request = new stdClass();
116116
$request->merchantID = $this->merchantId;
117117
$request->merchantReferenceCode = $merchantReferenceCode;
118-
$request->clientLibrary = "CyberSource PHP 2.0.0";
118+
$request->clientLibrary = "CyberSource PHP 1.0.0";
119119
$request->clientLibraryVersion = phpversion();
120120
$request->clientEnvironment = php_uname();
121121
return $request;

samples/AuthFollowOnCapture.php

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
// This sample demonstrates how to run an authorization request followed by a
3+
// capture request.
4+
5+
// Using Composer-generated autoload file.
6+
require __DIR__ . '/../vendor/autoload.php';
7+
// Or, uncomment the line below if you're not using Composer autoloader.
8+
// require_once(__DIR__ . '/../lib/CybsSoapClient.php');
9+
10+
11+
// Before using this example, you can use your own reference code for the transaction.
12+
$referenceCode = 'your_merchant_reference_code';
13+
14+
$client = new CybsSoapClient();
15+
$request = $client->createRequest($referenceCode);
16+
17+
// This section contains a sample transaction request for the authorization
18+
// service with complete billing, payment card, and purchase (two items) information.
19+
$ccAuthService = new stdClass();
20+
$ccAuthService->run = 'true';
21+
$request->ccAuthService = $ccAuthService;
22+
23+
$billTo = new stdClass();
24+
$billTo->firstName = 'John';
25+
$billTo->lastName = 'Doe';
26+
$billTo->street1 = '1295 Charleston Road';
27+
$billTo->city = 'Mountain View';
28+
$billTo->state = 'CA';
29+
$billTo->postalCode = '94043';
30+
$billTo->country = 'US';
31+
$billTo->email = 'null@cybersource.com';
32+
$billTo->ipAddress = '10.7.111.111';
33+
$request->billTo = $billTo;
34+
35+
$card = new stdClass();
36+
$card->accountNumber = '4111111111111111';
37+
$card->expirationMonth = '12';
38+
$card->expirationYear = '2020';
39+
$request->card = $card;
40+
41+
$purchaseTotals = new stdClass();
42+
$purchaseTotals->currency = 'USD';
43+
$request->purchaseTotals = $purchaseTotals;
44+
45+
$item0 = new stdClass();
46+
$item0->unitPrice = '12.34';
47+
$item0->quantity = '2';
48+
$item0->id = '0';
49+
50+
$item1 = new stdClass();
51+
$item1->unitPrice = '56.78';
52+
$item1->id = '1';
53+
54+
$request->item = array($item0, $item1);
55+
56+
$reply = $client->runTransaction($request);
57+
58+
// This section will show all the reply fields.
59+
print("\nAUTH RESPONSE: " . print_r($reply, true));
60+
61+
if ($reply->decision != 'ACCEPT') {
62+
print("\nFailed auth request.\n");
63+
return;
64+
}
65+
66+
// Build a capture using the request ID in the response as the auth request ID
67+
$ccCaptureService = new stdClass();
68+
$ccCaptureService->run = 'true';
69+
$ccCaptureService->authRequestID = $reply->requestID;
70+
71+
$captureRequest = $client->createRequest($referenceCode);
72+
$captureRequest->ccCaptureService = $ccCaptureService;
73+
$captureRequest->item = array($item0, $item1);
74+
$captureRequest->purchaseTotals = $purchaseTotals;
75+
76+
$captureReply = $client->runTransaction($captureRequest);
77+
78+
// This section will show all the reply fields.
79+
print("\nCAPTRUE RESPONSE: " . print_r($captureReply, true));

0 commit comments

Comments
 (0)