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/SearchBillingTransactions.php
japatel 4326394447 Fixes to Agreement Search Transaction
- Added searchTransactions method to include params
- Updated Tests accordingly.
- Updated Samples accordingly
2015-01-20 10:46:22 -06:00

25 lines
999 B
PHP

<?php
// # Search Billing Transactions Sample
//
// This sample code demonstrate how you can search all billing transactions, as documented here at:
// https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions
// API used: GET /v1/payments/billing-agreements/<Agreement-Id>/transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd
// Retrieving the Agreement object from Create Agreement From Credit Card Sample
/** @var Agreement $agreement */
$agreement = require 'GetBillingAgreement.php';
$agreementId = $agreement->getId();
use PayPal\Api\Agreement;
try {
$result = Agreement::searchTransactions($agreementId,array('start_date' => '2013-01-01', 'end_date' => '2015-01-20'), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Search for Transactions", "AgreementTransaction", $agreementId, null, $ex);
exit(1);
}
ResultPrinter::printResult("Search for Transactions", "AgreementTransaction", $agreementId, null, $result);
return $agreement;