This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/sample/payments/GetAuthorization.php
2014-10-20 15:54:09 -05:00

44 lines
1.1 KiB
PHP

<?php
// # GetAuthorization
// This sample code demonstrates how you can get details
// of an authorized payment.
// API used: /v1/payments/authorization/<$authorizationId>
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Authorization;
// ### GetAuthorization
// You can retrieve info about an Authorization
// by invoking the Authorization::get method
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
// The return object contains the authorization state.
try {
// create a authorization to get authorization Id
// createAuthorization is defined in common.php
$authId = createAuthorization($apiContext);
// Retrieve the authorization
$authorization = Authorization::get($authId, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Lookup an authorization</title>
</head>
<body>
<div>
Retrieved Authorization:
<?php echo $authorization->getId();?>
</div>
<pre><?php echo $authorization->toJSON(128);?></pre>
<a href='../index.html'>Back</a>
</body>
</html>