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:
30
sample/billing/ListPlans.php
Normal file
30
sample/billing/ListPlans.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// # Get List of Plan Sample
|
||||
//
|
||||
// This sample code demonstrate how you can get a list of billing plan, as documented here at:
|
||||
// https://developer.paypal.com/webapps/developer/docs/api/#list-plans
|
||||
// API used: /v1/payments/billing-plans
|
||||
|
||||
// Retrieving the Plan object from Create Plan Sample to demonstrate the List
|
||||
/** @var Plan $createdPlan */
|
||||
$createdPlan = require 'CreatePlan.php';
|
||||
|
||||
use PayPal\Api\Plan;
|
||||
|
||||
try {
|
||||
// Get the list of all plans
|
||||
// You can modify different params to change the return list.
|
||||
// The explanation about each pagination information could be found here
|
||||
// at https://developer.paypal.com/webapps/developer/docs/api/#list-plans
|
||||
$params = array('page_size' => '2');
|
||||
$planList = Plan::all($params, $apiContext);
|
||||
} catch (PayPal\Exception\PPConnectionException $ex) {
|
||||
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||
var_dump($ex->getData());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("List of Plans", "Plan", null, $params, $planList);
|
||||
|
||||
return $planList;
|
||||
Reference in New Issue
Block a user