-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment-methods.ts
172 lines (139 loc) · 4.45 KB
/
payment-methods.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as PaymentMethodsAPI from './payment-methods';
export class PaymentMethods extends APIResource {
/**
* Delete an existing payment method. Deleting a payment method does not invalidate
* transactions or orders that are associated with it.
*/
delete(
id: string,
params: PaymentMethodDeleteParams,
options?: Core.RequestOptions,
): Core.APIPromise<void> {
const { 'X-Publishable-Key': xPublishableKey } = params;
return this._client.delete(`/account/payment-methods/${id}`, {
...options,
headers: { Accept: '*/*', 'X-Publishable-Key': xPublishableKey, ...options?.headers },
});
}
/**
* Add a payment method to a shopper's Bolt account Wallet. For security purposes,
* this request must come from your backend because authentication requires the use
* of your private key.<br /> **Note**: Before using this API, the credit card
* details must be tokenized using Bolt's JavaScript library function, which is
* documented in
* [Install the Bolt Tokenizer](https://help.bolt.com/developers/references/bolt-tokenizer).
*/
accountAddPaymentMethod(
params: PaymentMethodAccountAddPaymentMethodParams,
options?: Core.RequestOptions,
): Core.APIPromise<PaymentMethodAccountAddPaymentMethodResponse> {
const { 'X-Publishable-Key': xPublishableKey, ...body } = params;
return this._client.post('/account/payment-methods', {
body,
...options,
headers: { 'X-Publishable-Key': xPublishableKey, ...options?.headers },
});
}
}
export interface PaymentMethodAccountAddPaymentMethodResponse {
'.tag': 'credit_card';
/**
* The expiration date of the credit card. TODO TO MAKE EXPIRATION REUSABLE
*/
expiration: string;
/**
* The last 4 digits of the credit card number.
*/
last4: string;
/**
* The credit card network.
*/
network: 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'unionpay' | 'alliancedata' | 'citiplcc';
id?: string;
/**
* The ID of credit card's billing address
*/
billing_address_id?: string;
}
export interface PaymentMethodDeleteParams {
/**
* The publicly viewable identifier used to identify a merchant division.
*/
'X-Publishable-Key': string;
}
export interface PaymentMethodAccountAddPaymentMethodParams {
/**
* Body param: The Bolt token associated to the credit card.
*/
token: string;
/**
* Body param:
*/
'.tag': 'credit_card';
/**
* Body param: The credit card's billing address
*/
billing_address:
| PaymentMethodAccountAddPaymentMethodParams.AddressReferenceID
| PaymentMethodAccountAddPaymentMethodParams.AddressReferenceExplicit;
/**
* Body param: The Bank Identification Number for the credit card. This is
* typically the first 4-6 digits of the credit card number.
*/
bin: string;
/**
* Body param: The expiration date of the credit card. TODO TO MAKE EXPIRATION
* REUSABLE
*/
expiration: string;
/**
* Body param: The last 4 digits of the credit card number.
*/
last4: string;
/**
* Body param: The credit card network.
*/
network: 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'unionpay' | 'alliancedata' | 'citiplcc';
/**
* Header param: The publicly viewable identifier used to identify a merchant
* division.
*/
'X-Publishable-Key': string;
}
export namespace PaymentMethodAccountAddPaymentMethodParams {
export interface AddressReferenceID {
/**
* The address's ID
*/
id: string;
/**
* The type of address reference
*/
'.tag': 'id';
}
export interface AddressReferenceExplicit {
/**
* The type of address reference
*/
'.tag': 'explicit';
country_code: string;
first_name: string;
last_name: string;
locality: string;
postal_code: string;
street_address1: string;
company?: string;
email?: string;
phone?: string;
region?: string;
street_address2?: string;
}
}
export namespace PaymentMethods {
export import PaymentMethodAccountAddPaymentMethodResponse = PaymentMethodsAPI.PaymentMethodAccountAddPaymentMethodResponse;
export import PaymentMethodDeleteParams = PaymentMethodsAPI.PaymentMethodDeleteParams;
export import PaymentMethodAccountAddPaymentMethodParams = PaymentMethodsAPI.PaymentMethodAccountAddPaymentMethodParams;
}