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\Rest\ApiContext;
  7 use PayPal\Transport\PayPalRestCall;
  8 use PayPal\Validation\ArgumentValidator;
  9 
 10 /**
 11  * Class Payout
 12  *
 13  * This object represents a set of payouts that includes status data for the payouts. This object enables you to create a payout using a POST request.
 14  *
 15  * @package PayPal\Api
 16  *
 17  * @property \PayPal\Api\PayoutSenderBatchHeader sender_batch_header
 18  * @property \PayPal\Api\PayoutItem[] items
 19  * @property \PayPal\Api\Links[] links
 20  */
 21 class Payout extends PayPalResourceModel
 22 {
 23     /**
 24      * The original batch header as provided by the payment sender.
 25      *
 26      * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header
 27      *
 28      * @return $this
 29      */
 30     public function setSenderBatchHeader($sender_batch_header)
 31     {
 32         $this->sender_batch_header = $sender_batch_header;
 33         return $this;
 34     }
 35 
 36     /**
 37      * The original batch header as provided by the payment sender.
 38      *
 39      * @return \PayPal\Api\PayoutSenderBatchHeader
 40      */
 41     public function getSenderBatchHeader()
 42     {
 43         return $this->sender_batch_header;
 44     }
 45 
 46     /**
 47      * An array of payout items (that is, a set of individual payouts).
 48      *
 49      * @param \PayPal\Api\PayoutItem[] $items
 50      *
 51      * @return $this
 52      */
 53     public function setItems($items)
 54     {
 55         $this->items = $items;
 56         return $this;
 57     }
 58 
 59     /**
 60      * An array of payout items (that is, a set of individual payouts).
 61      *
 62      * @return \PayPal\Api\PayoutItem[]
 63      */
 64     public function getItems()
 65     {
 66         return $this->items;
 67     }
 68 
 69     /**
 70      * Append Items to the list.
 71      *
 72      * @param \PayPal\Api\PayoutItem $payoutItem
 73      * @return $this
 74      */
 75     public function addItem($payoutItem)
 76     {
 77         if (!$this->getItems()) {
 78             return $this->setItems(array($payoutItem));
 79         } else {
 80             return $this->setItems(
 81                 array_merge($this->getItems(), array($payoutItem))
 82             );
 83         }
 84     }
 85 
 86     /**
 87      * Remove Items from the list.
 88      *
 89      * @param \PayPal\Api\PayoutItem $payoutItem
 90      * @return $this
 91      */
 92     public function removeItem($payoutItem)
 93     {
 94         return $this->setItems(
 95             array_diff($this->getItems(), array($payoutItem))
 96         );
 97     }
 98 
 99     /**
100      * Create a payout batch resource by passing a sender_batch_header and an items array to the request URI. The sender_batch_header contains payout parameters that describe the handling of a batch resource while the items array conatins payout items.
101      *
102      * @param array $params
103      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
104      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
105      * @return PayoutBatch
106      */
107     public function create($params = array(), $apiContext = null, $restCall = null)
108     {
109         $params = $params ? $params : array();
110         ArgumentValidator::validate($params, 'params');
111         $payLoad = $this->toJSON();
112         $allowedParams = array(
113             'sync_mode' => 1,
114         );
115         $json = self::executeCall(
116             "/v1/payments/payouts" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
117             "POST",
118             $payLoad,
119             null,
120             $apiContext,
121             $restCall
122         );
123         $ret = new PayoutBatch();
124         $ret->fromJson($json);
125         return $ret;
126     }
127 
128     /**
129      * You can submit a payout with a synchronous API call, which immediately returns the results of a PayPal payment.
130      *
131      * @param ApiContext $apiContext
132      * @param PayPalRestCall $restCall
133      * @return PayoutBatch
134      */
135     public function createSynchronous($apiContext = null, $restCall = null)
136     {
137         $params = array('sync_mode' => 'true');
138         return $this->create($params, $apiContext, $restCall);
139     }
140 
141     /**
142      * Obtain the status of a specific batch resource by passing the payout batch ID to the request URI. You can issue this call multiple times to get the current status.
143      *
144      * @param string $payoutBatchId
145      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
146      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
147      * @return PayoutBatch
148      */
149     public static function get($payoutBatchId, $apiContext = null, $restCall = null)
150     {
151         ArgumentValidator::validate($payoutBatchId, 'payoutBatchId');
152         $payLoad = "";
153         $json = self::executeCall(
154             "/v1/payments/payouts/$payoutBatchId",
155             "GET",
156             $payLoad,
157             null,
158             $apiContext,
159             $restCall
160         );
161         $ret = new PayoutBatch();
162         $ret->fromJson($json);
163         return $ret;
164     }
165 
166 }
167 
API documentation generated by ApiGen