I’m setting up an application using Paypal Adaptive Payments.
I’m currently implementing the call to the Preapproval, and the specification says the StartDate can not be before today.
With that in mind… under which timezone are they validating this against?
The API SDK has this in the example:
$currDate = getdate();
$startDate = $currDate['year'].'-'.$currDate['mon'].'-'.$currDate['mday'];
$startDate = strtotime($startDate);
$startDate = date('Y-m-d', mktime(0,0,0,date('m',$startDate),date('d',$startDate),date('Y',$startDate)));
$endDate = add_date($startDate, 1);
However that date can be different based on the timezone of the server sending the request.
Anyone have any ideas on how to ensure no issues will occur?
Edit w/ Bounty:
As of December 15th, we have now run into this as an error. We are using UTC time, and once it turns a new day in UTC, payments start getting failures.
I am using the above code in the following place:
$preapprovalRequest->startingDate = $startDate;
$preapprovalRequest->endingDate = $endDate;
What do I need to make this work?
Edit 2:
Yes timezone is setup as UTC, we did this intentionally so that all time information in our database is stored without timezone.
Essentially I’m trying to figure out how to specify that the date I’m sending to Paypal is in UTC, not whatever timezone they happen to be in.
Edit 3:
There is the API, and it says the following
The startingDate and endingDate can be in eiter Zulu or GMT offset
formats. as in the following respective examples:
2010-09-10Z
2010-09-10T17:24:03.874-07:00
Essentially I need the above code, to output something like that specifying I’m using UTC…
PHP time functions are based on system time (http://us.php.net/manual/en/intro.datetime.php). Are you sure your system is setup to use UTC time? You can check with the following:
Notice the UTC in the response. If your system is setup to some other timezone, then that may be your problem, if you need to set your timezone to UTC, try:
Also be sure that your system time is corrected using Network Time Protocol:
— Edit —
Based on your edits, looks like they are expecting the time in either Zulu (append Z) or GMT with offset (more complex), try this: