forked from LiveCarta/PayPal-PHP-SDK
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
This commit is contained in:
25
sample/billing/GetBillingAgreement.php
Normal file
25
sample/billing/GetBillingAgreement.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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;
|
||||
Reference in New Issue
Block a user