I need to access the next billing date for an agreement using the PayPal REST api via the php sdk.
I see inside
PayPal\Api\AgreementDetails;
We have
getNextBillingDate()
How do I access this?
I have:
...other code
use PayPal\Api\AgreementDetails;
$agreement_check = \PayPal\Api\Agreement::get($agreementID, $apiContext);
$renew_date = $agreement_check->getNextBillingDate();
I get the following error:
Fatal error: Call to undefined method PayPal\Api\Agreement::getNextBillingDate()
What is the correct way to access this?
You're not using a method to return AgreementDetails
in $agreement_check
. The right method is named getAgreementDetails
and it's part of Agreement Class, so you must do something like this:
use PayPal\Api\AgreementDetails;
$agreement_check = \PayPal\Api\Agreement::get($agreementID, $apiContext);
$agreement_details = $agreement_check->getAgreementDetails();
$renew_date = $agreement_details->getNextBillingDate();
Just take a good look at official PayPal PHP SDK documentation: Class PayPal Agreement - PHP PayPal SDK
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.