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\Transport\PayPalRestCall;
  7 use PayPal\Validation\ArgumentValidator;
  8 use PayPal\Rest\ApiContext;
  9 
 10 /**
 11  * Class Capture
 12  *
 13  * A capture transaction.
 14  *
 15  * @package PayPal\Api
 16  *
 17  * @property string id
 18  * @property \PayPal\Api\Amount amount
 19  * @property bool is_final_capture
 20  * @property string state
 21  * @property string reason_code
 22  * @property string parent_payment
 23  * @property string invoice_number
 24  * @property \PayPal\Api\Currency transaction_fee
 25  * @property string create_time
 26  * @property string update_time
 27  * @property \PayPal\Api\Links[] links
 28  */
 29 class Capture extends PayPalResourceModel
 30 {
 31     /**
 32      * The ID of the capture transaction.
 33      *
 34      * @param string $id
 35      * 
 36      * @return $this
 37      */
 38     public function setId($id)
 39     {
 40         $this->id = $id;
 41         return $this;
 42     }
 43 
 44     /**
 45      * The ID of the capture transaction.
 46      *
 47      * @return string
 48      */
 49     public function getId()
 50     {
 51         return $this->id;
 52     }
 53 
 54     /**
 55      * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`.
 56      *
 57      * @param \PayPal\Api\Amount $amount
 58      * 
 59      * @return $this
 60      */
 61     public function setAmount($amount)
 62     {
 63         $this->amount = $amount;
 64         return $this;
 65     }
 66 
 67     /**
 68      * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`.
 69      *
 70      * @return \PayPal\Api\Amount
 71      */
 72     public function getAmount()
 73     {
 74         return $this->amount;
 75     }
 76 
 77     /**
 78      * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`.
 79      *
 80      * @param bool $is_final_capture
 81      * 
 82      * @return $this
 83      */
 84     public function setIsFinalCapture($is_final_capture)
 85     {
 86         $this->is_final_capture = $is_final_capture;
 87         return $this;
 88     }
 89 
 90     /**
 91      * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`.
 92      *
 93      * @return bool
 94      */
 95     public function getIsFinalCapture()
 96     {
 97         return $this->is_final_capture;
 98     }
 99 
100     /**
101      * The state of the capture.
102      * Valid Values: ["pending", "completed", "refunded", "partially_refunded"]
103      *
104      * @param string $state
105      * 
106      * @return $this
107      */
108     public function setState($state)
109     {
110         $this->state = $state;
111         return $this;
112     }
113 
114     /**
115      * The state of the capture.
116      *
117      * @return string
118      */
119     public function getState()
120     {
121         return $this->state;
122     }
123 
124     /**
125      * The reason code that describes why the transaction state is pending or reversed.
126      * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED", "TRANSACTION_APPROVED_AWAITING_FUNDING"]
127      *
128      * @param string $reason_code
129      * 
130      * @return $this
131      */
132     public function setReasonCode($reason_code)
133     {
134         $this->reason_code = $reason_code;
135         return $this;
136     }
137 
138     /**
139      * The reason code that describes why the transaction state is pending or reversed.
140      *
141      * @return string
142      */
143     public function getReasonCode()
144     {
145         return $this->reason_code;
146     }
147 
148     /**
149      * The ID of the payment on which this transaction is based.
150      *
151      * @param string $parent_payment
152      * 
153      * @return $this
154      */
155     public function setParentPayment($parent_payment)
156     {
157         $this->parent_payment = $parent_payment;
158         return $this;
159     }
160 
161     /**
162      * The ID of the payment on which this transaction is based.
163      *
164      * @return string
165      */
166     public function getParentPayment()
167     {
168         return $this->parent_payment;
169     }
170 
171     /**
172      * The invoice number to track this payment.
173      *
174      * @param string $invoice_number
175      * 
176      * @return $this
177      */
178     public function setInvoiceNumber($invoice_number)
179     {
180         $this->invoice_number = $invoice_number;
181         return $this;
182     }
183 
184     /**
185      * The invoice number to track this payment.
186      *
187      * @return string
188      */
189     public function getInvoiceNumber()
190     {
191         return $this->invoice_number;
192     }
193 
194     /**
195      * The transaction fee for this payment.
196      *
197      * @param \PayPal\Api\Currency $transaction_fee
198      * 
199      * @return $this
200      */
201     public function setTransactionFee($transaction_fee)
202     {
203         $this->transaction_fee = $transaction_fee;
204         return $this;
205     }
206 
207     /**
208      * The transaction fee for this payment.
209      *
210      * @return \PayPal\Api\Currency
211      */
212     public function getTransactionFee()
213     {
214         return $this->transaction_fee;
215     }
216 
217     /**
218      * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
219      *
220      * @param string $create_time
221      * 
222      * @return $this
223      */
224     public function setCreateTime($create_time)
225     {
226         $this->create_time = $create_time;
227         return $this;
228     }
229 
230     /**
231      * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
232      *
233      * @return string
234      */
235     public function getCreateTime()
236     {
237         return $this->create_time;
238     }
239 
240     /**
241      * The date and time when the resource was last updated.
242      *
243      * @param string $update_time
244      * 
245      * @return $this
246      */
247     public function setUpdateTime($update_time)
248     {
249         $this->update_time = $update_time;
250         return $this;
251     }
252 
253     /**
254      * The date and time when the resource was last updated.
255      *
256      * @return string
257      */
258     public function getUpdateTime()
259     {
260         return $this->update_time;
261     }
262 
263     /**
264      * Shows details for a captured payment, by ID.
265      *
266      * @param string $captureId
267      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
268      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
269      * @return Capture
270      */
271     public static function get($captureId, $apiContext = null, $restCall = null)
272     {
273         ArgumentValidator::validate($captureId, 'captureId');
274         $payLoad = "";
275         $json = self::executeCall(
276             "/v1/payments/capture/$captureId",
277             "GET",
278             $payLoad,
279             null,
280             $apiContext,
281             $restCall
282         );
283         $ret = new Capture();
284         $ret->fromJson($json);
285         return $ret;
286     }
287 
288     /**
289      * Refund a captured payment by passing the capture_id in the request URI. In addition, include an amount object in the body of the request JSON.
290      *
291      * @deprecated Please use #refundCapturedPayment instead.
292      * @param Refund         $refund
293      * @param ApiContext     $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
294      * @param PayPalRestCall $restCall   is the Rest Call Service that is used to make rest calls
295      * @return Refund
296      */
297     public function refund($refund, $apiContext = null, $restCall = null)
298     {
299         ArgumentValidator::validate($this->getId(), "Id");
300         ArgumentValidator::validate($refund, 'refund');
301         $payLoad = $refund->toJSON();
302         $json = self::executeCall(
303             "/v1/payments/capture/{$this->getId()}/refund",
304             "POST",
305             $payLoad,
306             null,
307             $apiContext,
308             $restCall
309         );
310         $ret = new Refund();
311         $ret->fromJson($json);
312         return $ret;
313     }
314 
315     /**
316      * Refunds a captured payment, by ID. Include an `amount` object in the JSON request body.
317      *
318      * @param RefundRequest $refundRequest
319      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
320      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
321      * @return DetailedRefund
322      */
323     public function refundCapturedPayment($refundRequest, $apiContext = null, $restCall = null)
324     {
325         ArgumentValidator::validate($this->getId(), "Id");
326         ArgumentValidator::validate($refundRequest, 'refundRequest');
327         $payLoad = $refundRequest->toJSON();
328         $json = self::executeCall(
329             "/v1/payments/capture/{$this->getId()}/refund",
330             "POST",
331             $payLoad,
332             null,
333             $apiContext,
334             $restCall
335         );
336         $ret = new DetailedRefund();
337         $ret->fromJson($json);
338         return $ret;
339     }
340 
341 }
342 
API documentation generated by ApiGen