1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Rest\ApiContext;
6 use PayPal\Transport\PayPalRestCall;
7
8 9 10 11 12
13 class FuturePayment extends Payment
14 {
15
16 17 18 19 20 21 22 23
24 public function create($apiContext = null, $clientMetadataId = null, $restCall = null)
25 {
26 $headers = array();
27 if ($clientMetadataId != null) {
28 $headers = array(
29 'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId
30 );
31 }
32 $payLoad = $this->toJSON();
33 $json = self::executeCall(
34 "/v1/payments/payment",
35 "POST",
36 $payLoad,
37 $headers,
38 $apiContext,
39 $restCall
40 );
41 $this->fromJson($json);
42 return $this;
43 }
44
45 46 47 48 49 50 51
52 public static function getRefreshToken($authorizationCode, $apiContext = null)
53 {
54 $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential);
55 $credential = $apiContext->getCredential();
56 return $credential->getRefreshToken($apiContext->getConfig(), $authorizationCode);
57 }
58
59 }
60