UNPKG

8.87 kBTypeScriptView Raw
1import {Metadata, MetadataParam, Address} from './shared';
2
3/**
4 * The PaymentMethod object.
5 */
6export interface PaymentMethod {
7 /**
8 * Unique identifier for the object.
9 */
10 id: string;
11
12 /**
13 * String representing the object's type. Objects of the same type share the same value.
14 */
15 object: 'payment_method';
16
17 billing_details: PaymentMethod.BillingDetails;
18
19 card?: PaymentMethod.Card;
20
21 card_present?: PaymentMethod.CardPresent;
22
23 /**
24 * Time at which the object was created. Measured in seconds since the Unix epoch.
25 */
26 created: number;
27
28 /**
29 * The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.
30 */
31 customer: string | null;
32
33 eps?: PaymentMethod.Eps;
34
35 fpx?: PaymentMethod.Fpx;
36
37 grabpay?: PaymentMethod.GrabPay;
38
39 ideal?: PaymentMethod.Ideal;
40
41 p24?: PaymentMethod.P24;
42
43 /**
44 * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
45 */
46 livemode: boolean;
47
48 /**
49 * 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.
50 */
51 metadata: Metadata;
52
53 sepa_debit?: PaymentMethod.SepaDebit;
54
55 /**
56 * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
57 */
58 type: string;
59
60 affirm?: PaymentMethod.Affirm;
61
62 afterpay_clearpay?: PaymentMethod.AfterpayClearpay;
63
64 acss_debit?: PaymentMethod.AcssDebit;
65
66 au_becs_debit?: PaymentMethod.AuBecsDebit;
67
68 us_bank_account?: PaymentMethod.UsBankAccount;
69}
70
71export namespace PaymentMethod {
72 export interface AuBecsDebit {
73 /**
74 * Bank State Branch
75 */
76 bsb_number: string | null;
77
78 /**
79 * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
80 */
81 fingerprint: string | null;
82
83 /**
84 * Last four characters of the account number.
85 */
86 last4: string | null;
87 }
88
89 export interface BillingDetails {
90 /**
91 * Billing address.
92 */
93 address: Address | null;
94
95 /**
96 * Email address.
97 */
98 email: string | null;
99
100 /**
101 * Full name.
102 */
103 name: string | null;
104
105 /**
106 * Billing phone number (including extension).
107 */
108 phone: string | null;
109 }
110
111 export interface Card {
112 /**
113 * Card brand. Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
114 */
115 brand: string;
116
117 /**
118 * Checks on Card address and CVC if provided.
119 */
120 checks: Card.Checks | null;
121
122 /**
123 * 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.
124 */
125 country: string | null;
126
127 /**
128 * Two-digit number representing the card's expiration month.
129 */
130 exp_month: number;
131
132 /**
133 * Four-digit number representing the card's expiration year.
134 */
135 exp_year: number;
136
137 /**
138 * 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.
139 */
140 fingerprint?: string | null;
141
142 /**
143 * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
144 */
145 funding: string;
146
147 /**
148 * The last four digits of the card.
149 */
150 last4: string;
151
152 /**
153 * Contains details on how this Card maybe be used for 3D Secure authentication.
154 */
155 three_d_secure_usage: Card.ThreeDSecureUsage | null;
156
157 /**
158 * If this Card is part of a card wallet, this contains the details of the card wallet.
159 */
160 wallet: null | {[k: string]: any};
161 }
162
163 export namespace Card {
164 export interface Checks {
165 /**
166 * If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
167 */
168 address_line1_check: string | null;
169
170 /**
171 * If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
172 */
173 address_postal_code_check: string | null;
174
175 /**
176 * If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
177 */
178 cvc_check: string | null;
179 }
180
181 export interface ThreeDSecureUsage {
182 /**
183 * Whether 3D Secure is supported on this card.
184 */
185 supported: boolean;
186 }
187 }
188
189 export interface CardPresent {}
190
191 export interface Eps {
192 /**
193 * The customer's bank.
194 */
195 bank: string;
196 }
197
198 export interface Fpx {
199 /**
200 * The customer's bank.
201 */
202 bank: string;
203 }
204
205 export interface GrabPay {}
206
207 export interface Ideal {
208 /**
209 * The customer's bank, if provided.
210 */
211 bank: string | null;
212
213 /**
214 * The Bank Identifier Code of the customer's bank, if the bank was provided.
215 */
216 bic: string | null;
217 }
218
219 export interface P24 {
220 /**
221 * The customer's bank.
222 */
223 bank: string;
224 }
225
226 export interface SepaDebit {
227 /**
228 * Bank code of bank associated with the bank account.
229 */
230 bank_code: string | null;
231
232 /**
233 * Branch code of bank associated with the bank account.
234 */
235 branch_code: string | null;
236
237 /**
238 * Two-letter ISO code representing the country the bank account is located in.
239 */
240 country: string | null;
241
242 /**
243 * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
244 */
245 fingerprint: string | null;
246
247 /**
248 * Last four characters of the IBAN.
249 */
250 last4: string | null;
251 }
252
253 export interface Affirm {}
254
255 export interface AfterpayClearpay {}
256
257 export interface AcssDebit {
258 /**
259 * Customer’s bank account number.
260 */
261 account_number: string;
262
263 /**
264 * Institution number of the customer’s bank.
265 */
266 institution_number: string;
267
268 /**
269 * Transit number of the customer’s bank.
270 */
271 transit_number: string;
272 }
273
274 export interface UsBankAccount {
275 /**
276 * Customer’s bank account number.
277 */
278 account_number: string;
279
280 /**
281 * The routing transit number for the bank account.
282 */
283 routing_number: string;
284
285 /**
286 * The type of entity that holds the account. This can be either `individual` or `company`.
287 */
288 account_holder_type: string;
289
290 /**
291 * Account type: checkings or savings. Defaults to checking if omitted.
292 */
293 account_type: string;
294 }
295}
296
297export interface PaymentMethodCreateParams {
298 /**
299 * Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
300 */
301 billing_details?: PaymentMethodCreateParams.BillingDetails;
302
303 /**
304 * 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
305 */
306 metadata?: MetadataParam;
307
308 /**
309 * The PaymentMethod to share.
310 */
311 payment_method?: string;
312
313 /**
314 * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. Required unless `payment_method` is specified (see the [Cloning PaymentMethods](https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods) guide)
315 */
316 type?: string;
317}
318
319export namespace PaymentMethodCreateParams {
320 export interface BillingDetails {
321 /**
322 * Billing address.
323 */
324 address?: BillingDetails.Address;
325
326 /**
327 * Email address.
328 */
329 email?: string;
330
331 /**
332 * Full name.
333 */
334 name?: string;
335
336 /**
337 * Billing phone number (including extension).
338 */
339 phone?: string;
340 }
341
342 export namespace BillingDetails {
343 export interface Address {
344 /**
345 * City, district, suburb, town, or village.
346 */
347 city?: string;
348
349 /**
350 * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
351 */
352 country?: string;
353
354 /**
355 * Address line 1 (e.g., street, PO Box, or company name).
356 */
357 line1?: string;
358
359 /**
360 * Address line 2 (e.g., apartment, suite, unit, or building).
361 */
362 line2?: string;
363
364 /**
365 * ZIP or postal code.
366 */
367 postal_code?: string;
368
369 /**
370 * State, county, province, or region.
371 */
372 state?: string;
373 }
374 }
375}