InboundTransfers to add funds to your FinancialAccount via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
*
* Related guide: Moving money with Treasury using InboundTransfer objects
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount (in cents) transferred.
* @property bool $cancelable Returns true if the InboundTransfer is able to be canceled.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|(object{code: string}&\Stripe\StripeObject) $failure_details Details about this InboundTransfer's failure. Only set when status is failed.
* @property string $financial_account The FinancialAccount that received the funds.
* @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
* @property (object{received_debit: null|string}&\Stripe\StripeObject) $linked_flows
* @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $origin_payment_method The origin payment method to be debited for an InboundTransfer.
* @property null|(object{billing_details: (object{address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&\Stripe\StripeObject), email: null|string, name: null|string}&\Stripe\StripeObject), type: string, us_bank_account?: (object{account_holder_type: null|string, account_type: null|string, bank_name: null|string, fingerprint: null|string, last4: null|string, mandate?: string|\Stripe\Mandate, network: string, routing_number: null|string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $origin_payment_method_details Details about the PaymentMethod for an InboundTransfer.
* @property null|bool $returned Returns true if the funds for an InboundTransfer were returned after the InboundTransfer went to the succeeded state.
* @property string $statement_descriptor Statement descriptor shown when funds are debited from the source. Not all payment networks support statement_descriptor.
* @property string $status Status of the InboundTransfer: processing, succeeded, failed, and canceled. An InboundTransfer is processing if it is created and pending. The status changes to succeeded once the funds have been "confirmed" and a transaction is created and posted. The status changes to failed if the transfer fails.
* @property (object{canceled_at?: null|int, failed_at: null|int, succeeded_at: null|int}&\Stripe\StripeObject) $status_transitions
* @property null|string|Transaction $transaction The Transaction associated with this object.
*/
class InboundTransfer extends \Stripe\ApiResource
{
const OBJECT_NAME = 'treasury.inbound_transfer';
const STATUS_CANCELED = 'canceled';
const STATUS_FAILED = 'failed';
const STATUS_PROCESSING = 'processing';
const STATUS_SUCCEEDED = 'succeeded';
/**
* Creates an InboundTransfer.
*
* @param null|array{amount: int, currency: string, description?: string, expand?: string[], financial_account: string, metadata?: array, origin_payment_method: string, statement_descriptor?: string} $params
* @param null|array|string $options
*
* @return InboundTransfer the created resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* Returns a list of InboundTransfers sent from the specified FinancialAccount.
*
* @param null|array{ending_before?: string, expand?: string[], financial_account: string, limit?: int, starting_after?: string, status?: string} $params
* @param null|array|string $opts
*
* @return \Stripe\Collection of ApiResources
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
}
/**
* Retrieves the details of an existing InboundTransfer.
*
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @return InboundTransfer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
return $instance;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @return InboundTransfer the canceled inbound transfer
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}