-
Notifications
You must be signed in to change notification settings - Fork 16
/
Types.ts
4291 lines (3528 loc) · 152 KB
/
Types.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
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
/** Type for a bankauthorisation resource. */
export interface BankAuthorisation {
// Type of authorisation, can be either 'mandate' or 'payment'.
authorisation_type?: BankAuthorisationAuthorisationType;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when the user
// has been authorised.
authorised_at?: string | null;
// Timestamp when the flow was created
created_at?: string;
// Timestamp when the url will expire. Each authorisation url currently lasts
// for 15 minutes, but this can vary by bank.
expires_at?: string;
// Unique identifier, beginning with "BAU".
id?: string;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when the
// authorisation URL has been visited.
last_visited_at?: string | null;
// Resources linked to this BankAuthorisation.
links?: BankAuthorisationLinks;
// URL that the payer can be redirected to after authorising the payment.
//
// On completion of bank authorisation, the query parameter of either
// `outcome=success` or `outcome=failure` will be
// appended to the `redirect_uri` to indicate the result of the bank
// authorisation. If the bank authorisation is
// expired, the query parameter `outcome=timeout` will be appended to the
// `redirect_uri`, in which case you should
// prompt the user to try the bank authorisation step again.
//
// The `redirect_uri` you provide should handle the `outcome` query parameter
// for displaying the result of the
// bank authorisation as outlined above.
//
// The BillingRequestFlow ID will also be appended to the `redirect_uri` as
// query parameter `id=BRF123`.
//
// Defaults to `https://pay.gocardless.com/billing/static/thankyou`.
redirect_uri?: string;
// URL for an oauth flow that will allow the user to authorise the payment
url?: string;
}
/** Type for a bankauthorisationcreaterequestlinks resource. */
export interface BankAuthorisationCreateRequestLinks {
// ID of the [billing request](#billing-requests-billing-requests) against
// which this authorisation was created.
billing_request?: string;
}
export enum BankAuthorisationAuthorisationType {
Mandate = 'mandate',
Payment = 'payment',
}
/** Type for a bankauthorisationlinks resource. */
export interface BankAuthorisationLinks {
// ID of the [billing request](#billing-requests-billing-requests) against
// which this authorisation was created.
billing_request?: string;
// ID of the [institution](#billing-requests-institutions) against which this
// authorisation was created.
institution?: string;
}
/** Type for a bankdetailslookup resource. */
export interface BankDetailsLookup {
// Array of [schemes](#mandates_scheme) supported for this bank account. This
// will be an empty array if the bank account is not reachable by any schemes.
available_debit_schemes?: BankDetailsLookupAvailableDebitScheme[];
// The name of the bank with which the account is held (if available).
bank_name?: string | null;
// ISO 9362 SWIFT BIC of the bank with which the account is held.
//
// <p class="notice">Even if no BIC is returned for an account, GoCardless may
// still be able to collect payments from it - you should refer to the
// `available_debit_schemes` attribute to determine reachability.</p>
bic?: string | null;
}
export enum BankDetailsLookupAvailableDebitScheme {
Ach = 'ach',
Autogiro = 'autogiro',
Bacs = 'bacs',
Becs = 'becs',
BecsNz = 'becs_nz',
Betalingsservice = 'betalingsservice',
FasterPayments = 'faster_payments',
Pad = 'pad',
PayTo = 'pay_to',
SepaCore = 'sepa_core',
}
/** Type for a billingrequest resource. */
export interface BillingRequest {
// List of actions that can be performed before this billing request can be
// fulfilled.
actions?: BillingRequestAction[];
// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
// resource was created.
created_at?: string;
// (Optional) If true, this billing request can fallback from instant payment
// to direct debit.
// Should not be set if GoCardless payment intelligence feature is used.
//
// See [Billing Requests: Retain customers with
// Fallbacks](https://developer.gocardless.com/getting-started/billing-requests/retain-customers-with-fallbacks/)
// for more information.
fallback_enabled?: boolean;
// Unique identifier, beginning with "BRQ".
id?: string;
// Resources linked to this BillingRequest.
links?: BillingRequestLinks;
// Request for a mandate
mandate_request?: BillingRequestMandateRequest;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
// Request for a one-off strongly authorised payment
payment_request?: BillingRequestPaymentRequest;
// Specifies the high-level purpose of a mandate and/or payment using a set of
// pre-defined categories. Required for the PayTo scheme, optional for all
// others. Currently `mortgage`, `utility`, `loan`, `dependant_support`,
// `gambling`, `retail`, `salary`, `personal`, `government`, `pension`, `tax`
// and `other` are supported.
purpose_code?: BillingRequestPurposeCode;
//
resources?: BillingRequestResources;
// One of:
// <ul>
// <li>`pending`: the billing request is pending and can be used</li>
// <li>`ready_to_fulfil`: the billing request is ready to fulfil</li>
// <li>`fulfilling`: the billing request is currently undergoing
// fulfilment</li>
// <li>`fulfilled`: the billing request has been fulfilled and a payment
// created</li>
// <li>`cancelled`: the billing request has been cancelled and cannot be
// used</li>
// </ul>
status?: BillingRequestStatus;
}
/** Type for a billingrequestcreaterequestlinks resource. */
export interface BillingRequestCreateRequestLinks {
// ID of the associated [creditor](#core-endpoints-creditors). Only required
// if your account manages multiple creditors.
creditor?: string;
// ID of the [customer](#core-endpoints-customers) against which this request
// should be made.
customer?: string;
// (Optional) ID of the
// [customer_bank_account](#core-endpoints-customer-bank-accounts) against
// which this request should be made.
//
customer_bank_account?: string;
}
/** Type for a billingrequestcustomer resource. */
export interface BillingRequestCustomer {
// Customer's company name. Required unless a `given_name` and `family_name`
// are provided. For Canadian customers, the use of a `company_name` value
// will mean that any mandate created from this customer will be considered to
// be a "Business PAD" (otherwise, any mandate will be considered to be a
// "Personal PAD").
company_name?: string | null;
// Customer's email address. Required in most cases, as this allows GoCardless
// to send notifications to this customer.
email?: string | null;
// Customer's surname. Required unless a `company_name` is provided.
family_name?: string | null;
// Customer's first name. Required unless a `company_name` is provided.
given_name?: string | null;
// [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code.
// Used as the language for notification emails sent by GoCardless if your
// organisation does not send its own (see [compliance
// requirements](#appendix-compliance-requirements)). Currently only "en",
// "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported.
// If this is not provided, the language will be chosen based on the
// `country_code` (if supplied) or default to "en".
language?: string | null;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
// [ITU E.123](https://en.wikipedia.org/wiki/E.123) formatted phone number,
// including country code.
phone_number?: string | null;
}
/** Type for a billingrequestcustomerbillingdetail resource. */
export interface BillingRequestCustomerBillingDetail {
// The first line of the customer's address.
address_line1?: string | null;
// The second line of the customer's address.
address_line2?: string | null;
// The third line of the customer's address.
address_line3?: string | null;
// The city of the customer's address.
city?: string | null;
// [ISO 3166-1 alpha-2
// code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
country_code?: string | null;
// For Danish customers only. The civic/company number (CPR or CVR) of the
// customer. Must be supplied if the customer's bank account is denominated in
// Danish krone (DKK).
danish_identity_number?: string | null;
// For ACH customers only. Required for ACH customers. A string containing the
// IP address of the payer to whom the mandate belongs (i.e. as a result of
// their completion of a mandate setup flow in their browser).
//
// Not required for creating offline mandates where `authorisation_source` is
// set to telephone or paper.
//
ip_address?: string | null;
// The customer's postal code.
postal_code?: string | null;
// The customer's address region, county or department. For US customers a 2
// letter [ISO3166-2:US](https://en.wikipedia.org/wiki/ISO_3166-2:US) state
// code is required (e.g. `CA` for California).
region?: string | null;
// For Swedish customers only. The civic/company number (personnummer,
// samordningsnummer, or organisationsnummer) of the customer. Must be
// supplied if the customer's bank account is denominated in Swedish krona
// (SEK). This field cannot be changed once it has been set.
swedish_identity_number?: string | null;
}
export enum BillingRequestAccountType {
Savings = 'savings',
Checking = 'checking',
}
export enum BillingRequestNotificationType {
Email = 'email',
}
/** Type for a billingrequestaction resource. */
export interface BillingRequestAction {
// List of currencies the current mandate supports
available_currencies?: string[];
// Describes the behaviour of bank authorisations, for the bank_authorisation
// action
bank_authorisation?: BillingRequestActionBankAuthorisation;
// Additional parameters to help complete the collect_customer_details action
collect_customer_details?: BillingRequestActionCollectCustomerDetails;
// Which other action types this action can complete.
completes_actions?: string[];
// Informs you whether the action is required to fulfil the billing request or
// not.
required?: boolean;
// Requires completing these actions before this action can be completed.
requires_actions?: string[];
// Status of the action
status?: BillingRequestActionStatus;
// Unique identifier for the action.
type?: BillingRequestActionType;
}
/** Type for a billingrequestactionavailablecurrencies resource. */
export interface BillingRequestActionAvailableCurrencies {
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code.
currency?: string;
}
/** Type for a billingrequestactionbankauthorisation resource. */
export interface BillingRequestActionBankAuthorisation {
// Which authorisation adapter will be used to power these authorisations
// (GoCardless internal use only)
adapter?: BillingRequestActionBankAuthorisationAdapter;
// What type of bank authorisations are supported on this billing request
authorisation_type?: BillingRequestActionBankAuthorisationAuthorisationType;
// Whether an institution is a required field when creating this bank
// authorisation
requires_institution?: boolean;
}
export enum BillingRequestActionBankAuthorisationAdapter {
OpenBankingGatewayPis = 'open_banking_gateway_pis',
PlaidAis = 'plaid_ais',
OpenBankingGatewayAis = 'open_banking_gateway_ais',
BankidAis = 'bankid_ais',
BankPayRecurring = 'bank_pay_recurring',
}
export enum BillingRequestActionBankAuthorisationAuthorisationType {
Payment = 'payment',
Mandate = 'mandate',
}
/** Type for a billingrequestactioncollectcustomerdetails resource. */
export interface BillingRequestActionCollectCustomerDetails {
// Default customer country code, as determined by scheme and payer location
default_country_code?: string;
//
incomplete_fields?: BillingRequestActionCollectCustomerDetailsIncompleteFields;
}
/** Type for a billingrequestactioncollectcustomerdetailsincompletefields resource. */
export interface BillingRequestActionCollectCustomerDetailsIncompleteFields {
//
customer?: string[];
//
customer_billing_detail?: string[];
}
export enum BillingRequestActionStatus {
Pending = 'pending',
Completed = 'completed',
}
export enum BillingRequestActionType {
ChooseCurrency = 'choose_currency',
CollectAmount = 'collect_amount',
CollectCustomerDetails = 'collect_customer_details',
CollectBankAccount = 'collect_bank_account',
BankAuthorisation = 'bank_authorisation',
ConfirmPayerDetails = 'confirm_payer_details',
SelectInstitution = 'select_institution',
}
/** Type for a billingrequestlinks resource. */
export interface BillingRequestLinks {
// (Optional) ID of the [bank
// authorisation](#billing-requests-bank-authorisations) that was used to
// verify this request.
bank_authorisation?: string;
// ID of the associated [creditor](#core-endpoints-creditors).
creditor?: string;
// ID of the [customer](#core-endpoints-customers) that will be used for this
// request
customer?: string;
// (Optional) ID of the
// [customer_bank_account](#core-endpoints-customer-bank-accounts) that will
// be used for this request
customer_bank_account?: string;
// ID of the customer billing detail that will be used for this request
customer_billing_detail?: string;
// (Optional) ID of the associated mandate request
mandate_request?: string;
// (Optional) ID of the [mandate](#core-endpoints-mandates) that was created
// from this mandate request. this mandate request.
mandate_request_mandate?: string;
// ID of the associated organisation.
organisation?: string;
// (Optional) ID of the associated payment request
payment_request?: string;
// (Optional) ID of the [payment](#core-endpoints-payments) that was created
// from this payment request.
payment_request_payment?: string;
}
/** Type for a billingrequestmandaterequest resource. */
export interface BillingRequestMandateRequest {
// This field is ACH specific, sometimes referred to as [SEC
// code](https://www.moderntreasury.com/learn/sec-codes).
//
// This is the way that the payer gives authorisation to the merchant.
// web: Authorisation is Internet Initiated or via Mobile Entry (maps to SEC
// code: WEB)
// telephone: Authorisation is provided orally over telephone (maps to SEC
// code: TEL)
// paper: Authorisation is provided in writing and signed, or similarly
// authenticated (maps to SEC code: PPD)
//
authorisation_source?: BillingRequestMandateRequestAuthorisationSource;
// Constraints that will apply to the mandate_request. (Optional) Specifically
// for PayTo and VRP.
constraints?: BillingRequestMandateRequestConstraints | null;
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code.
currency?: string;
// A human-readable description of the payment and/or mandate. This will be
// displayed to the payer when authorising the billing request.
//
description?: string | null;
// Resources linked to this BillingRequestMandateRequest.
links?: BillingRequestMandateRequestLinks;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
// A bank payment scheme. Currently "ach", "autogiro", "bacs", "becs",
// "becs_nz", "betalingsservice", "faster_payments", "pad", "pay_to" and
// "sepa_core" are supported. Optional for mandate only requests - if left
// blank, the payer will be able to select the currency/scheme to pay with
// from a list of your available schemes.
scheme?: string | null;
// Verification preference for the mandate. One of:
// <ul>
// <li>`minimum`: only verify if absolutely required, such as when part of
// scheme rules</li>
// <li>`recommended`: in addition to `minimum`, use the GoCardless payment
// intelligence solution to decide if a payer should be verified</li>
// <li>`when_available`: if verification mechanisms are available, use
// them</li>
// <li>`always`: as `when_available`, but fail to create the Billing Request
// if a mechanism isn't available</li>
// </ul>
//
// By default, all Billing Requests use the `recommended` verification
// preference. It uses GoCardless payment intelligence solution to determine
// if a payer is fraudulent or not. The verification mechanism is based on the
// response and the payer may be asked to verify themselves. If the feature is
// not available, `recommended` behaves like `minimum`.
//
// If you never wish to take advantage of our reduced risk products and
// Verified Mandates as they are released in new schemes, please use the
// `minimum` verification preference.
//
// See [Billing Requests: Creating Verified
// Mandates](https://developer.gocardless.com/getting-started/billing-requests/verified-mandates/)
// for more information.
verify?: BillingRequestMandateRequestVerify;
}
export enum BillingRequestMandateRequestAuthorisationSource {
Web = 'web',
Telephone = 'telephone',
Paper = 'paper',
}
/** Type for a billingrequestmandaterequestconstraints resource. */
export interface BillingRequestMandateRequestConstraints {
// The latest date at which payments can be taken, must occur after start_date
// if present
//
// This is an optional field and if it is not supplied the agreement will be
// considered open and
// will not have an end date. Keep in mind the end date must take into account
// how long it will
// take the user to set up this agreement via the Billing Request.
//
end_date?: string;
// The maximum amount that can be charged for a single payment
max_amount_per_payment?: number;
// List of periodic limits and constraints which apply to them
periodic_limits?: BillingRequestMandateRequestConstraintsPeriodicLimit[];
// The date from which payments can be taken.
//
// This is an optional field and if it is not supplied the start date will be
// set to the day
// authorisation happens.
//
start_date?: string;
}
/** Type for a billingrequestmandaterequestconstraintsperiodiclimit resource. */
export interface BillingRequestMandateRequestConstraintsPeriodicLimit {
// The alignment of the period.
//
// `calendar` - this will finish on the end of the current period. For example
// this will expire on the Monday for the current week or the January for the
// next year.
//
// `creation_date` - this will finish on the next instance of the current
// period. For example Monthly it will expire on the same day of the next
// month, or yearly the same day of the next year.
//
alignment?: BillingRequestMandateRequestConstraintsPeriodicLimitAlignment;
// The maximum number of payments that can be collected in this periodic limit
max_payments?: number;
// The maximum total amount that can be charged for all payments in this
// periodic limit
max_total_amount?: number;
// The repeating period for this mandate
period?: BillingRequestMandateRequestConstraintsPeriodicLimitPeriod;
}
export enum BillingRequestMandateRequestConstraintsPeriodicLimitAlignment {
Calendar = 'calendar',
CreationDate = 'creation_date',
}
export enum BillingRequestMandateRequestConstraintsPeriodicLimitPeriod {
Day = 'day',
Week = 'week',
Month = 'month',
Year = 'year',
Flexible = 'flexible',
}
/** Type for a billingrequestmandaterequestlinks resource. */
export interface BillingRequestMandateRequestLinks {
// (Optional) ID of the [mandate](#core-endpoints-mandates) that was created
// from this mandate request. this mandate request.
//
mandate?: string;
}
export enum BillingRequestMandateRequestVerify {
Minimum = 'minimum',
Recommended = 'recommended',
WhenAvailable = 'when_available',
Always = 'always',
}
/** Type for a billingrequestpaymentrequest resource. */
export interface BillingRequestPaymentRequest {
// Amount in minor unit (e.g. pence in GBP, cents in EUR).
amount?: string;
// The amount to be deducted from the payment as an app fee, to be paid to the
// partner integration which created the billing request, in the lowest
// denomination for the currency (e.g. pence in GBP, cents in EUR).
app_fee?: string | null;
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code. `GBP` and `EUR` supported; `GBP` with your customers in the UK and
// for `EUR` with your customers in Germany only.
currency?: string;
// A human-readable description of the payment and/or mandate. This will be
// displayed to the payer when authorising the billing request.
//
description?: string | null;
// Resources linked to this BillingRequestPaymentRequest.
links?: BillingRequestPaymentRequestLinks;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
// (Optional) A scheme used for Open Banking payments. Currently
// `faster_payments` is supported in the UK (GBP) and `sepa_credit_transfer`
// and `sepa_instant_credit_transfer` are supported in Germany (EUR). In
// Germany, `sepa_credit_transfer` is used as the default. Please be aware
// that `sepa_instant_credit_transfer` may incur an additional fee for your
// customer.
scheme?: string | null;
}
/** Type for a billingrequestpaymentrequestlinks resource. */
export interface BillingRequestPaymentRequestLinks {
// (Optional) ID of the [payment](#core-endpoints-payments) that was created
// from this payment request.
payment?: string;
}
export enum BillingRequestPurposeCode {
Mortgage = 'mortgage',
Utility = 'utility',
Loan = 'loan',
DependantSupport = 'dependant_support',
Gambling = 'gambling',
Retail = 'retail',
Salary = 'salary',
Personal = 'personal',
Government = 'government',
Pension = 'pension',
Tax = 'tax',
Other = 'other',
}
/** Type for a billingrequestresources resource. */
export interface BillingRequestResources {
// Embedded customer
customer?: BillingRequestResourcesCustomer;
// Embedded customer bank account, only if a bank account is linked
customer_bank_account?: BillingRequestResourcesCustomerBankAccount | null;
// Embedded customer billing detail
customer_billing_detail?: BillingRequestResourcesCustomerBillingDetail;
}
/** Type for a billingrequestresourcescustomer resource. */
export interface BillingRequestResourcesCustomer {
// Customer's company name. Required unless a `given_name` and `family_name`
// are provided. For Canadian customers, the use of a `company_name` value
// will mean that any mandate created from this customer will be considered to
// be a "Business PAD" (otherwise, any mandate will be considered to be a
// "Personal PAD").
company_name?: string | null;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
// resource was created.
created_at?: string;
// Customer's email address. Required in most cases, as this allows GoCardless
// to send notifications to this customer.
email?: string | null;
// Customer's surname. Required unless a `company_name` is provided.
family_name?: string | null;
// Customer's first name. Required unless a `company_name` is provided.
given_name?: string | null;
// Unique identifier, beginning with "CU".
id?: string;
// [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code.
// Used as the language for notification emails sent by GoCardless if your
// organisation does not send its own (see [compliance
// requirements](#appendix-compliance-requirements)). Currently only "en",
// "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported.
// If this is not provided, the language will be chosen based on the
// `country_code` (if supplied) or default to "en".
language?: string | null;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
// [ITU E.123](https://en.wikipedia.org/wiki/E.123) formatted phone number,
// including country code.
phone_number?: string | null;
}
/** Type for a billingrequestresourcescustomerbankaccount resource. */
export interface BillingRequestResourcesCustomerBankAccount {
// Name of the account holder, as known by the bank. Usually this is the same
// as the name stored with the linked [creditor](#core-endpoints-creditors).
// This field will be transliterated, upcased and truncated to 18 characters.
// This field is required unless the request includes a [customer bank account
// token](#javascript-flow-customer-bank-account-tokens).
account_holder_name?: string;
// The last few digits of the account number. Currently 4 digits for NZD bank
// accounts and 2 digits for other currencies.
account_number_ending?: string;
// Bank account type. Required for USD-denominated bank accounts. Must not be
// provided for bank accounts in other currencies. See [local
// details](#local-bank-details-united-states) for more information.
account_type?: BillingRequestResourcesCustomerBankAccountAccountType;
// Name of bank, taken from the bank details.
bank_name?: string;
// [ISO 3166-1 alpha-2
// code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).
// Defaults to the country code of the `iban` if supplied, otherwise is
// required.
country_code?: string | null;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
// resource was created.
created_at?: string;
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD"
// are supported.
currency?: string | null;
// Boolean value showing whether the bank account is enabled or disabled.
enabled?: boolean;
// Unique identifier, beginning with "BA".
id?: string;
// Resources linked to this BillingRequestResourcesCustomerBankAccount.
links?: BillingRequestResourcesCustomerBankAccountLinks;
// Key-value store of custom data. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
metadata?: JsonMap;
}
export enum BillingRequestResourcesCustomerBankAccountAccountType {
Savings = 'savings',
Checking = 'checking',
}
/** Type for a billingrequestresourcescustomerbankaccountlinks resource. */
export interface BillingRequestResourcesCustomerBankAccountLinks {
// ID of the [customer](#core-endpoints-customers) that owns this bank
// account.
customer?: string;
}
/** Type for a billingrequestresourcescustomerbillingdetail resource. */
export interface BillingRequestResourcesCustomerBillingDetail {
// The first line of the customer's address.
address_line1?: string | null;
// The second line of the customer's address.
address_line2?: string | null;
// The third line of the customer's address.
address_line3?: string | null;
// The city of the customer's address.
city?: string | null;
// [ISO 3166-1 alpha-2
// code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
country_code?: string | null;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
// resource was created.
created_at?: string;
// For Danish customers only. The civic/company number (CPR or CVR) of the
// customer. Must be supplied if the customer's bank account is denominated in
// Danish krone (DKK).
danish_identity_number?: string | null;
// Unique identifier, beginning with "CU".
id?: string;
// For ACH customers only. Required for ACH customers. A string containing the
// IP address of the payer to whom the mandate belongs (i.e. as a result of
// their completion of a mandate setup flow in their browser).
//
// Not required for creating offline mandates where `authorisation_source` is
// set to telephone or paper.
//
ip_address?: string | null;
// The customer's postal code.
postal_code?: string | null;
// The customer's address region, county or department. For US customers a 2
// letter [ISO3166-2:US](https://en.wikipedia.org/wiki/ISO_3166-2:US) state
// code is required (e.g. `CA` for California).
region?: string | null;
// The schemes associated with this customer billing detail
schemes?: string[];
// For Swedish customers only. The civic/company number (personnummer,
// samordningsnummer, or organisationsnummer) of the customer. Must be
// supplied if the customer's bank account is denominated in Swedish krona
// (SEK). This field cannot be changed once it has been set.
swedish_identity_number?: string | null;
}
export enum BillingRequestStatus {
Pending = 'pending',
ReadyToFulfil = 'ready_to_fulfil',
Fulfilling = 'fulfilling',
Fulfilled = 'fulfilled',
Cancelled = 'cancelled',
}
/** Type for a billingrequestflow resource. */
export interface BillingRequestFlow {
// URL for a GC-controlled flow which will allow the payer to fulfil the
// billing request
authorisation_url?: string;
// (Experimental feature) Fulfil the Billing Request on completion of the flow
// (true by default). Disabling the auto_fulfil is not allowed currently.
auto_fulfil?: boolean;
// Timestamp when the flow was created
created_at?: string;
// URL that the payer can be taken to if there isn't a way to progress ahead
// in flow.
exit_uri?: string | null;
// Timestamp when the flow will expire. Each flow currently lasts for 7 days.
expires_at?: string;
// Unique identifier, beginning with "BRF".
id?: string;
// Sets the default language of the Billing Request Flow and the customer.
// [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code.
language?: string | null;
// Resources linked to this BillingRequestFlow.
links?: BillingRequestFlowLinks;
// If true, the payer will not be able to change their bank account within the
// flow. If the bank_account details are collected as part of
// bank_authorisation then GC will set this value to true mid flow.
//
// You can only lock bank account if these have already been completed as a
// part of the billing request.
//
lock_bank_account?: boolean;
// If true, the payer will not be able to change their currency/scheme
// manually within the flow. Note that this only applies to the mandate only
// flows - currency/scheme can never be changed when there is a specified
// subscription or payment.
lock_currency?: boolean;
// If true, the payer will not be able to edit their customer details within
// the flow. If the customer details are collected as part of
// bank_authorisation then GC will set this value to true mid flow.
//
// You can only lock customer details if these have already been completed as
// a part of the billing request.
//
lock_customer_details?: boolean;
// Bank account information used to prefill the payment page so your customer
// doesn't have to re-type details you already hold about them. It will be
// stored unvalidated and the customer will be able to review and amend it
// before completing the form.
prefilled_bank_account?: BillingRequestFlowPrefilledBankAccount | null;
// Customer information used to prefill the payment page so your customer
// doesn't have to re-type details you already hold about them. It will be
// stored unvalidated and the customer will be able to review and amend it
// before completing the form.
prefilled_customer?: BillingRequestFlowPrefilledCustomer | null;
// URL that the payer can be redirected to after completing the request flow.
redirect_uri?: string | null;
// Session token populated when responding to the initialise action
session_token?: string | null;
// If true, the payer will be able to see redirect action buttons on Thank You
// page. These action buttons will provide a way to connect back to the
// billing request flow app if opened within a mobile app. For successful
// flow, the button will take the payer back the billing request flow where
// they will see the success screen. For failure, button will take the payer
// to url being provided against exit_uri field.
show_redirect_buttons?: boolean;
// If true, the payer will be able to see redirect action buttons on Success
// page. These action buttons will provide a way to redirect payer to the
// given redirect_uri.
show_success_redirect_button?: boolean;
}
/** Type for a billingrequestflowcreaterequestlinks resource. */
export interface BillingRequestFlowCreateRequestLinks {
// ID of the [billing request](#billing-requests-billing-requests) against
// which this flow was created.
billing_request: string;
}
/** Type for a billingrequestflowlinks resource. */
export interface BillingRequestFlowLinks {
// ID of the [billing request](#billing-requests-billing-requests) against
// which this flow was created.
billing_request: string;
}
/** Type for a billingrequestflowprefilledbankaccount resource. */
export interface BillingRequestFlowPrefilledBankAccount {
// Bank account type for USD-denominated bank accounts. Must not be provided
// for bank accounts in other currencies. See [local
// details](#local-bank-details-united-states) for more information.
account_type?: BillingRequestFlowPrefilledBankAccountAccountType;
}
export enum BillingRequestFlowPrefilledBankAccountAccountType {
Savings = 'savings',
Checking = 'checking',
}
/** Type for a billingrequestflowprefilledcustomer resource. */
export interface BillingRequestFlowPrefilledCustomer {
// The first line of the customer's address.
address_line1?: string | null;
// The second line of the customer's address.
address_line2?: string | null;
// The third line of the customer's address.
address_line3?: string | null;
// The city of the customer's address.
city?: string | null;
// Customer's company name. Company name should only be provided if
// `given_name` and `family_name` are null.
company_name?: string | null;
// [ISO 3166-1 alpha-2
// code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
country_code?: string | null;
// For Danish customers only. The civic/company number (CPR or CVR) of the
// customer.
danish_identity_number?: string | null;
// Customer's email address.
email?: string | null;
// Customer's surname.
family_name?: string | null;
// Customer's first name.
given_name?: string | null;
// The customer's postal code.
postal_code?: string | null;
// The customer's address region, county or department.
region?: string | null;
// For Swedish customers only. The civic/company number (personnummer,
// samordningsnummer, or organisationsnummer) of the customer.
swedish_identity_number?: string | null;
}
/** Type for a billingrequesttemplate resource. */
export interface BillingRequestTemplate {
// Permanent URL that customers can visit to allow them to complete a flow
// based on this template, before being returned to the `redirect_uri`.
authorisation_url?: string;
// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
// resource was created.
created_at?: string;
// Unique identifier, beginning with "BRT".
id?: string;
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code.
mandate_request_currency?: string;
// A human-readable description of the payment and/or mandate. This will be
// displayed to the payer when authorising the billing request.
//
mandate_request_description?: string | null;
// Key-value store of custom data that will be applied to the mandate created
// when this request is fulfilled. Up to 3 keys are permitted, with key names
// up to 50 characters and values up to 500 characters.
mandate_request_metadata?: JsonMap | null;
// A bank payment scheme. Currently "ach", "autogiro", "bacs", "becs",
// "becs_nz", "betalingsservice", "faster_payments", "pad", "pay_to" and
// "sepa_core" are supported. Optional for mandate only requests - if left
// blank, the payer will be able to select the currency/scheme to pay with
// from a list of your available schemes.
mandate_request_scheme?: string | null;
// Verification preference for the mandate. One of: