forked from orbcorp/orb-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoices.ts
2765 lines (2427 loc) · 118 KB
/
invoices.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
import * as Shared from './shared';
import * as PricesAPI from './prices/prices';
import { Page, type PageParams } from '../pagination';
export class Invoices extends APIResource {
/**
* This endpoint is used to create a one-off invoice for a customer.
*/
create(body: InvoiceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
return this._client.post('/invoices', { body, ...options });
}
/**
* This endpoint allows you to update the `metadata` property on an invoice. If you
* pass null for the metadata value, it will clear any existing metadata for that
* invoice.
*
* `metadata` can be modified regardless of invoice state.
*/
update(
invoiceId: string,
body: InvoiceUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Invoice> {
return this._client.put(`/invoices/${invoiceId}`, { body, ...options });
}
/**
* This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for
* an account in a list format.
*
* The list of invoices is ordered starting from the most recently issued invoice
* date. The response also includes
* [`pagination_metadata`](../reference/pagination), which lets the caller retrieve
* the next page of results if they exist.
*
* By default, this only returns invoices that are `issued`, `paid`, or `synced`.
*
* When fetching any `draft` invoices, this returns the last-computed invoice
* values for each draft invoice, which may not always be up-to-date since Orb
* regularly refreshes invoices asynchronously.
*/
list(query?: InvoiceListParams, options?: Core.RequestOptions): Core.PagePromise<InvoicesPage, Invoice>;
list(options?: Core.RequestOptions): Core.PagePromise<InvoicesPage, Invoice>;
list(
query: InvoiceListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<InvoicesPage, Invoice> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/invoices', InvoicesPage, { query, ...options });
}
/**
* This endpoint is used to fetch an [`Invoice`](../guides/concepts#invoice) given
* an identifier.
*/
fetch(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
return this._client.get(`/invoices/${invoiceId}`, options);
}
/**
* This endpoint can be used to fetch the upcoming
* [invoice](../guides/concepts#invoice) for the current billing period given a
* subscription.
*/
fetchUpcoming(
query: InvoiceFetchUpcomingParams,
options?: Core.RequestOptions,
): Core.APIPromise<InvoiceFetchUpcomingResponse> {
return this._client.get('/invoices/upcoming', { query, ...options });
}
/**
* This endpoint allows an eligible invoice to be issued manually. This is only
* possible with invoices where status is `draft`, `will_auto_issue` is false, and
* an `eligible_to_issue_at` is a time in the past. Issuing an invoice could
* possibly trigger side effects, some of which could be customer-visible (e.g.
* sending emails, auto-collecting payment, syncing the invoice to external
* providers, etc).
*/
issue(
invoiceId: string,
body?: InvoiceIssueParams,
options?: Core.RequestOptions,
): Core.APIPromise<Invoice>;
issue(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice>;
issue(
invoiceId: string,
body: InvoiceIssueParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<Invoice> {
if (isRequestOptions(body)) {
return this.issue(invoiceId, {}, body);
}
return this._client.post(`/invoices/${invoiceId}/issue`, { body, ...options });
}
/**
* This endpoint allows an invoice's status to be set the `paid` status. This can
* only be done to invoices that are in the `issued` status.
*/
markPaid(
invoiceId: string,
body: InvoiceMarkPaidParams,
options?: Core.RequestOptions,
): Core.APIPromise<Invoice> {
return this._client.post(`/invoices/${invoiceId}/mark_paid`, { body, ...options });
}
/**
* This endpoint collects payment for an invoice using the customer's default
* payment method. This action can only be taken on invoices with status "issued".
*/
pay(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
return this._client.post(`/invoices/${invoiceId}/pay`, options);
}
/**
* This endpoint allows an invoice's status to be set the `void` status. This can
* only be done to invoices that are in the `issued` status.
*
* If the associated invoice has used the customer balance to change the amount
* due, the customer balance operation will be reverted. For example, if the
* invoice used $10 of customer balance, that amount will be added back to the
* customer balance upon voiding.
*/
void(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
return this._client.post(`/invoices/${invoiceId}/void`, options);
}
}
export class InvoicesPage extends Page<Invoice> {}
/**
* An [`Invoice`](../guides/concepts#invoice) is a fundamental billing entity,
* representing the request for payment for a single subscription. This includes a
* set of line items, which correspond to prices in the subscription's plan and can
* represent fixed recurring fees or usage-based fees. They are generated at the
* end of a billing period, or as the result of an action, such as a cancellation.
*/
export interface Invoice {
id: string;
/**
* This is the final amount required to be charged to the customer and reflects the
* application of the customer balance to the `total` of the invoice.
*/
amount_due: string;
auto_collection: Invoice.AutoCollection;
billing_address: Invoice.BillingAddress | null;
/**
* The creation time of the resource in Orb.
*/
created_at: string;
/**
* A list of credit notes associated with the invoice
*/
credit_notes: Array<Invoice.CreditNote>;
/**
* An ISO 4217 currency string or `credits`
*/
currency: string;
customer: Invoice.Customer;
customer_balance_transactions: Array<Invoice.CustomerBalanceTransaction>;
/**
* Tax IDs are commonly required to be displayed on customer invoices, which are
* added to the headers of invoices.
*
* ### Supported Tax ID Countries and Types
*
* | Country | Type | Description |
* | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
* | Andorra | `ad_nrt` | Andorran NRT Number |
* | Argentina | `ar_cuit` | Argentinian Tax ID Number |
* | Australia | `au_abn` | Australian Business Number (AU ABN) |
* | Australia | `au_arn` | Australian Taxation Office Reference Number |
* | Austria | `eu_vat` | European VAT Number |
* | Bahrain | `bh_vat` | Bahraini VAT Number |
* | Belgium | `eu_vat` | European VAT Number |
* | Bolivia | `bo_tin` | Bolivian Tax ID |
* | Brazil | `br_cnpj` | Brazilian CNPJ Number |
* | Brazil | `br_cpf` | Brazilian CPF Number |
* | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code |
* | Bulgaria | `eu_vat` | European VAT Number |
* | Canada | `ca_bn` | Canadian BN |
* | Canada | `ca_gst_hst` | Canadian GST/HST Number |
* | Canada | `ca_pst_bc` | Canadian PST Number (British Columbia) |
* | Canada | `ca_pst_mb` | Canadian PST Number (Manitoba) |
* | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) |
* | Canada | `ca_qst` | Canadian QST Number (Québec) |
* | Chile | `cl_tin` | Chilean TIN |
* | China | `cn_tin` | Chinese Tax ID |
* | Colombia | `co_nit` | Colombian NIT Number |
* | Costa Rica | `cr_tin` | Costa Rican Tax ID |
* | Croatia | `eu_vat` | European VAT Number |
* | Cyprus | `eu_vat` | European VAT Number |
* | Czech Republic | `eu_vat` | European VAT Number |
* | Denmark | `eu_vat` | European VAT Number |
* | Dominican Republic | `do_rcn` | Dominican RCN Number |
* | Ecuador | `ec_ruc` | Ecuadorian RUC Number |
* | Egypt | `eg_tin` | Egyptian Tax Identification Number |
* | El Salvador | `sv_nit` | El Salvadorian NIT Number |
* | Estonia | `eu_vat` | European VAT Number |
* | EU | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme |
* | Finland | `eu_vat` | European VAT Number |
* | France | `eu_vat` | European VAT Number |
* | Georgia | `ge_vat` | Georgian VAT |
* | Germany | `eu_vat` | European VAT Number |
* | Greece | `eu_vat` | European VAT Number |
* | Hong Kong | `hk_br` | Hong Kong BR Number |
* | Hungary | `eu_vat` | European VAT Number |
* | Hungary | `hu_tin` | Hungary Tax Number (adószám) |
* | Iceland | `is_vat` | Icelandic VAT |
* | India | `in_gst` | Indian GST Number |
* | Indonesia | `id_npwp` | Indonesian NPWP Number |
* | Ireland | `eu_vat` | European VAT Number |
* | Israel | `il_vat` | Israel VAT |
* | Italy | `eu_vat` | European VAT Number |
* | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) |
* | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) |
* | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) |
* | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number |
* | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number |
* | Latvia | `eu_vat` | European VAT Number |
* | Liechtenstein | `li_uid` | Liechtensteinian UID Number |
* | Lithuania | `eu_vat` | European VAT Number |
* | Luxembourg | `eu_vat` | European VAT Number |
* | Malaysia | `my_frp` | Malaysian FRP Number |
* | Malaysia | `my_itn` | Malaysian ITN |
* | Malaysia | `my_sst` | Malaysian SST Number |
* | Malta | `eu_vat ` | European VAT Number |
* | Mexico | `mx_rfc` | Mexican RFC Number |
* | Netherlands | `eu_vat` | European VAT Number |
* | New Zealand | `nz_gst` | New Zealand GST Number |
* | Nigeria | `ng_tin` | Nigerian Tax Identification Number |
* | Norway | `no_vat` | Norwegian VAT Number |
* | Norway | `no_voec` | Norwegian VAT on e-commerce Number |
* | Oman | `om_vat` | Omani VAT Number |
* | Peru | `pe_ruc` | Peruvian RUC Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT Number |
* | Portugal | `eu_vat` | European VAT Number |
* | Romania | `eu_vat` | European VAT Number |
* | Romania | `ro_tin` | Romanian Tax ID Number |
* | Russia | `ru_inn` | Russian INN |
* | Russia | `ru_kpp` | Russian KPP |
* | Saudi Arabia | `sa_vat` | Saudi Arabia VAT |
* | Serbia | `rs_pib` | Serbian PIB Number |
* | Singapore | `sg_gst` | Singaporean GST |
* | Singapore | `sg_uen` | Singaporean UEN |
* | Slovakia | `eu_vat` | European VAT Number |
* | Slovenia | `eu_vat` | European VAT Number |
* | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) |
* | South Africa | `za_vat` | South African VAT Number |
* | South Korea | `kr_brn` | Korean BRN |
* | Spain | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) |
* | Spain | `eu_vat` | European VAT Number |
* | Sweden | `eu_vat` | European VAT Number |
* | Switzerland | `ch_vat` | Switzerland VAT Number |
* | Taiwan | `tw_vat` | Taiwanese VAT |
* | Thailand | `th_vat` | Thai VAT |
* | Turkey | `tr_tin` | Turkish Tax Identification Number |
* | Ukraine | `ua_vat` | Ukrainian VAT |
* | United Arab Emirates | `ae_trn` | United Arab Emirates TRN |
* | United Kingdom | `eu_vat` | Northern Ireland VAT Number |
* | United Kingdom | `gb_vat` | United Kingdom VAT Number |
* | United States | `us_ein` | United States EIN |
* | Uruguay | `uy_ruc` | Uruguayan RUC Number |
* | Venezuela | `ve_rif` | Venezuelan RIF Number |
* | Vietnam | `vn_tin` | Vietnamese Tax ID Number |
*/
customer_tax_id: Invoice.CustomerTaxID | null;
/**
* @deprecated: This field is deprecated in favor of `discounts`. If a `discounts`
* list is provided, the first discount in the list will be returned. If the list
* is empty, `None` will be returned.
*/
discount: unknown;
discounts: Array<Shared.InvoiceLevelDiscount>;
/**
* When the invoice payment is due.
*/
due_date: string;
/**
* If the invoice has a status of `draft`, this will be the time that the invoice
* will be eligible to be issued, otherwise it will be `null`. If `auto-issue` is
* true, the invoice will automatically begin issuing at this time.
*/
eligible_to_issue_at: string | null;
/**
* A URL for the customer-facing invoice portal. This URL expires 30 days after the
* invoice's due date, or 60 days after being re-generated through the UI.
*/
hosted_invoice_url: string | null;
/**
* The scheduled date of the invoice
*/
invoice_date: string;
/**
* Automatically generated invoice number to help track and reconcile invoices.
* Invoice numbers have a prefix such as `RFOBWG`. These can be sequential per
* account or customer.
*/
invoice_number: string;
/**
* The link to download the PDF representation of the `Invoice`.
*/
invoice_pdf: string | null;
invoice_source: 'subscription' | 'partial' | 'one_off';
/**
* If the invoice failed to issue, this will be the last time it failed to issue
* (even if it is now in a different state.)
*/
issue_failed_at: string | null;
/**
* If the invoice has been issued, this will be the time it transitioned to
* `issued` (even if it is now in a different state.)
*/
issued_at: string | null;
/**
* The breakdown of prices in this invoice.
*/
line_items: Array<Invoice.LineItem>;
maximum: Invoice.Maximum | null;
maximum_amount: string | null;
/**
* Free-form text which is available on the invoice PDF and the Orb invoice portal.
*/
memo: string | null;
/**
* User specified key-value pairs for the resource. If not present, this defaults
* to an empty dictionary. Individual keys can be removed by setting the value to
* `null`, and the entire metadata mapping can be cleared by setting `metadata` to
* `null`.
*/
metadata: Record<string, string>;
minimum: Invoice.Minimum | null;
minimum_amount: string | null;
/**
* If the invoice has a status of `paid`, this gives a timestamp when the invoice
* was paid.
*/
paid_at: string | null;
/**
* A list of payment attempts associated with the invoice
*/
payment_attempts: Array<Invoice.PaymentAttempt>;
/**
* If payment was attempted on this invoice but failed, this will be the time of
* the most recent attempt.
*/
payment_failed_at: string | null;
/**
* If payment was attempted on this invoice, this will be the start time of the
* most recent attempt. This field is especially useful for delayed-notification
* payment mechanisms (like bank transfers), where payment can take 3 days or more.
*/
payment_started_at: string | null;
/**
* If the invoice is in draft, this timestamp will reflect when the invoice is
* scheduled to be issued.
*/
scheduled_issue_at: string | null;
shipping_address: Invoice.ShippingAddress | null;
status: 'issued' | 'paid' | 'synced' | 'void' | 'draft';
subscription: Invoice.Subscription | null;
/**
* The total before any discounts and minimums are applied.
*/
subtotal: string;
/**
* If the invoice failed to sync, this will be the last time an external invoicing
* provider sync was attempted. This field will always be `null` for invoices using
* Orb Invoicing.
*/
sync_failed_at: string | null;
/**
* The total after any minimums and discounts have been applied.
*/
total: string;
/**
* If the invoice has a status of `void`, this gives a timestamp when the invoice
* was voided.
*/
voided_at: string | null;
/**
* This is true if the invoice will be automatically issued in the future, and
* false otherwise.
*/
will_auto_issue: boolean;
}
export namespace Invoice {
export interface AutoCollection {
/**
* True only if auto-collection is enabled for this invoice.
*/
enabled: boolean | null;
/**
* If the invoice is scheduled for auto-collection, this field will reflect when
* the next attempt will occur. If dunning has been exhausted, or auto-collection
* is not enabled for this invoice, this field will be `null`.
*/
next_attempt_at: string | null;
/**
* Number of auto-collection payment attempts.
*/
num_attempts: number | null;
/**
* If Orb has ever attempted payment auto-collection for this invoice, this field
* will reflect when that attempt occurred. In conjunction with `next_attempt_at`,
* this can be used to tell whether the invoice is currently in dunning (that is,
* `previously_attempted_at` is non-null, and `next_attempt_time` is non-null), or
* if dunning has been exhausted (`previously_attempted_at` is non-null, but
* `next_attempt_time` is null).
*/
previously_attempted_at: string | null;
}
export interface BillingAddress {
city: string | null;
country: string | null;
line1: string | null;
line2: string | null;
postal_code: string | null;
state: string | null;
}
export interface CreditNote {
id: string;
credit_note_number: string;
/**
* An optional memo supplied on the credit note.
*/
memo: string | null;
reason: string;
total: string;
type: string;
/**
* If the credit note has a status of `void`, this gives a timestamp when the
* credit note was voided.
*/
voided_at: string | null;
}
export interface Customer {
id: string;
external_customer_id: string | null;
}
export interface CustomerBalanceTransaction {
/**
* A unique id for this transaction.
*/
id: string;
action:
| 'applied_to_invoice'
| 'manual_adjustment'
| 'prorated_refund'
| 'revert_prorated_refund'
| 'return_from_voiding'
| 'credit_note_applied'
| 'credit_note_voided'
| 'overpayment_refund';
/**
* The value of the amount changed in the transaction.
*/
amount: string;
/**
* The creation time of this transaction.
*/
created_at: string;
credit_note: CustomerBalanceTransaction.CreditNote | null;
/**
* An optional description provided for manual customer balance adjustments.
*/
description: string | null;
/**
* The new value of the customer's balance prior to the transaction, in the
* customer's currency.
*/
ending_balance: string;
invoice: CustomerBalanceTransaction.Invoice | null;
/**
* The original value of the customer's balance prior to the transaction, in the
* customer's currency.
*/
starting_balance: string;
type: 'increment' | 'decrement';
}
export namespace CustomerBalanceTransaction {
export interface CreditNote {
/**
* The id of the Credit note
*/
id: string;
}
export interface Invoice {
/**
* The Invoice id
*/
id: string;
}
}
/**
* Tax IDs are commonly required to be displayed on customer invoices, which are
* added to the headers of invoices.
*
* ### Supported Tax ID Countries and Types
*
* | Country | Type | Description |
* | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
* | Andorra | `ad_nrt` | Andorran NRT Number |
* | Argentina | `ar_cuit` | Argentinian Tax ID Number |
* | Australia | `au_abn` | Australian Business Number (AU ABN) |
* | Australia | `au_arn` | Australian Taxation Office Reference Number |
* | Austria | `eu_vat` | European VAT Number |
* | Bahrain | `bh_vat` | Bahraini VAT Number |
* | Belgium | `eu_vat` | European VAT Number |
* | Bolivia | `bo_tin` | Bolivian Tax ID |
* | Brazil | `br_cnpj` | Brazilian CNPJ Number |
* | Brazil | `br_cpf` | Brazilian CPF Number |
* | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code |
* | Bulgaria | `eu_vat` | European VAT Number |
* | Canada | `ca_bn` | Canadian BN |
* | Canada | `ca_gst_hst` | Canadian GST/HST Number |
* | Canada | `ca_pst_bc` | Canadian PST Number (British Columbia) |
* | Canada | `ca_pst_mb` | Canadian PST Number (Manitoba) |
* | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) |
* | Canada | `ca_qst` | Canadian QST Number (Québec) |
* | Chile | `cl_tin` | Chilean TIN |
* | China | `cn_tin` | Chinese Tax ID |
* | Colombia | `co_nit` | Colombian NIT Number |
* | Costa Rica | `cr_tin` | Costa Rican Tax ID |
* | Croatia | `eu_vat` | European VAT Number |
* | Cyprus | `eu_vat` | European VAT Number |
* | Czech Republic | `eu_vat` | European VAT Number |
* | Denmark | `eu_vat` | European VAT Number |
* | Dominican Republic | `do_rcn` | Dominican RCN Number |
* | Ecuador | `ec_ruc` | Ecuadorian RUC Number |
* | Egypt | `eg_tin` | Egyptian Tax Identification Number |
* | El Salvador | `sv_nit` | El Salvadorian NIT Number |
* | Estonia | `eu_vat` | European VAT Number |
* | EU | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme |
* | Finland | `eu_vat` | European VAT Number |
* | France | `eu_vat` | European VAT Number |
* | Georgia | `ge_vat` | Georgian VAT |
* | Germany | `eu_vat` | European VAT Number |
* | Greece | `eu_vat` | European VAT Number |
* | Hong Kong | `hk_br` | Hong Kong BR Number |
* | Hungary | `eu_vat` | European VAT Number |
* | Hungary | `hu_tin` | Hungary Tax Number (adószám) |
* | Iceland | `is_vat` | Icelandic VAT |
* | India | `in_gst` | Indian GST Number |
* | Indonesia | `id_npwp` | Indonesian NPWP Number |
* | Ireland | `eu_vat` | European VAT Number |
* | Israel | `il_vat` | Israel VAT |
* | Italy | `eu_vat` | European VAT Number |
* | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) |
* | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) |
* | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) |
* | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number |
* | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number |
* | Latvia | `eu_vat` | European VAT Number |
* | Liechtenstein | `li_uid` | Liechtensteinian UID Number |
* | Lithuania | `eu_vat` | European VAT Number |
* | Luxembourg | `eu_vat` | European VAT Number |
* | Malaysia | `my_frp` | Malaysian FRP Number |
* | Malaysia | `my_itn` | Malaysian ITN |
* | Malaysia | `my_sst` | Malaysian SST Number |
* | Malta | `eu_vat ` | European VAT Number |
* | Mexico | `mx_rfc` | Mexican RFC Number |
* | Netherlands | `eu_vat` | European VAT Number |
* | New Zealand | `nz_gst` | New Zealand GST Number |
* | Nigeria | `ng_tin` | Nigerian Tax Identification Number |
* | Norway | `no_vat` | Norwegian VAT Number |
* | Norway | `no_voec` | Norwegian VAT on e-commerce Number |
* | Oman | `om_vat` | Omani VAT Number |
* | Peru | `pe_ruc` | Peruvian RUC Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT Number |
* | Portugal | `eu_vat` | European VAT Number |
* | Romania | `eu_vat` | European VAT Number |
* | Romania | `ro_tin` | Romanian Tax ID Number |
* | Russia | `ru_inn` | Russian INN |
* | Russia | `ru_kpp` | Russian KPP |
* | Saudi Arabia | `sa_vat` | Saudi Arabia VAT |
* | Serbia | `rs_pib` | Serbian PIB Number |
* | Singapore | `sg_gst` | Singaporean GST |
* | Singapore | `sg_uen` | Singaporean UEN |
* | Slovakia | `eu_vat` | European VAT Number |
* | Slovenia | `eu_vat` | European VAT Number |
* | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) |
* | South Africa | `za_vat` | South African VAT Number |
* | South Korea | `kr_brn` | Korean BRN |
* | Spain | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) |
* | Spain | `eu_vat` | European VAT Number |
* | Sweden | `eu_vat` | European VAT Number |
* | Switzerland | `ch_vat` | Switzerland VAT Number |
* | Taiwan | `tw_vat` | Taiwanese VAT |
* | Thailand | `th_vat` | Thai VAT |
* | Turkey | `tr_tin` | Turkish Tax Identification Number |
* | Ukraine | `ua_vat` | Ukrainian VAT |
* | United Arab Emirates | `ae_trn` | United Arab Emirates TRN |
* | United Kingdom | `eu_vat` | Northern Ireland VAT Number |
* | United Kingdom | `gb_vat` | United Kingdom VAT Number |
* | United States | `us_ein` | United States EIN |
* | Uruguay | `uy_ruc` | Uruguayan RUC Number |
* | Venezuela | `ve_rif` | Venezuelan RIF Number |
* | Vietnam | `vn_tin` | Vietnamese Tax ID Number |
*/
export interface CustomerTaxID {
country:
| 'AD'
| 'AE'
| 'AR'
| 'AT'
| 'AU'
| 'BE'
| 'BG'
| 'BH'
| 'BO'
| 'BR'
| 'CA'
| 'CH'
| 'CL'
| 'CN'
| 'CO'
| 'CR'
| 'CY'
| 'CZ'
| 'DE'
| 'DK'
| 'EE'
| 'DO'
| 'EC'
| 'EG'
| 'ES'
| 'EU'
| 'FI'
| 'FR'
| 'GB'
| 'GE'
| 'GR'
| 'HK'
| 'HR'
| 'HU'
| 'ID'
| 'IE'
| 'IL'
| 'IN'
| 'IS'
| 'IT'
| 'JP'
| 'KE'
| 'KR'
| 'KZ'
| 'LI'
| 'LT'
| 'LU'
| 'LV'
| 'MT'
| 'MX'
| 'MY'
| 'NG'
| 'NL'
| 'NO'
| 'NZ'
| 'OM'
| 'PE'
| 'PH'
| 'PL'
| 'PT'
| 'RO'
| 'RS'
| 'RU'
| 'SA'
| 'SE'
| 'SG'
| 'SI'
| 'SK'
| 'SV'
| 'TH'
| 'TR'
| 'TW'
| 'UA'
| 'US'
| 'UY'
| 'VE'
| 'VN'
| 'ZA';
type:
| 'ad_nrt'
| 'ae_trn'
| 'ar_cuit'
| 'eu_vat'
| 'au_abn'
| 'au_arn'
| 'bg_uic'
| 'bh_vat'
| 'bo_tin'
| 'br_cnpj'
| 'br_cpf'
| 'ca_bn'
| 'ca_gst_hst'
| 'ca_pst_bc'
| 'ca_pst_mb'
| 'ca_pst_sk'
| 'ca_qst'
| 'ch_vat'
| 'cl_tin'
| 'cn_tin'
| 'co_nit'
| 'cr_tin'
| 'do_rcn'
| 'ec_ruc'
| 'eg_tin'
| 'es_cif'
| 'eu_oss_vat'
| 'gb_vat'
| 'ge_vat'
| 'hk_br'
| 'hu_tin'
| 'id_npwp'
| 'il_vat'
| 'in_gst'
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'kz_bin'
| 'li_uid'
| 'mx_rfc'
| 'my_frp'
| 'my_itn'
| 'my_sst'
| 'ng_tin'
| 'no_vat'
| 'no_voec'
| 'nz_gst'
| 'om_vat'
| 'pe_ruc'
| 'ph_tin'
| 'ro_tin'
| 'rs_pib'
| 'ru_inn'
| 'ru_kpp'
| 'sa_vat'
| 'sg_gst'
| 'sg_uen'
| 'si_tin'
| 'sv_nit'
| 'th_vat'
| 'tr_tin'
| 'tw_vat'
| 'ua_vat'
| 'us_ein'
| 'uy_ruc'
| 've_rif'
| 'vn_tin'
| 'za_vat';
value: string;
}
export interface LineItem {
/**
* A unique ID for this line item.
*/
id: string;
/**
* The final amount after any discounts or minimums.
*/
amount: string;
discount: Shared.Discount | null;
/**
* The end date of the range of time applied for this line item's price.
*/
end_date: string;
/**
* [DEPRECATED] For configured prices that are split by a grouping key, this will
* be populated with the key and a value. The `amount` and `subtotal` will be the
* values for this particular grouping.
*/
grouping: string | null;
maximum: LineItem.Maximum | null;
maximum_amount: string | null;
minimum: LineItem.Minimum | null;
minimum_amount: string | null;
/**
* The name of the price associated with this line item.
*/
name: string;
/**
* The Price resource represents a price that can be billed on a subscription,
* resulting in a charge on an invoice in the form of an invoice line item. Prices
* take a quantity and determine an amount to bill.
*
* Orb supports a few different pricing models out of the box. Each of these models
* is serialized differently in a given Price object. The model_type field
* determines the key for the configuration object that is present.
*
* ## Unit pricing
*
* With unit pricing, each unit costs a fixed amount.
*
* ```json
* {
* ...
* "model_type": "unit",
* "unit_config": {
* "unit_amount": "0.50"
* }
* ...
* }
* ```
*
* ## Tiered pricing
*
* In tiered pricing, the cost of a given unit depends on the tier range that it
* falls into, where each tier range is defined by an upper and lower bound. For
* example, the first ten units may cost $0.50 each and all units thereafter may
* cost $0.10 each.
*
* ```json
* {
* ...
* "model_type": "tiered",
* "tiered_config": {
* "tiers": [
* {
* "first_unit": 1,
* "last_unit": 10,
* "unit_amount": "0.50"
* },
* {
* "first_unit": 11,
* "last_unit": null,
* "unit_amount": "0.10"
* }
* ]
* }
* ...
* ```
*
* ## Bulk pricing
*
* Bulk pricing applies when the number of units determine the cost of all units.
* For example, if you've bought less than 10 units, they may each be $0.50 for a
* total of $5.00. Once you've bought more than 10 units, all units may now be
* priced at $0.40 (i.e. 101 units total would be $40.40).
*
* ```json
* {
* ...
* "model_type": "bulk",
* "bulk_config": {
* "tiers": [
* {
* "maximum_units": 10,
* "unit_amount": "0.50"
* },
* {
* "maximum_units": 1000,
* "unit_amount": "0.40"
* }
* ]
* }
* ...
* }
* ```
*
* ## Package pricing
*
* Package pricing defines the size or granularity of a unit for billing purposes.
* For example, if the package size is set to 5, then 4 units will be billed as 5
* and 6 units will be billed at 10.
*
* ```json
* {
* ...
* "model_type": "package",
* "package_config": {
* "package_amount": "0.80",
* "package_size": 10
* }
* ...
* }
* ```
*
* ## BPS pricing
*
* BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
* percent (the number of basis points to charge), as well as a cap per event to
* assess. For example, this would allow you to assess a fee of 0.25% on every
* payment you process, with a maximum charge of $25 per payment.
*
* ```json
* {
* ...
* "model_type": "bps",
* "bps_config": {
* "bps": 125,
* "per_unit_maximum": "11.00"
* }
* ...
* }
* ```
*
* ## Bulk BPS pricing
*
* Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
* total quantity across all events. Similar to bulk pricing, the BPS parameters of
* a given event depends on the tier range that the billing period falls into. Each