Overview
  • Namespace
  • Class

Namespaces

  • PayPal
    • Api
    • Auth
    • Cache
    • Common
    • Converter
    • Core
    • Exception
    • Handler
    • Log
    • Rest
    • Security
    • Transport
    • Validation

Classes

  • PayPal\Api\Address
  • PayPal\Api\Agreement
  • PayPal\Api\AgreementDetails
  • PayPal\Api\AgreementStateDescriptor
  • PayPal\Api\AgreementTransaction
  • PayPal\Api\AgreementTransactions
  • PayPal\Api\AlternatePayment
  • PayPal\Api\Amount
  • PayPal\Api\Authorization
  • PayPal\Api\BankAccount
  • PayPal\Api\BankAccountsList
  • PayPal\Api\BankToken
  • PayPal\Api\BaseAddress
  • PayPal\Api\Billing
  • PayPal\Api\BillingAgreementToken
  • PayPal\Api\BillingInfo
  • PayPal\Api\CancelNotification
  • PayPal\Api\Capture
  • PayPal\Api\CarrierAccount
  • PayPal\Api\CarrierAccountToken
  • PayPal\Api\CartBase
  • PayPal\Api\ChargeModel
  • PayPal\Api\Cost
  • PayPal\Api\CountryCode
  • PayPal\Api\CreateProfileResponse
  • PayPal\Api\Credit
  • PayPal\Api\CreditCard
  • PayPal\Api\CreditCardHistory
  • PayPal\Api\CreditCardList
  • PayPal\Api\CreditCardToken
  • PayPal\Api\CreditFinancingOffered
  • PayPal\Api\Currency
  • PayPal\Api\CurrencyConversion
  • PayPal\Api\CustomAmount
  • PayPal\Api\DetailedRefund
  • PayPal\Api\Details
  • PayPal\Api\Error
  • PayPal\Api\ErrorDetails
  • PayPal\Api\ExtendedBankAccount
  • PayPal\Api\ExternalFunding
  • PayPal\Api\FileAttachment
  • PayPal\Api\FlowConfig
  • PayPal\Api\FmfDetails
  • PayPal\Api\FundingDetail
  • PayPal\Api\FundingInstrument
  • PayPal\Api\FundingOption
  • PayPal\Api\FundingSource
  • PayPal\Api\FuturePayment
  • PayPal\Api\HyperSchema
  • PayPal\Api\Image
  • PayPal\Api\Incentive
  • PayPal\Api\InputFields
  • PayPal\Api\InstallmentInfo
  • PayPal\Api\InstallmentOption
  • PayPal\Api\Invoice
  • PayPal\Api\InvoiceAddress
  • PayPal\Api\InvoiceItem
  • PayPal\Api\InvoiceNumber
  • PayPal\Api\InvoiceSearchResponse
  • PayPal\Api\Item
  • PayPal\Api\ItemList
  • PayPal\Api\Links
  • PayPal\Api\Measurement
  • PayPal\Api\MerchantInfo
  • PayPal\Api\MerchantPreferences
  • PayPal\Api\Metadata
  • PayPal\Api\NameValuePair
  • PayPal\Api\Notification
  • PayPal\Api\OpenIdAddress
  • PayPal\Api\OpenIdError
  • PayPal\Api\OpenIdSession
  • PayPal\Api\OpenIdTokeninfo
  • PayPal\Api\OpenIdUserinfo
  • PayPal\Api\Order
  • PayPal\Api\OverrideChargeModel
  • PayPal\Api\Participant
  • PayPal\Api\Patch
  • PayPal\Api\PatchRequest
  • PayPal\Api\Payee
  • PayPal\Api\Payer
  • PayPal\Api\PayerInfo
  • PayPal\Api\Payment
  • PayPal\Api\PaymentCard
  • PayPal\Api\PaymentCardToken
  • PayPal\Api\PaymentDefinition
  • PayPal\Api\PaymentDetail
  • PayPal\Api\PaymentExecution
  • PayPal\Api\PaymentHistory
  • PayPal\Api\PaymentInstruction
  • PayPal\Api\PaymentOptions
  • PayPal\Api\PaymentSummary
  • PayPal\Api\PaymentTerm
  • PayPal\Api\Payout
  • PayPal\Api\PayoutBatch
  • PayPal\Api\PayoutBatchHeader
  • PayPal\Api\PayoutItem
  • PayPal\Api\PayoutItemDetails
  • PayPal\Api\PayoutSenderBatchHeader
  • PayPal\Api\Phone
  • PayPal\Api\Plan
  • PayPal\Api\PlanList
  • PayPal\Api\PotentialPayerInfo
  • PayPal\Api\Presentation
  • PayPal\Api\PrivateLabelCard
  • PayPal\Api\ProcessorResponse
  • PayPal\Api\RecipientBankingInstruction
  • PayPal\Api\RedirectUrls
  • PayPal\Api\Refund
  • PayPal\Api\RefundDetail
  • PayPal\Api\RefundRequest
  • PayPal\Api\RelatedResources
  • PayPal\Api\Sale
  • PayPal\Api\Search
  • PayPal\Api\ShippingAddress
  • PayPal\Api\ShippingCost
  • PayPal\Api\ShippingInfo
  • PayPal\Api\Tax
  • PayPal\Api\Template
  • PayPal\Api\TemplateData
  • PayPal\Api\Templates
  • PayPal\Api\TemplateSettings
  • PayPal\Api\TemplateSettingsMetadata
  • PayPal\Api\Terms
  • PayPal\Api\Transaction
  • PayPal\Api\TransactionBase
  • PayPal\Api\Transactions
  • PayPal\Api\VerifyWebhookSignature
  • PayPal\Api\VerifyWebhookSignatureResponse
  • PayPal\Api\Webhook
  • PayPal\Api\WebhookEvent
  • PayPal\Api\WebhookEventList
  • PayPal\Api\WebhookEventType
  • PayPal\Api\WebhookEventTypeList
  • PayPal\Api\WebhookList
  • PayPal\Api\WebProfile
  • PayPal\Auth\OAuthTokenCredential
  • PayPal\Cache\AuthorizationCache
  • PayPal\Common\ArrayUtil
  • PayPal\Common\PayPalModel
  • PayPal\Common\PayPalResourceModel
  • PayPal\Common\PayPalUserAgent
  • PayPal\Common\ReflectionUtil
  • PayPal\Converter\FormatConverter
  • PayPal\Core\PayPalConfigManager
  • PayPal\Core\PayPalConstants
  • PayPal\Core\PayPalCredentialManager
  • PayPal\Core\PayPalHttpConfig
  • PayPal\Core\PayPalHttpConnection
  • PayPal\Core\PayPalLoggingManager
  • PayPal\Handler\OauthHandler
  • PayPal\Handler\RestHandler
  • PayPal\Log\PayPalDefaultLogFactory
  • PayPal\Log\PayPalLogger
  • PayPal\Rest\ApiContext
  • PayPal\Security\Cipher
  • PayPal\Transport\PayPalRestCall
  • PayPal\Validation\ArgumentValidator
  • PayPal\Validation\JsonValidator
  • PayPal\Validation\NumericValidator
  • PayPal\Validation\UrlValidator

Interfaces

  • PayPal\Handler\IPayPalHandler
  • PayPal\Log\PayPalLogFactory
  • PayPal\Rest\IResource

Exceptions

  • PayPal\Exception\PayPalConfigurationException
  • PayPal\Exception\PayPalConnectionException
  • PayPal\Exception\PayPalInvalidCredentialException
  • PayPal\Exception\PayPalMissingCredentialException
  1 <?php
  2 
  3 namespace PayPal\Api;
  4 
  5 use PayPal\Common\PayPalResourceModel;
  6 use PayPal\Validation\ArgumentValidator;
  7 use PayPal\Rest\ApiContext;
  8 
  9 /**
 10  * Class Authorization
 11  *
 12  * An authorization transaction.
 13  *
 14  * @package PayPal\Api
 15  *
 16  * @property string id
 17  * @property \PayPal\Api\Amount amount
 18  * @property string payment_mode
 19  * @property string state
 20  * @property string reason_code
 21  * @property string pending_reason
 22  * @property string protection_eligibility
 23  * @property string protection_eligibility_type
 24  * @property \PayPal\Api\FmfDetails fmf_details
 25  * @property string parent_payment
 26  * @property \PayPal\Api\ProcessorResponse processor_response
 27  * @property string valid_until
 28  * @property string create_time
 29  * @property string update_time
 30  * @property string reference_id
 31  * @property string receipt_id
 32  * @property \PayPal\Api\Links[] links
 33  */
 34 class Authorization extends PayPalResourceModel
 35 {
 36     /**
 37      * ID of the authorization transaction.
 38      *
 39      * @param string $id
 40      * 
 41      * @return $this
 42      */
 43     public function setId($id)
 44     {
 45         $this->id = $id;
 46         return $this;
 47     }
 48 
 49     /**
 50      * ID of the authorization transaction.
 51      *
 52      * @return string
 53      */
 54     public function getId()
 55     {
 56         return $this->id;
 57     }
 58 
 59     /**
 60      * Amount being authorized.
 61      *
 62      * @param \PayPal\Api\Amount $amount
 63      * 
 64      * @return $this
 65      */
 66     public function setAmount($amount)
 67     {
 68         $this->amount = $amount;
 69         return $this;
 70     }
 71 
 72     /**
 73      * Amount being authorized.
 74      *
 75      * @return \PayPal\Api\Amount
 76      */
 77     public function getAmount()
 78     {
 79         return $this->amount;
 80     }
 81 
 82     /**
 83      * Specifies the payment mode of the transaction.
 84      * Valid Values: ["INSTANT_TRANSFER"]
 85      *
 86      * @param string $payment_mode
 87      * 
 88      * @return $this
 89      */
 90     public function setPaymentMode($payment_mode)
 91     {
 92         $this->payment_mode = $payment_mode;
 93         return $this;
 94     }
 95 
 96     /**
 97      * Specifies the payment mode of the transaction.
 98      *
 99      * @return string
100      */
101     public function getPaymentMode()
102     {
103         return $this->payment_mode;
104     }
105 
106     /**
107      * State of the authorization.
108      * Valid Values: ["pending", "authorized", "partially_captured", "captured", "expired", "voided"]
109      *
110      * @param string $state
111      * 
112      * @return $this
113      */
114     public function setState($state)
115     {
116         $this->state = $state;
117         return $this;
118     }
119 
120     /**
121      * State of the authorization.
122      *
123      * @return string
124      */
125     public function getState()
126     {
127         return $this->state;
128     }
129 
130     /**
131      * Reason code, `AUTHORIZATION`, for a transaction state of `pending`.
132      * Valid Values: ["AUTHORIZATION"]
133      *
134      * @param string $reason_code
135      * 
136      * @return $this
137      */
138     public function setReasonCode($reason_code)
139     {
140         $this->reason_code = $reason_code;
141         return $this;
142     }
143 
144     /**
145      * Reason code, `AUTHORIZATION`, for a transaction state of `pending`.
146      *
147      * @return string
148      */
149     public function getReasonCode()
150     {
151         return $this->reason_code;
152     }
153 
154     /**
155      * [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead.
156      * Valid Values: ["AUTHORIZATION"]
157      *
158      * @param string $pending_reason
159      * 
160      * @return $this
161      */
162     public function setPendingReason($pending_reason)
163     {
164         $this->pending_reason = $pending_reason;
165         return $this;
166     }
167 
168     /**
169      * @deprecated  [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead.
170      *
171      * @return string
172      */
173     public function getPendingReason()
174     {
175         return $this->pending_reason;
176     }
177 
178     /**
179      * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br>  `ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.<br> `PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics. <br> `INELIGIBLE`- Merchant is not protected under the Seller Protection Policy.
180      * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"]
181      *
182      * @param string $protection_eligibility
183      * 
184      * @return $this
185      */
186     public function setProtectionEligibility($protection_eligibility)
187     {
188         $this->protection_eligibility = $protection_eligibility;
189         return $this;
190     }
191 
192     /**
193      * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br>  `ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.<br> `PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics. <br> `INELIGIBLE`- Merchant is not protected under the Seller Protection Policy.
194      *
195      * @return string
196      */
197     public function getProtectionEligibility()
198     {
199         return $this->protection_eligibility;
200     }
201 
202     /**
203      * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned.
204      * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"]
205      *
206      * @param string $protection_eligibility_type
207      * 
208      * @return $this
209      */
210     public function setProtectionEligibilityType($protection_eligibility_type)
211     {
212         $this->protection_eligibility_type = $protection_eligibility_type;
213         return $this;
214     }
215 
216     /**
217      * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned.
218      *
219      * @return string
220      */
221     public function getProtectionEligibilityType()
222     {
223         return $this->protection_eligibility_type;
224     }
225 
226     /**
227      * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](https://developer.paypal.com/docs/classic/fmf/integration-guide/FMFSummary/) for more information.
228      *
229      * @param \PayPal\Api\FmfDetails $fmf_details
230      * 
231      * @return $this
232      */
233     public function setFmfDetails($fmf_details)
234     {
235         $this->fmf_details = $fmf_details;
236         return $this;
237     }
238 
239     /**
240      * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](https://developer.paypal.com/docs/classic/fmf/integration-guide/FMFSummary/) for more information.
241      *
242      * @return \PayPal\Api\FmfDetails
243      */
244     public function getFmfDetails()
245     {
246         return $this->fmf_details;
247     }
248 
249     /**
250      * ID of the Payment resource that this transaction is based on.
251      *
252      * @param string $parent_payment
253      * 
254      * @return $this
255      */
256     public function setParentPayment($parent_payment)
257     {
258         $this->parent_payment = $parent_payment;
259         return $this;
260     }
261 
262     /**
263      * ID of the Payment resource that this transaction is based on.
264      *
265      * @return string
266      */
267     public function getParentPayment()
268     {
269         return $this->parent_payment;
270     }
271 
272     /**
273      * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`.
274      *
275      * @param \PayPal\Api\ProcessorResponse $processor_response
276      *
277      * @return $this
278      */
279     public function setProcessorResponse($processor_response)
280     {
281         $this->processor_response = $processor_response;
282         return $this;
283     }
284 
285     /**
286      * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`.
287      *
288      * @return \PayPal\Api\ProcessorResponse
289      */
290     public function getProcessorResponse()
291     {
292         return $this->processor_response;
293     }
294 
295     /**
296      * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
297      *
298      * @param string $valid_until
299      * 
300      * @return $this
301      */
302     public function setValidUntil($valid_until)
303     {
304         $this->valid_until = $valid_until;
305         return $this;
306     }
307 
308     /**
309      * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
310      *
311      * @return string
312      */
313     public function getValidUntil()
314     {
315         return $this->valid_until;
316     }
317 
318     /**
319      * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
320      *
321      * @param string $create_time
322      * 
323      * @return $this
324      */
325     public function setCreateTime($create_time)
326     {
327         $this->create_time = $create_time;
328         return $this;
329     }
330 
331     /**
332      * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
333      *
334      * @return string
335      */
336     public function getCreateTime()
337     {
338         return $this->create_time;
339     }
340 
341     /**
342      * Time that the resource was last updated.
343      *
344      * @param string $update_time
345      * 
346      * @return $this
347      */
348     public function setUpdateTime($update_time)
349     {
350         $this->update_time = $update_time;
351         return $this;
352     }
353 
354     /**
355      * Time that the resource was last updated.
356      *
357      * @return string
358      */
359     public function getUpdateTime()
360     {
361         return $this->update_time;
362     }
363 
364     /**
365      * Identifier to the purchase or transaction unit corresponding to this authorization transaction.
366      *
367      * @param string $reference_id
368      * 
369      * @return $this
370      */
371     public function setReferenceId($reference_id)
372     {
373         $this->reference_id = $reference_id;
374         return $this;
375     }
376 
377     /**
378      * Identifier to the purchase or transaction unit corresponding to this authorization transaction.
379      *
380      * @return string
381      */
382     public function getReferenceId()
383     {
384         return $this->reference_id;
385     }
386 
387     /**
388      * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment.
389      *
390      * @param string $receipt_id
391      * 
392      * @return $this
393      */
394     public function setReceiptId($receipt_id)
395     {
396         $this->receipt_id = $receipt_id;
397         return $this;
398     }
399 
400     /**
401      * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment.
402      *
403      * @return string
404      */
405     public function getReceiptId()
406     {
407         return $this->receipt_id;
408     }
409 
410     /**
411      * Shows details for an authorization, by ID.
412      *
413      * @param string $authorizationId
414      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
415      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
416      * @return Authorization
417      */
418     public static function get($authorizationId, $apiContext = null, $restCall = null)
419     {
420         ArgumentValidator::validate($authorizationId, 'authorizationId');
421         $payLoad = "";
422         $json = self::executeCall(
423             "/v1/payments/authorization/$authorizationId",
424             "GET",
425             $payLoad,
426             null,
427             $apiContext,
428             $restCall
429         );
430         $ret = new Authorization();
431         $ret->fromJson($json);
432         return $ret;
433     }
434 
435     /**
436      * Captures and processes an authorization, by ID. To use this call, the original payment call must specify an intent of `authorize`.
437      *
438      * @param Capture $capture
439      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
440      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
441      * @return Capture
442      */
443     public function capture($capture, $apiContext = null, $restCall = null)
444     {
445         ArgumentValidator::validate($this->getId(), "Id");
446         ArgumentValidator::validate($capture, 'capture');
447         $payLoad = $capture->toJSON();
448         $json = self::executeCall(
449             "/v1/payments/authorization/{$this->getId()}/capture",
450             "POST",
451             $payLoad,
452             null,
453             $apiContext,
454             $restCall
455         );
456         $ret = new Capture();
457         $ret->fromJson($json);
458         return $ret;
459     }
460 
461     /**
462      * Voids, or cancels, an authorization, by ID. You cannot void a fully captured authorization.
463      *
464      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
465      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
466      * @return Authorization
467      */
468     public function void($apiContext = null, $restCall = null)
469     {
470         ArgumentValidator::validate($this->getId(), "Id");
471         $payLoad = "";
472         $json = self::executeCall(
473             "/v1/payments/authorization/{$this->getId()}/void",
474             "POST",
475             $payLoad,
476             null,
477             $apiContext,
478             $restCall
479         );
480         $this->fromJson($json);
481         return $this;
482     }
483 
484     /**
485      * Reauthorizes a PayPal account payment, by authorization ID. To ensure that funds are still available, reauthorize a payment after the initial three-day honor period. Supports only the `amount` request parameter.
486      *
487      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
488      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
489      * @return Authorization
490      */
491     public function reauthorize($apiContext = null, $restCall = null)
492     {
493         ArgumentValidator::validate($this->getId(), "Id");
494         $payLoad = $this->toJSON();
495         $json = self::executeCall(
496             "/v1/payments/authorization/{$this->getId()}/reauthorize",
497             "POST",
498             $payLoad,
499             null,
500             $apiContext,
501             $restCall
502         );
503         $this->fromJson($json);
504         return $this;
505     }
506 
507 }
508 
API documentation generated by ApiGen