ApiOperations
2 years ago
BillingPortal
2 years ago
Checkout
2 years ago
Exception
4 years ago
FinancialConnections
2 years ago
HttpClient
2 years ago
Identity
2 years ago
Issuing
2 years ago
Radar
2 years ago
Reporting
4 years ago
Service
2 years ago
Sigma
4 years ago
Terminal
2 years ago
TestHelpers
2 years ago
Util
2 years ago
Account.php
2 years ago
AccountLink.php
4 years ago
AlipayAccount.php
4 years ago
ApiRequestor.php
2 years ago
ApiResource.php
2 years ago
ApiResponse.php
4 years ago
ApplePayDomain.php
4 years ago
ApplicationFee.php
2 years ago
ApplicationFeeRefund.php
4 years ago
Balance.php
4 years ago
BalanceTransaction.php
4 years ago
BankAccount.php
4 years ago
BaseStripeClient.php
2 years ago
BaseStripeClientInterface.php
4 years ago
BitcoinReceiver.php
2 years ago
BitcoinTransaction.php
4 years ago
Capability.php
4 years ago
Card.php
2 years ago
CashBalance.php
2 years ago
Charge.php
2 years ago
Collection.php
2 years ago
CountrySpec.php
4 years ago
Coupon.php
2 years ago
CreditNote.php
2 years ago
CreditNoteLineItem.php
4 years ago
Customer.php
2 years ago
CustomerBalanceTransaction.php
4 years ago
Discount.php
2 years ago
Dispute.php
4 years ago
EphemeralKey.php
4 years ago
ErrorObject.php
4 years ago
Event.php
2 years ago
ExchangeRate.php
4 years ago
File.php
2 years ago
FileLink.php
4 years ago
FundingInstructions.php
2 years ago
Invoice.php
2 years ago
InvoiceItem.php
2 years ago
InvoiceLineItem.php
2 years ago
LineItem.php
4 years ago
LoginLink.php
4 years ago
Mandate.php
4 years ago
OAuth.php
4 years ago
OAuthErrorObject.php
4 years ago
Order.php
2 years ago
OrderItem.php
4 years ago
OrderReturn.php
4 years ago
PaymentIntent.php
2 years ago
PaymentLink.php
2 years ago
PaymentMethod.php
2 years ago
Payout.php
4 years ago
Person.php
2 years ago
Plan.php
2 years ago
Price.php
2 years ago
Product.php
2 years ago
PromotionCode.php
2 years ago
Quote.php
2 years ago
Recipient.php
2 years ago
RecipientTransfer.php
4 years ago
Refund.php
2 years ago
RequestTelemetry.php
4 years ago
Review.php
4 years ago
SKU.php
2 years ago
SearchResult.php
2 years ago
SetupAttempt.php
4 years ago
SetupIntent.php
2 years ago
ShippingRate.php
2 years ago
SingletonApiResource.php
2 years ago
Source.php
4 years ago
SourceTransaction.php
4 years ago
Stripe.php
2 years ago
StripeClient.php
2 years ago
StripeClientInterface.php
4 years ago
StripeObject.php
2 years ago
StripeStreamingClientInterface.php
4 years ago
Subscription.php
2 years ago
SubscriptionItem.php
2 years ago
SubscriptionSchedule.php
2 years ago
TaxCode.php
2 years ago
TaxId.php
2 years ago
TaxRate.php
4 years ago
ThreeDSecure.php
4 years ago
Token.php
4 years ago
Topup.php
4 years ago
Transfer.php
2 years ago
TransferReversal.php
4 years ago
UsageRecord.php
4 years ago
UsageRecordSummary.php
4 years ago
Webhook.php
4 years ago
WebhookEndpoint.php
4 years ago
WebhookSignature.php
4 years ago
Card.php
144 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | |
| 5 | namespace Stripe; |
| 6 | |
| 7 | /** |
| 8 | * You can store multiple cards on a customer in order to charge the customer |
| 9 | * later. You can also store multiple debit cards on a recipient in order to |
| 10 | * transfer to those cards later. |
| 11 | * |
| 12 | * Related guide: <a href="https://stripe.com/docs/sources/cards">Card Payments |
| 13 | * with Sources</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 account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. |
| 18 | * @property null|string $address_city City/District/Suburb/Town/Village. |
| 19 | * @property null|string $address_country Billing address country, if provided when creating card. |
| 20 | * @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name). |
| 21 | * @property null|string $address_line1_check If <code>address_line1</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. |
| 22 | * @property null|string $address_line2 Address line 2 (Apartment/Suite/Unit/Building). |
| 23 | * @property null|string $address_state State/County/Province/Region. |
| 24 | * @property null|string $address_zip ZIP or postal code. |
| 25 | * @property null|string $address_zip_check If <code>address_zip</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. |
| 26 | * @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the <code>method</code> when creating a payout. |
| 27 | * @property string $brand Card brand. Can be <code>American Express</code>, <code>Diners Club</code>, <code>Discover</code>, <code>JCB</code>, <code>MasterCard</code>, <code>UnionPay</code>, <code>Visa</code>, or <code>Unknown</code>. |
| 28 | * @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. |
| 29 | * @property null|string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. |
| 30 | * @property null|string|\Stripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. |
| 31 | * @property null|string $cvc_check If a CVC was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see <a href="https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge">Check if a card is valid without a charge</a>. |
| 32 | * @property null|bool $default_for_currency Whether this card is the default external account for its currency. |
| 33 | * @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number. |
| 34 | * @property int $exp_month Two-digit number representing the card's expiration month. |
| 35 | * @property int $exp_year Four-digit number representing the card's expiration year. |
| 36 | * @property null|string $fingerprint <p>Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.</p><p><em>Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.</em></p> |
| 37 | * @property string $funding Card funding type. Can be <code>credit</code>, <code>debit</code>, <code>prepaid</code>, or <code>unknown</code>. |
| 38 | * @property string $last4 The last four digits of the card. |
| 39 | * @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. |
| 40 | * @property null|string $name Cardholder name. |
| 41 | * @property null|string|\Stripe\Recipient $recipient The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead. |
| 42 | * @property null|string $status For external accounts, possible values are <code>new</code> and <code>errored</code>. If a transfer fails, the status is set to <code>errored</code> and transfers are stopped until account details are updated. |
| 43 | * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be <code>android_pay</code> (includes Google Pay), <code>apple_pay</code>, <code>masterpass</code>, <code>visa_checkout</code>, or null. |
| 44 | */ |
| 45 | class Card extends ApiResource |
| 46 | { |
| 47 | const OBJECT_NAME = 'card'; |
| 48 | |
| 49 | use ApiOperations\Delete; |
| 50 | use ApiOperations\Update; |
| 51 | |
| 52 | /** |
| 53 | * Possible string representations of the CVC check status. |
| 54 | * |
| 55 | * @see https://stripe.com/docs/api/cards/object#card_object-cvc_check |
| 56 | */ |
| 57 | const CVC_CHECK_FAIL = 'fail'; |
| 58 | const CVC_CHECK_PASS = 'pass'; |
| 59 | const CVC_CHECK_UNAVAILABLE = 'unavailable'; |
| 60 | const CVC_CHECK_UNCHECKED = 'unchecked'; |
| 61 | |
| 62 | /** |
| 63 | * Possible string representations of the funding of the card. |
| 64 | * |
| 65 | * @see https://stripe.com/docs/api/cards/object#card_object-funding |
| 66 | */ |
| 67 | const FUNDING_CREDIT = 'credit'; |
| 68 | const FUNDING_DEBIT = 'debit'; |
| 69 | const FUNDING_PREPAID = 'prepaid'; |
| 70 | const FUNDING_UNKNOWN = 'unknown'; |
| 71 | |
| 72 | /** |
| 73 | * Possible string representations of the tokenization method when using Apple Pay or Google Pay. |
| 74 | * |
| 75 | * @see https://stripe.com/docs/api/cards/object#card_object-tokenization_method |
| 76 | */ |
| 77 | const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay'; |
| 78 | const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay'; |
| 79 | |
| 80 | /** |
| 81 | * @return string The instance URL for this resource. It needs to be special |
| 82 | * cased because cards are nested resources that may belong to different |
| 83 | * top-level resources. |
| 84 | */ |
| 85 | public function instanceUrl() |
| 86 | { |
| 87 | if ($this['customer']) { |
| 88 | $base = Customer::classUrl(); |
| 89 | $parent = $this['customer']; |
| 90 | $path = 'sources'; |
| 91 | } elseif ($this['account']) { |
| 92 | $base = Account::classUrl(); |
| 93 | $parent = $this['account']; |
| 94 | $path = 'external_accounts'; |
| 95 | } elseif ($this['recipient']) { |
| 96 | $base = Recipient::classUrl(); |
| 97 | $parent = $this['recipient']; |
| 98 | $path = 'cards'; |
| 99 | } else { |
| 100 | $msg = 'Cards cannot be accessed without a customer ID, account ID or recipient ID.'; |
| 101 | |
| 102 | throw new Exception\UnexpectedValueException($msg); |
| 103 | } |
| 104 | $parentExtn = \urlencode(Util\Util::utf8($parent)); |
| 105 | $extn = \urlencode(Util\Util::utf8($this['id'])); |
| 106 | |
| 107 | return "{$base}/{$parentExtn}/{$path}/{$extn}"; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @param array|string $_id |
| 112 | * @param null|array|string $_opts |
| 113 | * |
| 114 | * @throws \Stripe\Exception\BadMethodCallException |
| 115 | */ |
| 116 | public static function retrieve($_id, $_opts = null) |
| 117 | { |
| 118 | $msg = 'Cards cannot be retrieved without a customer ID or an ' . |
| 119 | 'account ID. Retrieve a card using ' . |
| 120 | "`Customer::retrieveSource('customer_id', 'card_id')` or " . |
| 121 | "`Account::retrieveExternalAccount('account_id', 'card_id')`."; |
| 122 | |
| 123 | throw new Exception\BadMethodCallException($msg); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * @param string $_id |
| 128 | * @param null|array $_params |
| 129 | * @param null|array|string $_options |
| 130 | * |
| 131 | * @throws \Stripe\Exception\BadMethodCallException |
| 132 | */ |
| 133 | public static function update($_id, $_params = null, $_options = null) |
| 134 | { |
| 135 | $msg = 'Cards cannot be updated without a customer ID or an ' . |
| 136 | 'account ID. Update a card using ' . |
| 137 | "`Customer::updateSource('customer_id', 'card_id', " . |
| 138 | '$updateParams)` or `Account::updateExternalAccount(' . |
| 139 | "'account_id', 'card_id', \$updateParams)`."; |
| 140 | |
| 141 | throw new Exception\BadMethodCallException($msg); |
| 142 | } |
| 143 | } |
| 144 |