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/billing/GetBillingAgreement.php
japatel 4d481ad104 Enabled Billing Plans and Agreements APIs
- Added API Classes, Samples, and Tests
- Updated Functional Tests
- Updated Documentation with new SDK Name
- Updated Few Samples to use newer nicer result page
2014-10-31 13:53:42 -05:00

26 lines
883 B
PHP

<?php
// # Get Billing Agreement Sample
//
// This sample code demonstrate how you can get a billing agreement, as documented here at:
// https://developer.paypal.com/webapps/developer/docs/api/#retrieve-an-agreement
// API used: /v1/payments/billing-agreements/<Agreement-Id>
// Retrieving the Agreement object from Create Agreement From Credit Card Sample
/** @var Agreement $createdAgreement */
$createdAgreement = require 'CreateBillingAgreementWithCreditCard.php';
use PayPal\Api\Agreement;
try {
$agreement = Agreement::get($createdAgreement->getId(), $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
ResultPrinter::printResult("Retrieved an Agreement", "Agreement", $agreement->getId(), $createdAgreement->getId(), $agreement);
return $agreement;