Class: Stripe::Card
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Card
- Extended by:
- APIOperations::List
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/stripe/resources/card.rb
Overview
You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.
Related guide: Card payments with Sources
Defined Under Namespace
Classes: Benefits, Networks, Redaction
Constant Summary collapse
- OBJECT_NAME =
"card"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Attribute for field account.
-
#address_city ⇒ Object
readonly
City/District/Suburb/Town/Village.
-
#address_country ⇒ Object
readonly
Billing address country, if provided when creating card.
-
#address_line1 ⇒ Object
readonly
Address line 1 (Street address/PO Box/Company name).
-
#address_line1_check ⇒ Object
readonly
If
address_line1was provided, results of the check:pass,fail,unavailable, orunchecked. -
#address_line2 ⇒ Object
readonly
Address line 2 (Apartment/Suite/Unit/Building).
-
#address_state ⇒ Object
readonly
State/County/Province/Region.
-
#address_zip ⇒ Object
readonly
ZIP or postal code.
-
#address_zip_check ⇒ Object
readonly
If
address_zipwas provided, results of the check:pass,fail,unavailable, orunchecked. -
#allow_redisplay ⇒ Object
readonly
This field indicates whether this payment method can be shown again to its customer in a checkout flow.
-
#available_payout_methods ⇒ Object
readonly
A set of available payout methods for this card.
-
#benefits ⇒ Object
readonly
Attribute for field benefits.
-
#brand ⇒ Object
readonly
Card brand.
-
#brand_product ⇒ Object
readonly
The product code that identifies the specific program or product associated with a card.
-
#country ⇒ Object
readonly
Two-letter ISO code representing the country of the card.
-
#currency ⇒ Object
readonly
Three-letter ISO code for currency in lowercase.
-
#customer ⇒ Object
readonly
The customer that this card belongs to.
-
#cvc_check ⇒ Object
readonly
If a CVC was provided, results of the check:
pass,fail,unavailable, orunchecked. -
#default_for_currency ⇒ Object
readonly
Whether this card is the default external account for its currency.
-
#deleted ⇒ Object
readonly
Always true for a deleted object.
-
#description ⇒ Object
readonly
A high-level description of the type of cards issued in this range.
-
#dynamic_last4 ⇒ Object
readonly
(For tokenized numbers only.) The last four digits of the device account number.
-
#exp_month ⇒ Object
readonly
Two-digit number representing the card's expiration month.
-
#exp_year ⇒ Object
readonly
Four-digit number representing the card's expiration year.
-
#fingerprint ⇒ Object
readonly
Uniquely identifies this particular card number.
-
#funding ⇒ Object
readonly
Card funding type.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#iin ⇒ Object
readonly
Issuer identification number of the card.
-
#issuer ⇒ Object
readonly
The name of the card's issuing bank.
-
#last4 ⇒ Object
readonly
The last four digits of the card.
-
#metadata ⇒ Object
readonly
Set of key-value pairs that you can attach to an object.
-
#name ⇒ Object
readonly
Cardholder name.
-
#networks ⇒ Object
readonly
Attribute for field networks.
-
#object ⇒ Object
readonly
String representing the object's type.
-
#redaction ⇒ Object
readonly
Redaction status of this card.
-
#regulated_status ⇒ Object
readonly
Status of a card based on the card issuer.
-
#status ⇒ Object
readonly
For external accounts that are cards, possible values are
newanderrored. -
#tokenization_method ⇒ Object
readonly
If the card number is tokenized, this is the method that was used.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
- .delete(id, params = {}, opts = {}) ⇒ Object
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
- .list(params = {}, opts = {}) ⇒ Object
- .object_name ⇒ Object
- .retrieve(_id, _opts = nil) ⇒ Object
- .update(_id, _params = nil, _opts = nil) ⇒ Object
Instance Method Summary collapse
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods included from APIOperations::Delete
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#account ⇒ Object (readonly)
Attribute for field account
61 62 63 |
# File 'lib/stripe/resources/card.rb', line 61 def account @account end |
#address_city ⇒ Object (readonly)
City/District/Suburb/Town/Village.
63 64 65 |
# File 'lib/stripe/resources/card.rb', line 63 def address_city @address_city end |
#address_country ⇒ Object (readonly)
Billing address country, if provided when creating card.
65 66 67 |
# File 'lib/stripe/resources/card.rb', line 65 def address_country @address_country end |
#address_line1 ⇒ Object (readonly)
Address line 1 (Street address/PO Box/Company name).
67 68 69 |
# File 'lib/stripe/resources/card.rb', line 67 def address_line1 @address_line1 end |
#address_line1_check ⇒ Object (readonly)
If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked.
69 70 71 |
# File 'lib/stripe/resources/card.rb', line 69 def address_line1_check @address_line1_check end |
#address_line2 ⇒ Object (readonly)
Address line 2 (Apartment/Suite/Unit/Building).
71 72 73 |
# File 'lib/stripe/resources/card.rb', line 71 def address_line2 @address_line2 end |
#address_state ⇒ Object (readonly)
State/County/Province/Region.
73 74 75 |
# File 'lib/stripe/resources/card.rb', line 73 def address_state @address_state end |
#address_zip ⇒ Object (readonly)
ZIP or postal code.
75 76 77 |
# File 'lib/stripe/resources/card.rb', line 75 def address_zip @address_zip end |
#address_zip_check ⇒ Object (readonly)
If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked.
77 78 79 |
# File 'lib/stripe/resources/card.rb', line 77 def address_zip_check @address_zip_check end |
#allow_redisplay ⇒ Object (readonly)
This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
79 80 81 |
# File 'lib/stripe/resources/card.rb', line 79 def allow_redisplay @allow_redisplay end |
#available_payout_methods ⇒ Object (readonly)
A set of available payout methods for this card. Only values from this set should be passed as the method when creating a payout.
81 82 83 |
# File 'lib/stripe/resources/card.rb', line 81 def available_payout_methods @available_payout_methods end |
#benefits ⇒ Object (readonly)
Attribute for field benefits
83 84 85 |
# File 'lib/stripe/resources/card.rb', line 83 def benefits @benefits end |
#brand ⇒ Object (readonly)
Card brand. Can be American Express, Cartes Bancaires, Diners Club, Discover, Eftpos Australia, Girocard, JCB, MasterCard, UnionPay, Visa, or Unknown.
85 86 87 |
# File 'lib/stripe/resources/card.rb', line 85 def brand @brand end |
#brand_product ⇒ Object (readonly)
The product code that identifies the specific program or product associated with a card. (For internal use only and not typically available in standard API requests.)
87 88 89 |
# File 'lib/stripe/resources/card.rb', line 87 def brand_product @brand_product end |
#country ⇒ Object (readonly)
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.
89 90 91 |
# File 'lib/stripe/resources/card.rb', line 89 def country @country end |
#currency ⇒ Object (readonly)
Three-letter ISO code for currency in lowercase. Must be a supported currency. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available when returned as an External Account where controller.is_controller is true.
91 92 93 |
# File 'lib/stripe/resources/card.rb', line 91 def currency @currency end |
#customer ⇒ Object (readonly)
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.
93 94 95 |
# File 'lib/stripe/resources/card.rb', line 93 def customer @customer end |
#cvc_check ⇒ Object (readonly)
If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked. 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 Check if a card is valid without a charge.
95 96 97 |
# File 'lib/stripe/resources/card.rb', line 95 def cvc_check @cvc_check end |
#default_for_currency ⇒ Object (readonly)
Whether this card is the default external account for its currency. This property is only available for accounts where controller.requirement_collection is application, which includes Custom accounts.
97 98 99 |
# File 'lib/stripe/resources/card.rb', line 97 def default_for_currency @default_for_currency end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
99 100 101 |
# File 'lib/stripe/resources/card.rb', line 99 def deleted @deleted end |
#description ⇒ Object (readonly)
A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.)
101 102 103 |
# File 'lib/stripe/resources/card.rb', line 101 def description @description end |
#dynamic_last4 ⇒ Object (readonly)
(For tokenized numbers only.) The last four digits of the device account number.
103 104 105 |
# File 'lib/stripe/resources/card.rb', line 103 def dynamic_last4 @dynamic_last4 end |
#exp_month ⇒ Object (readonly)
Two-digit number representing the card's expiration month.
105 106 107 |
# File 'lib/stripe/resources/card.rb', line 105 def exp_month @exp_month end |
#exp_year ⇒ Object (readonly)
Four-digit number representing the card's expiration year.
107 108 109 |
# File 'lib/stripe/resources/card.rb', line 107 def exp_year @exp_year end |
#fingerprint ⇒ Object (readonly)
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.
As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.
111 112 113 |
# File 'lib/stripe/resources/card.rb', line 111 def fingerprint @fingerprint end |
#funding ⇒ Object (readonly)
Card funding type. Can be credit, debit, prepaid, or unknown.
113 114 115 |
# File 'lib/stripe/resources/card.rb', line 113 def funding @funding end |
#id ⇒ Object (readonly)
Unique identifier for the object.
115 116 117 |
# File 'lib/stripe/resources/card.rb', line 115 def id @id end |
#iin ⇒ Object (readonly)
Issuer identification number of the card. (For internal use only and not typically available in standard API requests.)
117 118 119 |
# File 'lib/stripe/resources/card.rb', line 117 def iin @iin end |
#issuer ⇒ Object (readonly)
The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.)
119 120 121 |
# File 'lib/stripe/resources/card.rb', line 119 def issuer @issuer end |
#last4 ⇒ Object (readonly)
The last four digits of the card.
121 122 123 |
# File 'lib/stripe/resources/card.rb', line 121 def last4 @last4 end |
#metadata ⇒ Object (readonly)
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.
123 124 125 |
# File 'lib/stripe/resources/card.rb', line 123 def @metadata end |
#name ⇒ Object (readonly)
Cardholder name.
125 126 127 |
# File 'lib/stripe/resources/card.rb', line 125 def name @name end |
#networks ⇒ Object (readonly)
Attribute for field networks
127 128 129 |
# File 'lib/stripe/resources/card.rb', line 127 def networks @networks end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
129 130 131 |
# File 'lib/stripe/resources/card.rb', line 129 def object @object end |
#redaction ⇒ Object (readonly)
Redaction status of this card. If not null, this card is associated to a redaction job.
131 132 133 |
# File 'lib/stripe/resources/card.rb', line 131 def redaction @redaction end |
#regulated_status ⇒ Object (readonly)
Status of a card based on the card issuer.
133 134 135 |
# File 'lib/stripe/resources/card.rb', line 133 def regulated_status @regulated_status end |
#status ⇒ Object (readonly)
For external accounts that are cards, possible values are new and errored. If a payout fails, the status is set to errored and scheduled payouts are stopped until account details are updated.
135 136 137 |
# File 'lib/stripe/resources/card.rb', line 135 def status @status end |
#tokenization_method ⇒ Object (readonly)
If the card number is tokenized, this is the method that was used. Can be android_pay (includes Google Pay), apple_pay, masterpass, visa_checkout, or null.
137 138 139 |
# File 'lib/stripe/resources/card.rb', line 137 def tokenization_method @tokenization_method end |
Class Method Details
.delete(id, params = {}, opts = {}) ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/stripe/resources/card.rb', line 163 def self.delete(id, params = {}, opts = {}) raise NotImplementedError, "Card cannot be deleted without a customer ID or an account " \ "ID. Delete a card using `Customer.delete_source(" \ "'customer_id', 'card_id')` or " \ "`Account.delete_external_account('account_id', 'card_id')`" end |
.field_remappings ⇒ Object
192 193 194 |
# File 'lib/stripe/resources/card.rb', line 192 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
188 189 190 |
# File 'lib/stripe/resources/card.rb', line 188 def self.inner_class_types @inner_class_types = { benefits: Benefits, networks: Networks, redaction: Redaction } end |
.list(params = {}, opts = {}) ⇒ Object
180 181 182 183 184 185 186 |
# File 'lib/stripe/resources/card.rb', line 180 def self.list(params = {}, opts = {}) raise NotImplementedError, "Cards cannot be listed without a customer ID or an account " \ "ID. List cards using `Customer.list_sources(" \ "'customer_id')` or " \ "`Account.list_external_accounts('account_id')`" end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/card.rb', line 16 def self.object_name "card" end |
.retrieve(_id, _opts = nil) ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/stripe/resources/card.rb', line 155 def self.retrieve(_id, _opts = nil) raise NotImplementedError, "Card cannot be retrieved without a customer ID or an account " \ "ID. Retrieve a card using `Customer.retrieve_source(" \ "'customer_id', 'card_id')` or " \ "`Account.retrieve_external_account('account_id', 'card_id')`" end |
.update(_id, _params = nil, _opts = nil) ⇒ Object
147 148 149 150 151 152 153 |
# File 'lib/stripe/resources/card.rb', line 147 def self.update(_id, _params = nil, _opts = nil) raise NotImplementedError, "Card cannot be updated without a customer ID or an account ID. " \ "Update a card using `Customer.update_source('customer_id', " \ "'card_id', update_params)` or `Account.update_external_account(" \ "'account_id', 'card_id', update_params)`" end |
Instance Method Details
#delete(params = {}, opts = {}) ⇒ Object
171 172 173 174 175 176 177 178 |
# File 'lib/stripe/resources/card.rb', line 171 def delete(params = {}, opts = {}) request_stripe_object( method: :delete, path: resource_url.to_s, params: params, opts: opts ) end |
#resource_url ⇒ Object
139 140 141 142 143 144 145 |
# File 'lib/stripe/resources/card.rb', line 139 def resource_url if respond_to?(:customer) && !customer.nil? && !customer.empty? "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}" elsif respond_to?(:account) && !account.nil? && !account.empty? "#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}" end end |