forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stripe.d.ts
66 lines (60 loc) · 1.73 KB
/
stripe.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Type definitions for stripe
// Project: https://stripe.com/
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface StripeStatic {
setPublishableKey(key: string): void;
validateCardNumber(cardNumber: string): boolean;
validateExpiry(month: string, year: string): boolean;
validateCVC(cardCVC: string): boolean;
cardType(cardNumber: string): string;
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
card: StripeCardData;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
}
interface StripeTokenData {
number: string;
exp_month: number;
exp_year: number;
cvc?: string;
name?: string;
address_line1?: string;
address_line2?: string;
address_city?: string;
address_state?: string;
address_zip?: string;
address_country?: string;
}
interface StripeTokenResponse {
id: string;
card: StripeCardData;
created: number;
currency: string;
livemode: boolean;
object: string;
used: boolean;
error: StripeError;
}
interface StripeError {
message: string;
}
interface StripeCardData {
object: string;
last4: string;
type: string;
exp_month: number;
exp_year: number;
fingerprint: string;
country?: string;
name?: string;
address_line1?: string;
address_line2?: string;
address_city?: string;
address_state?: string;
address_zip?: string;
address_country?: string;
}
declare var Stripe: StripeStatic;
declare module "Stripe" {
export = StripeStatic;
}