ApiOperations
2 months ago
Apps
2 months ago
Billing
2 months ago
BillingPortal
2 months ago
Checkout
2 months ago
Climate
2 months ago
Entitlements
2 months ago
EventData
2 months ago
Events
2 months ago
Exception
2 months ago
FinancialConnections
2 months ago
Forwarding
2 months ago
HttpClient
2 months ago
Identity
2 months ago
Issuing
2 months ago
Radar
2 months ago
Reporting
2 months ago
Service
2 months ago
Sigma
2 months ago
Tax
2 months ago
Terminal
2 months ago
TestHelpers
2 months ago
Treasury
2 months ago
Util
2 months ago
V2
2 months ago
Account.php
2 months ago
AccountLink.php
2 months ago
AccountSession.php
2 months ago
ApiRequestor.php
2 months ago
ApiResource.php
2 months ago
ApiResponse.php
2 months ago
ApplePayDomain.php
2 months ago
Application.php
2 months ago
ApplicationFee.php
2 months ago
ApplicationFeeRefund.php
2 months ago
Balance.php
2 months ago
BalanceTransaction.php
2 months ago
BankAccount.php
2 months ago
BaseStripeClient.php
2 months ago
BaseStripeClientInterface.php
2 months ago
Capability.php
2 months ago
Card.php
2 months ago
CashBalance.php
2 months ago
Charge.php
2 months ago
Collection.php
2 months ago
ConfirmationToken.php
2 months ago
ConnectCollectionTransfer.php
2 months ago
CountrySpec.php
2 months ago
Coupon.php
2 months ago
CreditNote.php
2 months ago
CreditNoteLineItem.php
2 months ago
Customer.php
2 months ago
CustomerBalanceTransaction.php
2 months ago
CustomerCashBalanceTransaction.php
2 months ago
CustomerSession.php
2 months ago
Discount.php
2 months ago
Dispute.php
2 months ago
EphemeralKey.php
2 months ago
ErrorObject.php
2 months ago
Event.php
2 months ago
ExchangeRate.php
2 months ago
File.php
2 months ago
FileLink.php
2 months ago
FundingInstructions.php
2 months ago
Invoice.php
2 months ago
InvoiceItem.php
2 months ago
InvoiceLineItem.php
2 months ago
InvoiceRenderingTemplate.php
2 months ago
LineItem.php
2 months ago
LoginLink.php
2 months ago
Mandate.php
2 months ago
OAuth.php
2 months ago
OAuthErrorObject.php
2 months ago
PaymentIntent.php
2 months ago
PaymentLink.php
2 months ago
PaymentMethod.php
2 months ago
PaymentMethodConfiguration.php
2 months ago
PaymentMethodDomain.php
2 months ago
Payout.php
2 months ago
Person.php
2 months ago
Plan.php
2 months ago
Price.php
2 months ago
Product.php
2 months ago
ProductFeature.php
2 months ago
PromotionCode.php
2 months ago
Quote.php
2 months ago
Reason.php
2 months ago
RecipientTransfer.php
2 months ago
Refund.php
2 months ago
RelatedObject.php
2 months ago
RequestTelemetry.php
2 months ago
ReserveTransaction.php
2 months ago
Review.php
2 months ago
SearchResult.php
2 months ago
SetupAttempt.php
2 months ago
SetupIntent.php
2 months ago
ShippingRate.php
2 months ago
SingletonApiResource.php
2 months ago
Source.php
2 months ago
SourceMandateNotification.php
2 months ago
SourceTransaction.php
2 months ago
Stripe.php
2 months ago
StripeClient.php
2 months ago
StripeClientInterface.php
2 months ago
StripeObject.php
2 months ago
StripeStreamingClientInterface.php
2 months ago
Subscription.php
2 months ago
SubscriptionItem.php
2 months ago
SubscriptionSchedule.php
2 months ago
TaxCode.php
2 months ago
TaxDeductedAtSource.php
2 months ago
TaxId.php
2 months ago
TaxRate.php
2 months ago
ThinEvent.php
2 months ago
Token.php
2 months ago
Topup.php
2 months ago
Transfer.php
2 months ago
TransferReversal.php
2 months ago
UsageRecord.php
2 months ago
UsageRecordSummary.php
2 months ago
Webhook.php
2 months ago
WebhookEndpoint.php
2 months ago
WebhookSignature.php
2 months ago
Transfer.php
180 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * A <code>Transfer</code> object is created when you move funds between Stripe accounts as |
| 8 | * part of Connect. |
| 9 | * |
| 10 | * Before April 6, 2017, transfers also represented movement of funds from a |
| 11 | * Stripe account to a card or bank account. This behavior has since been split |
| 12 | * out into a <a href="https://stripe.com/docs/api#payout_object">Payout</a> object, with corresponding payout endpoints. For more |
| 13 | * information, read about the |
| 14 | * <a href="https://stripe.com/docs/transfer-payout-split">transfer/payout split</a>. |
| 15 | * |
| 16 | * Related guide: <a href="https://stripe.com/docs/connect/separate-charges-and-transfers">Creating separate charges and transfers</a> |
| 17 | * |
| 18 | * @property string $id Unique identifier for the object. |
| 19 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 20 | * @property int $amount Amount in cents (or local equivalent) to be transferred. |
| 21 | * @property int $amount_reversed Amount in cents (or local equivalent) reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). |
| 22 | * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this transfer on your account balance. |
| 23 | * @property int $created Time that this record of the transfer was first created. |
| 24 | * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. |
| 25 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. |
| 26 | * @property null|string|\Stripe\Account $destination ID of the Stripe account the transfer was sent to. |
| 27 | * @property null|string|\Stripe\Charge $destination_payment If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer. |
| 28 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 29 | * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 30 | * @property \Stripe\Collection<\Stripe\TransferReversal> $reversals A list of reversals that have been applied to the transfer. |
| 31 | * @property bool $reversed Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false. |
| 32 | * @property null|string|\Stripe\Charge $source_transaction ID of the charge that was used to fund the transfer. If null, the transfer was funded from the available balance. |
| 33 | * @property null|string $source_type The source balance this transfer came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>. |
| 34 | * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the <a href="https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options">Connect documentation</a> for details. |
| 35 | */ |
| 36 | class Transfer extends ApiResource |
| 37 | { |
| 38 | const OBJECT_NAME = 'transfer'; |
| 39 | use ApiOperations\NestedResource; |
| 40 | use ApiOperations\Update; |
| 41 | const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account'; |
| 42 | const SOURCE_TYPE_CARD = 'card'; |
| 43 | const SOURCE_TYPE_FPX = 'fpx'; |
| 44 | /** |
| 45 | * To send funds from your Stripe account to a connected account, you create a new |
| 46 | * transfer object. Your <a href="#balance">Stripe balance</a> must be able to |
| 47 | * cover the transfer amount, or you’ll receive an “Insufficient Funds” error. |
| 48 | * |
| 49 | * @param null|array $params |
| 50 | * @param null|array|string $options |
| 51 | * |
| 52 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 53 | * |
| 54 | * @return \Stripe\Transfer the created resource |
| 55 | */ |
| 56 | public static function create($params = null, $options = null) |
| 57 | { |
| 58 | self::_validateParams($params); |
| 59 | $url = static::classUrl(); |
| 60 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 61 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 62 | $obj->setLastResponse($response); |
| 63 | return $obj; |
| 64 | } |
| 65 | /** |
| 66 | * Returns a list of existing transfers sent to connected accounts. The transfers |
| 67 | * are returned in sorted order, with the most recently created transfers appearing |
| 68 | * first. |
| 69 | * |
| 70 | * @param null|array $params |
| 71 | * @param null|array|string $opts |
| 72 | * |
| 73 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 74 | * |
| 75 | * @return \Stripe\Collection<\Stripe\Transfer> of ApiResources |
| 76 | */ |
| 77 | public static function all($params = null, $opts = null) |
| 78 | { |
| 79 | $url = static::classUrl(); |
| 80 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 81 | } |
| 82 | /** |
| 83 | * Retrieves the details of an existing transfer. Supply the unique transfer ID |
| 84 | * from either a transfer creation request or the transfer list, and Stripe will |
| 85 | * return the corresponding transfer information. |
| 86 | * |
| 87 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 88 | * @param null|array|string $opts |
| 89 | * |
| 90 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 91 | * |
| 92 | * @return \Stripe\Transfer |
| 93 | */ |
| 94 | public static function retrieve($id, $opts = null) |
| 95 | { |
| 96 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 97 | $instance = new static($id, $opts); |
| 98 | $instance->refresh(); |
| 99 | return $instance; |
| 100 | } |
| 101 | /** |
| 102 | * Updates the specified transfer by setting the values of the parameters passed. |
| 103 | * Any parameters not provided will be left unchanged. |
| 104 | * |
| 105 | * This request accepts only metadata as an argument. |
| 106 | * |
| 107 | * @param string $id the ID of the resource to update |
| 108 | * @param null|array $params |
| 109 | * @param null|array|string $opts |
| 110 | * |
| 111 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 112 | * |
| 113 | * @return \Stripe\Transfer the updated resource |
| 114 | */ |
| 115 | public static function update($id, $params = null, $opts = null) |
| 116 | { |
| 117 | self::_validateParams($params); |
| 118 | $url = static::resourceUrl($id); |
| 119 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 120 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 121 | $obj->setLastResponse($response); |
| 122 | return $obj; |
| 123 | } |
| 124 | const PATH_REVERSALS = '/reversals'; |
| 125 | /** |
| 126 | * @param string $id the ID of the transfer on which to retrieve the transfer reversals |
| 127 | * @param null|array $params |
| 128 | * @param null|array|string $opts |
| 129 | * |
| 130 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 131 | * |
| 132 | * @return \Stripe\Collection<\Stripe\TransferReversal> the list of transfer reversals |
| 133 | */ |
| 134 | public static function allReversals($id, $params = null, $opts = null) |
| 135 | { |
| 136 | return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts); |
| 137 | } |
| 138 | /** |
| 139 | * @param string $id the ID of the transfer on which to create the transfer reversal |
| 140 | * @param null|array $params |
| 141 | * @param null|array|string $opts |
| 142 | * |
| 143 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 144 | * |
| 145 | * @return \Stripe\TransferReversal |
| 146 | */ |
| 147 | public static function createReversal($id, $params = null, $opts = null) |
| 148 | { |
| 149 | return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts); |
| 150 | } |
| 151 | /** |
| 152 | * @param string $id the ID of the transfer to which the transfer reversal belongs |
| 153 | * @param string $reversalId the ID of the transfer reversal to retrieve |
| 154 | * @param null|array $params |
| 155 | * @param null|array|string $opts |
| 156 | * |
| 157 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 158 | * |
| 159 | * @return \Stripe\TransferReversal |
| 160 | */ |
| 161 | public static function retrieveReversal($id, $reversalId, $params = null, $opts = null) |
| 162 | { |
| 163 | return self::_retrieveNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); |
| 164 | } |
| 165 | /** |
| 166 | * @param string $id the ID of the transfer to which the transfer reversal belongs |
| 167 | * @param string $reversalId the ID of the transfer reversal to update |
| 168 | * @param null|array $params |
| 169 | * @param null|array|string $opts |
| 170 | * |
| 171 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 172 | * |
| 173 | * @return \Stripe\TransferReversal |
| 174 | */ |
| 175 | public static function updateReversal($id, $reversalId, $params = null, $opts = null) |
| 176 | { |
| 177 | return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); |
| 178 | } |
| 179 | } |
| 180 |