Updating sample comments

This commit is contained in:
aydiv
2013-08-26 12:21:29 +05:30
parent b1f1887cec
commit 05a4aef55e
18 changed files with 180 additions and 121 deletions

View File

@@ -1,6 +1,7 @@
<?php
// # GetCapture
// This sample code demonstrate how you can get the details of Captured Payment
// This sample code demonstrates how you can lookup the details
// of a captured payment.
// API used: /v1/payments/capture/<$captureId>
require __DIR__ . '/../bootstrap.php';
@@ -12,22 +13,25 @@ use PayPal\Api\Authorization;
// ### Create a mock Capture
try {
// create payment to get authorization Id
// create a mock authorization to get authorization Id
// createAuthorization is defined in common.php
$authId = createAuthorization($apiContext);
// Lookup the authorization
$authorization = Authorization::get($authId, $apiContext);
### Capture
$amt = new Amount();
$amt->setCurrency("USD")
->setTotal("1.00");
### Capture
$captur = new Capture();
$captur->setId($authId)
// Create a capture
$captureInfo = new Capture();
$captureInfo->setId($authId)
->setAmount($amt);
// get the authorization
$authorization = Authorization::get($authId, $apiContext);
// Create a capture
$capt = $authorization->capture($captur, $apiContext);
$capture = $authorization->capture($captureInfo, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
@@ -38,7 +42,7 @@ try {
// You can look up a capture by invoking the Capture::get method
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
try {
$capture = Capture::get($capt->getId(), $apiContext);
$capture = Capture::get($capture->getId(), $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
@@ -46,6 +50,9 @@ try {
}
?>
<html>
<head>
<title>Lookup a capture</title>
</head>
<body>
<div>
Capture Id: