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/lib/PayPal/Api/FuturePayment.php
japatel cea8981143 Enabling Future Payments
- Added feature to create future payments
- Updated Authentication model to retrieve long lived refresh token
- Updated Documentation
- Updated Sample
2014-10-06 11:17:39 -05:00

49 lines
1.2 KiB
PHP

<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
/**
* Class FuturePayment
*
* @package PayPal\Api
*/
class FuturePayment extends Payment
{
/**
* Extends the Payment object to create future payments
*
* @param null $apiContext
* @param $correlationId
* @return $this
*/
public function create($apiContext = null, $correlationId = null) {
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
if (($correlationId == null || trim($correlationId) == "")) {
throw new \InvalidArgumentException("correlationId cannot be null or empty");
}
$payLoad = $this->toJSON();
$call = new PPRestCall($apiContext);
$json = $call->execute(
array('PayPal\Rest\RestHandler'),
"/v1/payments/payment",
"POST",
$payLoad,
[
'Paypal-Application-Correlation-Id' => $correlationId,
'PAYPAL-CLIENT-METADATA-ID' => $correlationId
]
);
$this->fromJson($json);
return $this;
}
}