-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathwebhooks.ts
More file actions
2981 lines (2552 loc) · 84.3 KB
/
webhooks.ts
File metadata and controls
2981 lines (2552 loc) · 84.3 KB
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { getRequiredHeader, HeadersLike } from '../internal/headers';
import { APIResource } from '../core/resource';
import { Webhook } from 'standardwebhooks';
import * as BookTransfersAPI from './book-transfers';
import * as DisputesAPI from './disputes';
import * as DisputesV2API from './disputes-v2';
import * as ExternalPaymentsAPI from './external-payments';
import * as FundingEventsAPI from './funding-events';
import * as InternalTransactionAPI from './internal-transaction';
import * as ManagementOperationsAPI from './management-operations';
import * as PaymentsAPI from './payments';
import * as Shared from './shared';
import * as TokenizationsAPI from './tokenizations';
import * as AccountHoldersAPI from './account-holders/account-holders';
import * as ExternalBankAccountsAPI from './external-bank-accounts/external-bank-accounts';
import * as FinancialAccountsAPI from './financial-accounts/financial-accounts';
import * as LoanTapesAPI from './financial-accounts/loan-tapes';
import * as ReportsAPI from './reports/reports';
import * as ThreeDSAPI from './three-ds/three-ds';
import * as TransactionsAPI from './transactions/transactions';
import * as BacktestsAPI from './auth-rules/v2/backtests';
import * as StatementsAPI from './financial-accounts/statements/statements';
import * as EnhancedCommercialDataAPI from './transactions/events/enhanced-commercial-data';
export class Webhooks extends APIResource {
/**
* Validates that the given payload was sent by Lithic and parses the payload.
*/
unwrap(
payload: string,
headers: HeadersLike,
secret: string | undefined | null = this._client.webhookSecret,
): Object {
this.verifySignature(payload, headers, secret);
return JSON.parse(payload);
}
/**
* Validates that the given payload was sent by Lithic and parses the payload as a typed webhook event.
*/
parse(
body: string,
{ headers, secret }: { headers: Record<string, string>; secret?: string },
): ParsedWebhookEvent {
if (headers !== undefined) {
const secretStr: string | null = secret === undefined ? this._client.webhookSecret : secret;
if (secretStr === null) throw new Error('Webhook secret must not be null in order to unwrap');
this.verifySignature(body, headers, secretStr);
}
return JSON.parse(body) as ParsedWebhookEvent;
}
/**
* Parses the payload without validating the signature.
* WARNING: This is unsafe and should only be used for testing or if you have already validated the signature.
*/
parseUnsafe(body: string): ParsedWebhookEvent {
return JSON.parse(body) as ParsedWebhookEvent;
}
/**
* Validates whether or not the webhook payload was sent by Lithic.
*
* An error will be raised if the webhook payload was not sent by Lithic.
*/
verifySignature(
body: string,
headers: HeadersLike,
secret: string | undefined | null = this._client.webhookSecret,
): void {
const secretStr: string | null = secret === undefined ? this._client.webhookSecret : secret;
if (secretStr === null) {
throw new Error(
"The webhook secret must either be set using the env var, LITHIC_WEBHOOK_SECRET, on the client class, Lithic({ webhook_secret: '123' }), or passed to this function",
);
}
const wh = new Webhook(secretStr);
// Convert HeadersLike to Record<string, string> for standardwebhooks
const headersRecord: Record<string, string> = {
'webhook-id': getRequiredHeader(headers, 'webhook-id'),
'webhook-timestamp': getRequiredHeader(headers, 'webhook-timestamp'),
'webhook-signature': getRequiredHeader(headers, 'webhook-signature'),
};
wh.verify(body, headersRecord);
}
}
export interface AccountHolderCreatedWebhookEvent {
/**
* The type of event that occurred.
*/
event_type: 'account_holder.created';
/**
* The token of the account_holder that was created.
*/
token?: string;
/**
* The token of the account that was created.
*/
account_token?: string;
/**
* When the account_holder was created
*/
created?: string;
required_documents?: Array<AccountHoldersAPI.RequiredDocument>;
/**
* The status of the account_holder that was created.
*/
status?: 'ACCEPTED' | 'PENDING_REVIEW';
status_reason?: Array<string>;
}
/**
* KYB payload for an updated account holder.
*/
export type AccountHolderUpdatedWebhookEvent =
| AccountHolderUpdatedWebhookEvent.KYBPayload
| AccountHolderUpdatedWebhookEvent.KYCPayload
| AccountHolderUpdatedWebhookEvent.LegacyPayload;
export namespace AccountHolderUpdatedWebhookEvent {
/**
* KYB payload for an updated account holder.
*/
export interface KYBPayload {
/**
* The token of the account_holder that was created.
*/
token: string;
/**
* Original request to update the account holder.
*/
update_request: KYBPayload.UpdateRequest;
/**
* The type of event that occurred.
*/
event_type?: 'account_holder.updated';
/**
* A user provided id that can be used to link an account holder with an external
* system
*/
external_id?: string;
/**
* 6-digit North American Industry Classification System (NAICS) code for the
* business. Only present if naics_code was included in the update request.
*/
naics_code?: string;
/**
* Short description of the company's line of business (i.e., what does the company
* do?). Values longer than 255 characters will be truncated before KYB
* verification
*/
nature_of_business?: string;
/**
* Company website URL.
*/
website_url?: string;
}
export namespace KYBPayload {
/**
* Original request to update the account holder.
*/
export interface UpdateRequest {
/**
* You must submit a list of all direct and indirect individuals with 25% or more
* ownership in the company. A maximum of 4 beneficial owners can be submitted. If
* no individual owns 25% of the company you do not need to send beneficial owner
* information. See
* [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
* (Section I) for more background on individuals that should be included.
*/
beneficial_owner_individuals?: Array<UpdateRequest.BeneficialOwnerIndividual>;
/**
* Information for business for which the account is being opened and KYB is being
* run.
*/
business_entity?: AccountHoldersAPI.KYBBusinessEntity;
/**
* An individual with significant responsibility for managing the legal entity
* (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating
* Officer, Managing Member, General Partner, President, Vice President, or
* Treasurer). This can be an executive, or someone who will have program-wide
* access to the cards that Lithic will provide. In some cases, this individual
* could also be a beneficial owner listed above. See
* [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
* (Section II) for more background.
*/
control_person?: UpdateRequest.ControlPerson;
}
export namespace UpdateRequest {
export interface BeneficialOwnerIndividual {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
address?: BeneficialOwnerIndividual.Address;
/**
* Individual's date of birth, as an RFC 3339 date.
*/
dob?: string;
/**
* Individual's email address. If utilizing Lithic for chargeback processing, this
* customer email address may be used to communicate dispute status and resolution.
*/
email?: string;
/**
* Individual's first name, as it appears on government-issued identity documents.
*/
first_name?: string;
/**
* Individual's last name, as it appears on government-issued identity documents.
*/
last_name?: string;
/**
* Individual's phone number, entered in E.164 format.
*/
phone_number?: string;
}
export namespace BeneficialOwnerIndividual {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
export interface Address {
/**
* Valid deliverable address (no PO boxes).
*/
address1: string;
/**
* Name of city.
*/
city: string;
/**
* Valid country code. Only USA is currently supported, entered in uppercase ISO
* 3166-1 alpha-3 three-character format.
*/
country: string;
/**
* Valid postal code. Only USA ZIP codes are currently supported, entered as a
* five-digit ZIP or nine-digit ZIP+4.
*/
postal_code: string;
/**
* Valid state code. Only USA state codes are currently supported, entered in
* uppercase ISO 3166-2 two-character format.
*/
state: string;
/**
* Unit or apartment number (if applicable).
*/
address2?: string;
}
}
/**
* An individual with significant responsibility for managing the legal entity
* (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating
* Officer, Managing Member, General Partner, President, Vice President, or
* Treasurer). This can be an executive, or someone who will have program-wide
* access to the cards that Lithic will provide. In some cases, this individual
* could also be a beneficial owner listed above. See
* [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf)
* (Section II) for more background.
*/
export interface ControlPerson {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
address?: ControlPerson.Address;
/**
* Individual's date of birth, as an RFC 3339 date.
*/
dob?: string;
/**
* Individual's email address. If utilizing Lithic for chargeback processing, this
* customer email address may be used to communicate dispute status and resolution.
*/
email?: string;
/**
* Individual's first name, as it appears on government-issued identity documents.
*/
first_name?: string;
/**
* Individual's last name, as it appears on government-issued identity documents.
*/
last_name?: string;
/**
* Individual's phone number, entered in E.164 format.
*/
phone_number?: string;
}
export namespace ControlPerson {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
export interface Address {
/**
* Valid deliverable address (no PO boxes).
*/
address1: string;
/**
* Name of city.
*/
city: string;
/**
* Valid country code. Only USA is currently supported, entered in uppercase ISO
* 3166-1 alpha-3 three-character format.
*/
country: string;
/**
* Valid postal code. Only USA ZIP codes are currently supported, entered as a
* five-digit ZIP or nine-digit ZIP+4.
*/
postal_code: string;
/**
* Valid state code. Only USA state codes are currently supported, entered in
* uppercase ISO 3166-2 two-character format.
*/
state: string;
/**
* Unit or apartment number (if applicable).
*/
address2?: string;
}
}
}
}
/**
* KYC payload for an updated account holder.
*/
export interface KYCPayload {
/**
* The token of the account_holder that was created.
*/
token: string;
/**
* Original request to update the account holder.
*/
update_request: KYCPayload.UpdateRequest;
/**
* The type of event that occurred.
*/
event_type?: 'account_holder.updated';
/**
* A user provided id that can be used to link an account holder with an external
* system
*/
external_id?: string;
}
export namespace KYCPayload {
/**
* Original request to update the account holder.
*/
export interface UpdateRequest {
/**
* Information on the individual for whom the account is being opened and KYC is
* being run.
*/
individual?: UpdateRequest.Individual;
}
export namespace UpdateRequest {
/**
* Information on the individual for whom the account is being opened and KYC is
* being run.
*/
export interface Individual {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
address?: Individual.Address;
/**
* Individual's date of birth, as an RFC 3339 date.
*/
dob?: string;
/**
* Individual's email address. If utilizing Lithic for chargeback processing, this
* customer email address may be used to communicate dispute status and resolution.
*/
email?: string;
/**
* Individual's first name, as it appears on government-issued identity documents.
*/
first_name?: string;
/**
* Individual's last name, as it appears on government-issued identity documents.
*/
last_name?: string;
/**
* Individual's phone number, entered in E.164 format.
*/
phone_number?: string;
}
export namespace Individual {
/**
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not
* acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
*/
export interface Address {
/**
* Valid deliverable address (no PO boxes).
*/
address1: string;
/**
* Name of city.
*/
city: string;
/**
* Valid country code. Only USA is currently supported, entered in uppercase ISO
* 3166-1 alpha-3 three-character format.
*/
country: string;
/**
* Valid postal code. Only USA ZIP codes are currently supported, entered as a
* five-digit ZIP or nine-digit ZIP+4.
*/
postal_code: string;
/**
* Valid state code. Only USA state codes are currently supported, entered in
* uppercase ISO 3166-2 two-character format.
*/
state: string;
/**
* Unit or apartment number (if applicable).
*/
address2?: string;
}
}
}
}
/**
* Legacy payload for an updated account holder.
*/
export interface LegacyPayload {
/**
* The token of the account_holder that was created.
*/
token: string;
/**
* If applicable, represents the business account token associated with the
* account_holder.
*/
business_account_token?: string | null;
/**
* When the account_holder updated event was created
*/
created?: string;
/**
* If updated, the newly updated email associated with the account_holder otherwise
* the existing email is provided.
*/
email?: string;
/**
* The type of event that occurred.
*/
event_type?: 'account_holder.updated';
/**
* If applicable, represents the external_id associated with the account_holder.
*/
external_id?: string | null;
/**
* If applicable, represents the account_holder's first name.
*/
first_name?: string;
/**
* If applicable, represents the account_holder's last name.
*/
last_name?: string;
/**
* If applicable, represents the account_holder's business name.
*/
legal_business_name?: string;
/**
* If updated, the newly updated phone_number associated with the account_holder
* otherwise the existing phone_number is provided.
*/
phone_number?: string;
}
}
export interface AccountHolderVerificationWebhookEvent {
/**
* The type of event that occurred.
*/
event_type: 'account_holder.verification';
/**
* The token of the account_holder being verified.
*/
token?: string;
/**
* The token of the account being verified.
*/
account_token?: string;
/**
* When the account_holder verification status was updated
*/
created?: string;
/**
* The status of the account_holder that was created
*/
status?: 'ACCEPTED' | 'PENDING_REVIEW' | 'REJECTED';
status_reasons?: Array<string>;
}
export interface AccountHolderDocumentUpdatedWebhookEvent {
/**
* The type of event that occurred.
*/
event_type: 'account_holder_document.updated';
/**
* The token of the account holder document
*/
token?: string;
/**
* The token of the account_holder that the document belongs to
*/
account_holder_token?: string;
/**
* When the account_holder was created
*/
created?: string;
/**
* Type of documentation to be submitted for verification of an account holder
*/
document_type?:
| 'DRIVERS_LICENSE'
| 'PASSPORT'
| 'PASSPORT_CARD'
| 'EIN_LETTER'
| 'TAX_RETURN'
| 'OPERATING_AGREEMENT'
| 'CERTIFICATE_OF_FORMATION'
| 'CERTIFICATE_OF_GOOD_STANDING'
| 'ARTICLES_OF_INCORPORATION'
| 'ARTICLES_OF_ORGANIZATION'
| 'BYLAWS'
| 'GOVERNMENT_BUSINESS_LICENSE'
| 'PARTNERSHIP_AGREEMENT'
| 'SS4_FORM'
| 'BANK_STATEMENT'
| 'UTILITY_BILL_STATEMENT'
| 'SSN_CARD'
| 'ITIN_LETTER'
| 'FINCEN_BOI_REPORT';
/**
* The token of the entity that the document belongs to
*/
entity_token?: string;
required_document_uploads?: Array<AccountHolderDocumentUpdatedWebhookEvent.RequiredDocumentUpload>;
}
export namespace AccountHolderDocumentUpdatedWebhookEvent {
/**
* A document upload that belongs to the overall account holder document
*/
export interface RequiredDocumentUpload {
/**
* The token of the document upload
*/
token?: string;
accepted_entity_status_reasons?: Array<string>;
/**
* When the document upload was created
*/
created?: string;
/**
* The type of image that was uploaded
*/
image_type?: 'FRONT' | 'BACK';
rejected_entity_status_reasons?: Array<string>;
/**
* The status of the document upload
*/
status?: 'ACCEPTED' | 'REJECTED' | 'PENDING_UPLOAD' | 'UPLOADED' | 'PARTIAL_APPROVAL';
status_reasons?: Array<string>;
/**
* When the document upload was last updated
*/
updated?: string;
}
}
export interface CardAuthorizationApprovalRequestWebhookEvent {
/**
* The provisional transaction group uuid associated with the authorization
*/
token: string;
/**
* Fee (in cents) assessed by the merchant and paid for by the cardholder. Will be
* zero if no fee is assessed. Rebates may be transmitted as a negative value to
* indicate credited fees.
*/
acquirer_fee: number;
/**
* @deprecated Deprecated, use `amounts`. Authorization amount of the transaction
* (in cents), including any acquirer fees. The contents of this field are
* identical to `authorization_amount`.
*/
amount: number;
/**
* Structured amounts for this authorization. The `cardholder` and `merchant`
* amounts reflect the original network authorization values. For programs with
* hold adjustments enabled (e.g., automated fuel dispensers or tipping MCCs), the
* `hold` amount may exceed the `cardholder` and `merchant` amounts to account for
* anticipated final transaction amounts such as tips or fuel fill-ups
*/
amounts: CardAuthorizationApprovalRequestWebhookEvent.Amounts;
/**
* @deprecated Deprecated, use `amounts`. The base transaction amount (in cents)
* plus the acquirer fee field. This is the amount the issuer should authorize
* against unless the issuer is paying the acquirer fee on behalf of the
* cardholder.
*/
authorization_amount: number;
avs: CardAuthorizationApprovalRequestWebhookEvent.Avs;
/**
* Card object in ASA
*/
card: CardAuthorizationApprovalRequestWebhookEvent.Card;
/**
* @deprecated Deprecated, use `amounts`. 3-character alphabetic ISO 4217 code for
* cardholder's billing currency.
*/
cardholder_currency: string;
/**
* The portion of the transaction requested as cash back by the cardholder, and
* does not include any acquirer fees. The amount field includes the purchase
* amount, the requested cash back amount, and any acquirer fees.
*
* If no cash back was requested, the value of this field will be 0, and the field
* will always be present.
*/
cash_amount: number;
/**
* Date and time when the transaction first occurred in UTC.
*/
created: string;
event_type: 'card_authorization.approval_request';
/**
* Merchant information including full location details.
*/
merchant: CardAuthorizationApprovalRequestWebhookEvent.Merchant;
/**
* @deprecated Deprecated, use `amounts`. The amount that the merchant will
* receive, denominated in `merchant_currency` and in the smallest currency unit.
* Note the amount includes `acquirer_fee`, similar to `authorization_amount`. It
* will be different from `authorization_amount` if the merchant is taking payment
* in a different currency.
*/
merchant_amount: number;
/**
* @deprecated 3-character alphabetic ISO 4217 code for the local currency of the
* transaction.
*/
merchant_currency: string;
/**
* Where the cardholder received the service, when different from the card acceptor
* location. This is populated from network data elements such as Mastercard DE-122
* SE1 SF9-14 and Visa F34 DS02.
*/
service_location: CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation | null;
/**
* @deprecated Deprecated, use `amounts`. Amount (in cents) of the transaction that
* has been settled, including any acquirer fees.
*/
settled_amount: number;
/**
* The type of authorization request that this request is for. Note that
* `CREDIT_AUTHORIZATION` and `FINANCIAL_CREDIT_AUTHORIZATION` is only available to
* users with credit decisioning via ASA enabled.
*/
status:
| 'AUTHORIZATION'
| 'CREDIT_AUTHORIZATION'
| 'FINANCIAL_AUTHORIZATION'
| 'FINANCIAL_CREDIT_AUTHORIZATION'
| 'BALANCE_INQUIRY';
/**
* The entity that initiated the transaction.
*/
transaction_initiator: 'CARDHOLDER' | 'MERCHANT' | 'UNKNOWN';
account_type?: 'CHECKING' | 'SAVINGS';
cardholder_authentication?: TransactionsAPI.CardholderAuthentication;
/**
* Deprecated, use `cash_amount`.
*/
cashback?: number;
/**
* @deprecated Deprecated, use `amounts`. If the transaction was requested in a
* currency other than the settlement currency, this field will be populated to
* indicate the rate used to translate the merchant_amount to the amount (i.e.,
* `merchant_amount` x `conversion_rate` = `amount`). Note that the
* `merchant_amount` is in the local currency and the amount is in the settlement
* currency.
*/
conversion_rate?: number;
/**
* The event token associated with the authorization. This field is only set for
* programs enrolled into the beta.
*/
event_token?: string;
/**
* Optional Object containing information if the Card is a part of a Fleet managed
* program
*/
fleet_info?: CardAuthorizationApprovalRequestWebhookEvent.FleetInfo | null;
/**
* The latest Authorization Challenge that was issued to the cardholder for this
* merchant.
*/
latest_challenge?: CardAuthorizationApprovalRequestWebhookEvent.LatestChallenge;
/**
* Card network of the authorization.
*/
network?: 'AMEX' | 'INTERLINK' | 'MAESTRO' | 'MASTERCARD' | 'UNKNOWN' | 'VISA';
/**
* Network-provided score assessing risk level associated with a given
* authorization. Scores are on a range of 0-999, with 0 representing the lowest
* risk and 999 representing the highest risk. For Visa transactions, where the raw
* score has a range of 0-99, Lithic will normalize the score by multiplying the
* raw score by 10x.
*/
network_risk_score?: number | null;
/**
* Contains raw data provided by the card network, including attributes that
* provide further context about the authorization. If populated by the network,
* data is organized by Lithic and passed through without further modification.
* Please consult the official network documentation for more details about these
* values and how to use them. This object is only available to certain programs-
* contact your Customer Success Manager to discuss enabling access.
*/
network_specific_data?: CardAuthorizationApprovalRequestWebhookEvent.NetworkSpecificData | null;
pos?: CardAuthorizationApprovalRequestWebhookEvent.Pos;
token_info?: TransactionsAPI.TokenInfo | null;
/**
* Deprecated: approximate time-to-live for the authorization.
*/
ttl?: string;
}
export namespace CardAuthorizationApprovalRequestWebhookEvent {
/**
* Structured amounts for this authorization. The `cardholder` and `merchant`
* amounts reflect the original network authorization values. For programs with
* hold adjustments enabled (e.g., automated fuel dispensers or tipping MCCs), the
* `hold` amount may exceed the `cardholder` and `merchant` amounts to account for
* anticipated final transaction amounts such as tips or fuel fill-ups
*/
export interface Amounts {
cardholder: Amounts.Cardholder;
hold: Amounts.Hold | null;
merchant: Amounts.Merchant;
settlement: Amounts.Settlement | null;
}
export namespace Amounts {
export interface Cardholder {
/**
* Amount in the smallest unit of the applicable currency (e.g., cents)
*/
amount: number;
/**
* Exchange rate used for currency conversion
*/
conversion_rate: string;
/**
* 3-character alphabetic ISO 4217 currency
*/
currency: Shared.Currency;
}
export interface Hold {
/**
* Amount in the smallest unit of the applicable currency (e.g., cents)
*/
amount: number;
/**
* 3-character alphabetic ISO 4217 currency
*/
currency: Shared.Currency;
}
export interface Merchant {
/**
* Amount in the smallest unit of the applicable currency (e.g., cents)
*/
amount: number;
/**
* 3-character alphabetic ISO 4217 currency
*/
currency: Shared.Currency;
}
export interface Settlement {
/**
* Amount in the smallest unit of the applicable currency (e.g., cents)
*/
amount: number;
/**
* 3-character alphabetic ISO 4217 currency
*/
currency: Shared.Currency;
}
}
export interface Avs {
/**
* Cardholder address
*/
address: string;
/**
* Lithic's evaluation result comparing the transaction's address data with the
* cardholder KYC data if it exists. In the event Lithic does not have any
* Cardholder KYC data, or the transaction does not contain any address data,
* NOT_PRESENT will be returned
*/
address_on_file_match: 'MATCH' | 'MATCH_ADDRESS_ONLY' | 'MATCH_ZIP_ONLY' | 'MISMATCH' | 'NOT_PRESENT';
/**
* Cardholder ZIP code
*/
zipcode: string;
}
/**
* Card object in ASA
*/
export interface Card {
/**
* Globally unique identifier for the card.
*/
token: string;
/**
* Last four digits of the card number
*/
last_four: string;
/**
* Customizable name to identify the card
*/
memo: string;
/**
* Amount (in cents) to limit approved authorizations. Purchase requests above the
* spend limit will be declined (refunds and credits will be approved).
*
* Note that while spend limits are enforced based on authorized and settled volume
* on a card, they are not recommended to be used for balance or
* reconciliation-level accuracy. Spend limits also cannot block force posted
* charges (i.e., when a merchant sends a clearing message without a prior
* authorization).
*/
spend_limit: number;
/**
* Note that to support recurring monthly payments, which can occur on different
* day every month, the time window we consider for MONTHLY velocity starts 6 days
* after the current calendar date one month prior.
*/
spend_limit_duration: 'ANNUALLY' | 'FOREVER' | 'MONTHLY' | 'TRANSACTION';
state: 'CLOSED' | 'OPEN' | 'PAUSED' | 'PENDING_ACTIVATION' | 'PENDING_FULFILLMENT';
type: 'SINGLE_USE' | 'MERCHANT_LOCKED' | 'UNLOCKED' | 'PHYSICAL' | 'DIGITAL_WALLET' | 'VIRTUAL';
}
/**
* Merchant information including full location details.
*/
export interface Merchant extends Shared.Merchant {
/**
* Phone number of card acceptor.
*/