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
BankAccount.php
148 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * These bank accounts are payment methods on <code>Customer</code> objects. |
| 8 | * |
| 9 | * On the other hand <a href="/api#external_accounts">External Accounts</a> are transfer |
| 10 | * destinations on <code>Account</code> objects for connected accounts. |
| 11 | * They can be bank accounts or debit cards as well, and are documented in the links above. |
| 12 | * |
| 13 | * Related guide: <a href="/payments/bank-debits-transfers">Bank debits and transfers</a> |
| 14 | * |
| 15 | * @property string $id Unique identifier for the object. |
| 16 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 17 | * @property null|string|\Stripe\Account $account The ID of the account that the bank account is associated with. |
| 18 | * @property null|string $account_holder_name The name of the person or business that owns the bank account. |
| 19 | * @property null|string $account_holder_type The type of entity that holds the account. This can be either <code>individual</code> or <code>company</code>. |
| 20 | * @property null|string $account_type The bank account type. This can only be <code>checking</code> or <code>savings</code> in most countries. In Japan, this can only be <code>futsu</code> or <code>toza</code>. |
| 21 | * @property null|string[] $available_payout_methods A set of available payout methods for this bank account. Only values from this set should be passed as the <code>method</code> when creating a payout. |
| 22 | * @property null|string $bank_name Name of the bank associated with the routing number (e.g., <code>WELLS FARGO</code>). |
| 23 | * @property string $country Two-letter ISO code representing the country the bank account is located in. |
| 24 | * @property string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for the currency</a> paid out to the bank account. |
| 25 | * @property null|string|\Stripe\Customer $customer The ID of the customer that the bank account is associated with. |
| 26 | * @property null|bool $default_for_currency Whether this bank account is the default external account for its currency. |
| 27 | * @property null|string $fingerprint Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. |
| 28 | * @property null|\Stripe\StripeObject $future_requirements Information about the <a href="https://stripe.com/docs/connect/custom-accounts/future-requirements">upcoming new requirements for the bank account</a>, including what information needs to be collected, and by when. |
| 29 | * @property string $last4 The last four digits of the bank account number. |
| 30 | * @property null|\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. |
| 31 | * @property null|\Stripe\StripeObject $requirements Information about the requirements for the bank account, including what information needs to be collected. |
| 32 | * @property null|string $routing_number The routing transit number for the bank account. |
| 33 | * @property string $status <p>For bank accounts, possible values are <code>new</code>, <code>validated</code>, <code>verified</code>, <code>verification_failed</code>, or <code>errored</code>. A bank account that hasn't had any activity or validation performed is <code>new</code>. If Stripe can determine that the bank account exists, its status will be <code>validated</code>. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be <code>verified</code>. If the verification failed for any reason, such as microdeposit failure, the status will be <code>verification_failed</code>. If a payout sent to this bank account fails, we'll set the status to <code>errored</code> and will not continue to send <a href="https://stripe.com/docs/payouts#payout-schedule">scheduled payouts</a> until the bank details are updated.</p><p>For external accounts, possible values are <code>new</code>, <code>errored</code> and <code>verification_failed</code>. If a payout fails, the status is set to <code>errored</code> and scheduled payouts are stopped until account details are updated. In the US and India, if we can't <a href="https://support.stripe.com/questions/bank-account-ownership-verification">verify the owner of the bank account</a>, we'll set the status to <code>verification_failed</code>. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.</p> |
| 34 | */ |
| 35 | class BankAccount extends ApiResource |
| 36 | { |
| 37 | const OBJECT_NAME = 'bank_account'; |
| 38 | /** |
| 39 | * Delete a specified external account for a given account. |
| 40 | * |
| 41 | * @param null|array $params |
| 42 | * @param null|array|string $opts |
| 43 | * |
| 44 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 45 | * |
| 46 | * @return \Stripe\BankAccount the deleted resource |
| 47 | */ |
| 48 | public function delete($params = null, $opts = null) |
| 49 | { |
| 50 | self::_validateParams($params); |
| 51 | $url = $this->instanceUrl(); |
| 52 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 53 | $this->refreshFrom($response, $opts); |
| 54 | return $this; |
| 55 | } |
| 56 | /** |
| 57 | * Possible string representations of the bank verification status. |
| 58 | * |
| 59 | * @see https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status |
| 60 | */ |
| 61 | const STATUS_NEW = 'new'; |
| 62 | const STATUS_VALIDATED = 'validated'; |
| 63 | const STATUS_VERIFIED = 'verified'; |
| 64 | const STATUS_VERIFICATION_FAILED = 'verification_failed'; |
| 65 | const STATUS_ERRORED = 'errored'; |
| 66 | /** |
| 67 | * @return string The instance URL for this resource. It needs to be special |
| 68 | * cased because it doesn't fit into the standard resource pattern. |
| 69 | */ |
| 70 | public function instanceUrl() |
| 71 | { |
| 72 | if ($this['customer']) { |
| 73 | $base = Customer::classUrl(); |
| 74 | $parent = $this['customer']; |
| 75 | $path = 'sources'; |
| 76 | } elseif ($this['account']) { |
| 77 | $base = Account::classUrl(); |
| 78 | $parent = $this['account']; |
| 79 | $path = 'external_accounts'; |
| 80 | } else { |
| 81 | $msg = 'Bank accounts cannot be accessed without a customer ID or account ID.'; |
| 82 | throw new Exception\UnexpectedValueException($msg, null); |
| 83 | } |
| 84 | $parentExtn = \urlencode(Util\Util::utf8($parent)); |
| 85 | $extn = \urlencode(Util\Util::utf8($this['id'])); |
| 86 | return "{$base}/{$parentExtn}/{$path}/{$extn}"; |
| 87 | } |
| 88 | /** |
| 89 | * @param array|string $_id |
| 90 | * @param null|array|string $_opts |
| 91 | * |
| 92 | * @throws \Stripe\Exception\BadMethodCallException |
| 93 | */ |
| 94 | public static function retrieve($_id, $_opts = null) |
| 95 | { |
| 96 | $msg = 'Bank accounts cannot be retrieved without a customer ID or ' . 'an account ID. Retrieve a bank account using ' . "`Customer::retrieveSource('customer_id', " . "'bank_account_id')` or `Account::retrieveExternalAccount(" . "'account_id', 'bank_account_id')`."; |
| 97 | throw new Exception\BadMethodCallException($msg); |
| 98 | } |
| 99 | /** |
| 100 | * @param string $_id |
| 101 | * @param null|array $_params |
| 102 | * @param null|array|string $_options |
| 103 | * |
| 104 | * @throws \Stripe\Exception\BadMethodCallException |
| 105 | */ |
| 106 | public static function update($_id, $_params = null, $_options = null) |
| 107 | { |
| 108 | $msg = 'Bank accounts cannot be updated without a customer ID or an ' . 'account ID. Update a bank account using ' . "`Customer::updateSource('customer_id', 'bank_account_id', " . '$updateParams)` or `Account::updateExternalAccount(' . "'account_id', 'bank_account_id', \$updateParams)`."; |
| 109 | throw new Exception\BadMethodCallException($msg); |
| 110 | } |
| 111 | /** |
| 112 | * @param null|array|string $opts |
| 113 | * |
| 114 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 115 | * |
| 116 | * @return static the saved resource |
| 117 | * |
| 118 | * @deprecated The `save` method is deprecated and will be removed in a |
| 119 | * future major version of the library. Use the static method `update` |
| 120 | * on the resource instead. |
| 121 | */ |
| 122 | public function save($opts = null) |
| 123 | { |
| 124 | $params = $this->serializeParameters(); |
| 125 | if (\count($params) > 0) { |
| 126 | $url = $this->instanceUrl(); |
| 127 | list($response, $opts) = $this->_request('post', $url, $params, $opts, ['save']); |
| 128 | $this->refreshFrom($response, $opts); |
| 129 | } |
| 130 | return $this; |
| 131 | } |
| 132 | /** |
| 133 | * @param null|array $params |
| 134 | * @param null|array|string $opts |
| 135 | * |
| 136 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 137 | * |
| 138 | * @return BankAccount the verified bank account |
| 139 | */ |
| 140 | public function verify($params = null, $opts = null) |
| 141 | { |
| 142 | $url = $this->instanceUrl() . '/verify'; |
| 143 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 144 | $this->refreshFrom($response, $opts); |
| 145 | return $this; |
| 146 | } |
| 147 | } |
| 148 |