This repository has been archived by the owner on Oct 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
218 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php include("header.php"); ?> | ||
<h1>PHP Library Cancel Authorised Order Example</h1> | ||
<form method="post" action="cancel_authorised_order.php" id="cancel-authorised-order-form"> | ||
<div class="payment-errors"></div> | ||
<div class="form-row"> | ||
<label> | ||
Worldpay Order Code | ||
</label> | ||
<input type="text" id="order-code" name="orderCode" value="" /> | ||
</div> | ||
<input type="submit" id="cancel-order" value="Cancel Authorised Order" /> | ||
</form> | ||
|
||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
<?php | ||
/** | ||
* PHP library version: | ||
*/ | ||
require_once('../lib/worldpay.php'); | ||
|
||
// Initialise Worldpay class with your SERVICE KEY | ||
$worldpay = new Worldpay("your-service-key"); | ||
|
||
// Sometimes your SSL doesnt validate locally | ||
// DONT USE IN PRODUCTION | ||
$worldpay->disableSSLCheck(true); | ||
|
||
$worldpayOrderCode = $_POST['orderCode']; | ||
|
||
include("header.php"); | ||
|
||
// Try catch | ||
try { | ||
// Cancel the authorised order using the Worldpay order code | ||
$worldpay->cancelAuthorisedOrder($worldpayOrderCode); | ||
echo 'Authorised order <span id="order-code">'.$worldpayOrderCode.'</span> | ||
has been cancelled'; | ||
} catch (WorldpayException $e) { // PHP 5.3+ | ||
// Worldpay has thrown an exception | ||
echo 'Error code: ' . $e->getCustomCode() . '<br/> | ||
HTTP status code:' . $e->getHttpStatusCode() . '<br/> | ||
Error description: ' . $e->getDescription() . ' <br/> | ||
Error message: ' . $e->getMessage(); | ||
} catch (Exception $e) { // PHP 5.2 | ||
echo 'Error message: '. $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php include("header.php"); ?> | ||
<h1>PHP Library Capture Authorised Order Example</h1> | ||
<form method="post" action="capture_authorised_order.php" id="capture-authorised-order-form"> | ||
<div class="payment-errors"></div> | ||
<div class="form-row"> | ||
<label> | ||
Worldpay Order Code | ||
</label> | ||
<input type="text" id="order-code" name="orderCode" value="" /> | ||
</div> | ||
<div class="form-row"> | ||
<label> | ||
Amount | ||
</label> | ||
<input type="text" id="amount" name="amount" value="" /> | ||
</div> | ||
<input type="submit" id="capture-order" value="Capture Authorised Order" /> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
<?php | ||
/** | ||
* PHP library version: | ||
*/ | ||
require_once('../lib/worldpay.php'); | ||
|
||
// Initialise Worldpay class with your SERVICE KEY | ||
$worldpay = new Worldpay("your-service-key"); | ||
|
||
// Sometimes your SSL doesnt validate locally | ||
// DONT USE IN PRODUCTION | ||
$worldpay->disableSSLCheck(true); | ||
|
||
$worldpayOrderCode = $_POST['orderCode']; | ||
$amount = $_POST['amount']; | ||
|
||
include("header.php"); | ||
|
||
// Try catch | ||
try { | ||
// Capture the authorised order using the Worldpay order code | ||
$worldpay->captureAuthorisedOrder($worldpayOrderCode, $amount*100); | ||
$response = 'Authorised order <span id="order-code">'.$worldpayOrderCode.'</span> has been captured for '; | ||
$response .= (!empty($amount)) ? '<span id="amount">'. $amount .'</span>' : 'the full amount'; | ||
echo $response; | ||
|
||
} catch (WorldpayException $e) { // PHP 5.3+ | ||
// Worldpay has thrown an exception | ||
echo 'Error code: ' . $e->getCustomCode() . '<br/> | ||
HTTP status code:' . $e->getHttpStatusCode() . '<br/> | ||
Error description: ' . $e->getDescription() . ' <br/> | ||
Error message: ' . $e->getMessage(); | ||
} catch (Exception $e) { // PHP 5.2 | ||
echo 'Error message: '. $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Oops, something went wrong.