forked from orbcorp/orb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomer.go
More file actions
1625 lines (1494 loc) · 132 KB
/
customer.go
File metadata and controls
1625 lines (1494 loc) · 132 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.
package orb
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/orbcorp/orb-go/internal/apijson"
"github.com/orbcorp/orb-go/internal/apiquery"
"github.com/orbcorp/orb-go/internal/param"
"github.com/orbcorp/orb-go/internal/requestconfig"
"github.com/orbcorp/orb-go/option"
"github.com/orbcorp/orb-go/packages/pagination"
"github.com/orbcorp/orb-go/shared"
)
// CustomerService contains methods and other services that help with interacting
// with the orb API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewCustomerService] method instead.
type CustomerService struct {
Options []option.RequestOption
Costs *CustomerCostService
Credits *CustomerCreditService
BalanceTransactions *CustomerBalanceTransactionService
}
// NewCustomerService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewCustomerService(opts ...option.RequestOption) (r *CustomerService) {
r = &CustomerService{}
r.Options = opts
r.Costs = NewCustomerCostService(opts...)
r.Credits = NewCustomerCreditService(opts...)
r.BalanceTransactions = NewCustomerBalanceTransactionService(opts...)
return
}
// This operation is used to create an Orb customer, who is party to the core
// billing relationship. See [Customer](/core-concepts##customer) for an overview
// of the customer resource.
//
// This endpoint is critical in the following Orb functionality:
//
// - Automated charges can be configured by setting `payment_provider` and
// `payment_provider_id` to automatically issue invoices
// - [Customer ID Aliases](/events-and-metrics/customer-aliases) can be configured
// by setting `external_customer_id`
// - [Timezone localization](/essentials/timezones) can be configured on a
// per-customer basis by setting the `timezone` parameter
func (r *CustomerService) New(ctx context.Context, body CustomerNewParams, opts ...option.RequestOption) (res *Customer, err error) {
opts = append(r.Options[:], opts...)
path := "customers"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// This endpoint can be used to update the `payment_provider`,
// `payment_provider_id`, `name`, `email`, `email_delivery`, `tax_id`,
// `auto_collection`, `metadata`, `shipping_address`, `billing_address`, and
// `additional_emails` of an existing customer. Other fields on a customer are
// currently immutable.
func (r *CustomerService) Update(ctx context.Context, customerID string, body CustomerUpdateParams, opts ...option.RequestOption) (res *Customer, err error) {
opts = append(r.Options[:], opts...)
if customerID == "" {
err = errors.New("missing required customer_id parameter")
return
}
path := fmt.Sprintf("customers/%s", customerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
// This endpoint returns a list of all customers for an account. The list of
// customers is ordered starting from the most recently created customer. This
// endpoint follows Orb's
// [standardized pagination format](/api-reference/pagination).
//
// See [Customer](/core-concepts##customer) for an overview of the customer model.
func (r *CustomerService) List(ctx context.Context, query CustomerListParams, opts ...option.RequestOption) (res *pagination.Page[Customer], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "customers"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// This endpoint returns a list of all customers for an account. The list of
// customers is ordered starting from the most recently created customer. This
// endpoint follows Orb's
// [standardized pagination format](/api-reference/pagination).
//
// See [Customer](/core-concepts##customer) for an overview of the customer model.
func (r *CustomerService) ListAutoPaging(ctx context.Context, query CustomerListParams, opts ...option.RequestOption) *pagination.PageAutoPager[Customer] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// This performs a deletion of this customer, its subscriptions, and its invoices,
// provided the customer does not have any issued invoices. Customers with issued
// invoices cannot be deleted. This operation is irreversible. Note that this is a
// _soft_ deletion, but the data will be inaccessible through the API and Orb
// dashboard.
//
// For a hard-deletion, please reach out to the Orb team directly.
//
// **Note**: This operation happens asynchronously and can be expected to take a
// few minutes to propagate to related resources. However, querying for the
// customer on subsequent GET requests while deletion is in process will reflect
// its deletion.
func (r *CustomerService) Delete(ctx context.Context, customerID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if customerID == "" {
err = errors.New("missing required customer_id parameter")
return
}
path := fmt.Sprintf("customers/%s", customerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
// This endpoint is used to fetch customer details given an identifier. If the
// `Customer` is in the process of being deleted, only the properties `id` and
// `deleted: true` will be returned.
//
// See the [Customer resource](/core-concepts#customer) for a full discussion of
// the Customer model.
func (r *CustomerService) Fetch(ctx context.Context, customerID string, opts ...option.RequestOption) (res *Customer, err error) {
opts = append(r.Options[:], opts...)
if customerID == "" {
err = errors.New("missing required customer_id parameter")
return
}
path := fmt.Sprintf("customers/%s", customerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// This endpoint is used to fetch customer details given an `external_customer_id`
// (see [Customer ID Aliases](/events-and-metrics/customer-aliases)).
//
// Note that the resource and semantics of this endpoint exactly mirror
// [Get Customer](fetch-customer).
func (r *CustomerService) FetchByExternalID(ctx context.Context, externalCustomerID string, opts ...option.RequestOption) (res *Customer, err error) {
opts = append(r.Options[:], opts...)
if externalCustomerID == "" {
err = errors.New("missing required external_customer_id parameter")
return
}
path := fmt.Sprintf("customers/external_customer_id/%s", externalCustomerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Sync Orb's payment methods for the customer with their gateway.
//
// This method can be called before taking an action that may cause the customer to
// be charged, ensuring that the most up-to-date payment method is charged.
//
// **Note**: This functionality is currently only available for Stripe.
func (r *CustomerService) SyncPaymentMethodsFromGateway(ctx context.Context, customerID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if customerID == "" {
err = errors.New("missing required customer_id parameter")
return
}
path := fmt.Sprintf("customers/%s/sync_payment_methods_from_gateway", customerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, nil, opts...)
return
}
// Sync Orb's payment methods for the customer with their gateway.
//
// This method can be called before taking an action that may cause the customer to
// be charged, ensuring that the most up-to-date payment method is charged.
//
// **Note**: This functionality is currently only available for Stripe.
func (r *CustomerService) SyncPaymentMethodsFromGatewayByExternalCustomerID(ctx context.Context, externalCustomerID string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if externalCustomerID == "" {
err = errors.New("missing required external_customer_id parameter")
return
}
path := fmt.Sprintf("customers/external_customer_id/%s/sync_payment_methods_from_gateway", externalCustomerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, nil, opts...)
return
}
// This endpoint is used to update customer details given an `external_customer_id`
// (see [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that the
// resource and semantics of this endpoint exactly mirror
// [Update Customer](update-customer).
func (r *CustomerService) UpdateByExternalID(ctx context.Context, id string, body CustomerUpdateByExternalIDParams, opts ...option.RequestOption) (res *Customer, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("customers/external_customer_id/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
type AccountingProviderConfigParam struct {
ExternalProviderID param.Field[string] `json:"external_provider_id,required"`
ProviderType param.Field[string] `json:"provider_type,required"`
}
func (r AccountingProviderConfigParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type AddressInputParam struct {
City param.Field[string] `json:"city"`
Country param.Field[string] `json:"country"`
Line1 param.Field[string] `json:"line1"`
Line2 param.Field[string] `json:"line2"`
PostalCode param.Field[string] `json:"postal_code"`
State param.Field[string] `json:"state"`
}
func (r AddressInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// A customer is a buyer of your products, and the other party to the billing
// relationship.
//
// In Orb, customers are assigned system generated identifiers automatically, but
// it's often desirable to have these match existing identifiers in your system. To
// avoid having to denormalize Orb ID information, you can pass in an
// `external_customer_id` with your own identifier. See
// [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
// information about how these aliases work in Orb.
//
// In addition to having an identifier in your system, a customer may exist in a
// payment provider solution like Stripe. Use the `payment_provider_id` and the
// `payment_provider` enum field to express this mapping.
//
// A customer also has a timezone (from the standard
// [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
// your account's timezone. See [Timezone localization](/essentials/timezones) for
// information on what this timezone parameter influences within Orb.
type Customer struct {
ID string `json:"id,required"`
AdditionalEmails []string `json:"additional_emails,required"`
AutoCollection bool `json:"auto_collection,required"`
// Whether invoices for this customer should be automatically issued. If true,
// invoices will be automatically issued. If false, invoices will require manual
// approval. If null, inherits the account-level setting.
AutoIssuance bool `json:"auto_issuance,required,nullable"`
// The customer's current balance in their currency.
Balance string `json:"balance,required"`
BillingAddress shared.Address `json:"billing_address,required,nullable"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Currency string `json:"currency,required,nullable"`
// A valid customer email, to be used for notifications. When Orb triggers payment
// through a payment gateway, this email will be used for any automatically issued
// receipts.
Email string `json:"email,required"`
EmailDelivery bool `json:"email_delivery,required"`
ExemptFromAutomatedTax bool `json:"exempt_from_automated_tax,required,nullable"`
// An optional user-defined ID for this customer resource, used throughout the
// system as an alias for this Customer. Use this field to identify a customer by
// an existing identifier in your system.
ExternalCustomerID string `json:"external_customer_id,required,nullable"`
// The hierarchical relationships for this customer.
Hierarchy CustomerHierarchy `json:"hierarchy,required"`
// 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 map[string]string `json:"metadata,required"`
// The full name of the customer
Name string `json:"name,required"`
// This is used for creating charges or invoices in an external system via Orb.
// When not in test mode, the connection must first be configured in the Orb
// webapp.
PaymentProvider CustomerPaymentProvider `json:"payment_provider,required,nullable"`
// The ID of this customer in an external payments solution, such as Stripe. This
// is used for creating charges or invoices in the external system via Orb.
PaymentProviderID string `json:"payment_provider_id,required,nullable"`
PortalURL string `json:"portal_url,required,nullable"`
ShippingAddress shared.Address `json:"shipping_address,required,nullable"`
// 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 |
// | ---------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
// | Albania | `al_tin` | Albania Tax Identification Number |
// | Andorra | `ad_nrt` | Andorran NRT Number |
// | Angola | `ao_tin` | Angola Tax Identification Number |
// | Argentina | `ar_cuit` | Argentinian Tax ID Number |
// | Armenia | `am_tin` | Armenia Tax Identification Number |
// | Aruba | `aw_tin` | Aruba Tax Identification Number |
// | Australia | `au_abn` | Australian Business Number (AU ABN) |
// | Australia | `au_arn` | Australian Taxation Office Reference Number |
// | Austria | `eu_vat` | European VAT Number |
// | Azerbaijan | `az_tin` | Azerbaijan Tax Identification Number |
// | Bahamas | `bs_tin` | Bahamas Tax Identification Number |
// | Bahrain | `bh_vat` | Bahraini VAT Number |
// | Bangladesh | `bd_bin` | Bangladesh Business Identification Number |
// | Barbados | `bb_tin` | Barbados Tax Identification Number |
// | Belarus | `by_tin` | Belarus TIN Number |
// | Belgium | `eu_vat` | European VAT Number |
// | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant Fiscal Unique) |
// | Bolivia | `bo_tin` | Bolivian Tax ID |
// | Bosnia and Herzegovina | `ba_tin` | Bosnia and Herzegovina Tax Identification Number |
// | 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 |
// | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification Number (Numéro d'Identifiant Fiscal Unique) |
// | Cambodia | `kh_tin` | Cambodia Tax Identification Number |
// | Cameroon | `cm_niu` | Cameroon Tax Identification Number (Numéro d'Identifiant fiscal Unique) |
// | 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) |
// | Cape Verde | `cv_nif` | Cape Verde Tax Identification Number (Número de Identificação Fiscal) |
// | Chile | `cl_tin` | Chilean TIN |
// | China | `cn_tin` | Chinese Tax ID |
// | Colombia | `co_nit` | Colombian NIT Number |
// | Congo-Kinshasa | `cd_nif` | Congo (DR) Tax Identification Number (Número de Identificação Fiscal) |
// | Costa Rica | `cr_tin` | Costa Rican Tax ID |
// | Croatia | `eu_vat` | European VAT Number |
// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) |
// | 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 |
// | Ethiopia | `et_tin` | Ethiopia Tax Identification Number |
// | European Union | `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 | `de_stn` | German Tax Number (Steuernummer) |
// | Germany | `eu_vat` | European VAT Number |
// | Greece | `eu_vat` | European VAT Number |
// | Guinea | `gn_nif` | Guinea Tax Identification Number (Número de Identificação Fiscal) |
// | 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 |
// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number |
// | Laos | `la_tin` | Laos Tax Identification Number |
// | Latvia | `eu_vat` | European VAT Number |
// | Liechtenstein | `li_uid` | Liechtensteinian UID Number |
// | Liechtenstein | `li_vat` | Liechtenstein VAT 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 |
// | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de Identificação Fiscal) |
// | Mexico | `mx_rfc` | Mexican RFC Number |
// | Moldova | `md_vat` | Moldova VAT Number |
// | Montenegro | `me_pib` | Montenegro PIB Number |
// | Morocco | `ma_vat` | Morocco VAT Number |
// | Nepal | `np_pan` | Nepal PAN Number |
// | Netherlands | `eu_vat` | European VAT Number |
// | New Zealand | `nz_gst` | New Zealand GST Number |
// | Nigeria | `ng_tin` | Nigerian Tax Identification Number |
// | North Macedonia | `mk_vat` | North Macedonia VAT Number |
// | Northern Ireland | `eu_vat` | Northern Ireland VAT 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 |
// | Senegal | `sn_ninea` | Senegal NINEA Number |
// | 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 |
// | Suriname | `sr_fin` | Suriname FIN Number |
// | Sweden | `eu_vat` | European VAT Number |
// | Switzerland | `ch_uid` | Switzerland UID Number |
// | Switzerland | `ch_vat` | Switzerland VAT Number |
// | Taiwan | `tw_vat` | Taiwanese VAT |
// | Tajikistan | `tj_tin` | Tajikistan Tax Identification Number |
// | Tanzania | `tz_vat` | Tanzania VAT Number |
// | Thailand | `th_vat` | Thai VAT |
// | Turkey | `tr_tin` | Turkish Tax Identification Number |
// | Uganda | `ug_tin` | Uganda Tax Identification Number |
// | Ukraine | `ua_vat` | Ukrainian VAT |
// | United Arab Emirates | `ae_trn` | United Arab Emirates TRN |
// | United Kingdom | `gb_vat` | United Kingdom VAT Number |
// | United States | `us_ein` | United States EIN |
// | Uruguay | `uy_ruc` | Uruguayan RUC Number |
// | Uzbekistan | `uz_tin` | Uzbekistan TIN Number |
// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number |
// | Venezuela | `ve_rif` | Venezuelan RIF Number |
// | Vietnam | `vn_tin` | Vietnamese Tax ID Number |
// | Zambia | `zm_tin` | Zambia Tax Identification Number |
// | Zimbabwe | `zw_tin` | Zimbabwe Tax Identification Number |
TaxID shared.CustomerTaxID `json:"tax_id,required,nullable"`
// A timezone identifier from the IANA timezone database, such as
// "America/Los_Angeles". This "defaults to your account's timezone if not set.
// This cannot be changed after customer creation.
Timezone string `json:"timezone,required"`
AccountingSyncConfiguration CustomerAccountingSyncConfiguration `json:"accounting_sync_configuration,nullable"`
ReportingConfiguration CustomerReportingConfiguration `json:"reporting_configuration,nullable"`
JSON customerJSON `json:"-"`
}
// customerJSON contains the JSON metadata for the struct [Customer]
type customerJSON struct {
ID apijson.Field
AdditionalEmails apijson.Field
AutoCollection apijson.Field
AutoIssuance apijson.Field
Balance apijson.Field
BillingAddress apijson.Field
CreatedAt apijson.Field
Currency apijson.Field
Email apijson.Field
EmailDelivery apijson.Field
ExemptFromAutomatedTax apijson.Field
ExternalCustomerID apijson.Field
Hierarchy apijson.Field
Metadata apijson.Field
Name apijson.Field
PaymentProvider apijson.Field
PaymentProviderID apijson.Field
PortalURL apijson.Field
ShippingAddress apijson.Field
TaxID apijson.Field
Timezone apijson.Field
AccountingSyncConfiguration apijson.Field
ReportingConfiguration apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *Customer) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customerJSON) RawJSON() string {
return r.raw
}
// The hierarchical relationships for this customer.
type CustomerHierarchy struct {
Children []shared.CustomerMinified `json:"children,required"`
Parent shared.CustomerMinified `json:"parent,required,nullable"`
JSON customerHierarchyJSON `json:"-"`
}
// customerHierarchyJSON contains the JSON metadata for the struct
// [CustomerHierarchy]
type customerHierarchyJSON struct {
Children apijson.Field
Parent apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CustomerHierarchy) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customerHierarchyJSON) RawJSON() string {
return r.raw
}
// This is used for creating charges or invoices in an external system via Orb.
// When not in test mode, the connection must first be configured in the Orb
// webapp.
type CustomerPaymentProvider string
const (
CustomerPaymentProviderQuickbooks CustomerPaymentProvider = "quickbooks"
CustomerPaymentProviderBillCom CustomerPaymentProvider = "bill.com"
CustomerPaymentProviderStripeCharge CustomerPaymentProvider = "stripe_charge"
CustomerPaymentProviderStripeInvoice CustomerPaymentProvider = "stripe_invoice"
CustomerPaymentProviderNetsuite CustomerPaymentProvider = "netsuite"
)
func (r CustomerPaymentProvider) IsKnown() bool {
switch r {
case CustomerPaymentProviderQuickbooks, CustomerPaymentProviderBillCom, CustomerPaymentProviderStripeCharge, CustomerPaymentProviderStripeInvoice, CustomerPaymentProviderNetsuite:
return true
}
return false
}
type CustomerAccountingSyncConfiguration struct {
AccountingProviders []CustomerAccountingSyncConfigurationAccountingProvider `json:"accounting_providers,required"`
Excluded bool `json:"excluded,required"`
JSON customerAccountingSyncConfigurationJSON `json:"-"`
}
// customerAccountingSyncConfigurationJSON contains the JSON metadata for the
// struct [CustomerAccountingSyncConfiguration]
type customerAccountingSyncConfigurationJSON struct {
AccountingProviders apijson.Field
Excluded apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CustomerAccountingSyncConfiguration) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customerAccountingSyncConfigurationJSON) RawJSON() string {
return r.raw
}
type CustomerAccountingSyncConfigurationAccountingProvider struct {
ExternalProviderID string `json:"external_provider_id,required,nullable"`
ProviderType CustomerAccountingSyncConfigurationAccountingProvidersProviderType `json:"provider_type,required"`
JSON customerAccountingSyncConfigurationAccountingProviderJSON `json:"-"`
}
// customerAccountingSyncConfigurationAccountingProviderJSON contains the JSON
// metadata for the struct [CustomerAccountingSyncConfigurationAccountingProvider]
type customerAccountingSyncConfigurationAccountingProviderJSON struct {
ExternalProviderID apijson.Field
ProviderType apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CustomerAccountingSyncConfigurationAccountingProvider) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customerAccountingSyncConfigurationAccountingProviderJSON) RawJSON() string {
return r.raw
}
type CustomerAccountingSyncConfigurationAccountingProvidersProviderType string
const (
CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeQuickbooks CustomerAccountingSyncConfigurationAccountingProvidersProviderType = "quickbooks"
CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeNetsuite CustomerAccountingSyncConfigurationAccountingProvidersProviderType = "netsuite"
)
func (r CustomerAccountingSyncConfigurationAccountingProvidersProviderType) IsKnown() bool {
switch r {
case CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeQuickbooks, CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeNetsuite:
return true
}
return false
}
type CustomerReportingConfiguration struct {
Exempt bool `json:"exempt,required"`
JSON customerReportingConfigurationJSON `json:"-"`
}
// customerReportingConfigurationJSON contains the JSON metadata for the struct
// [CustomerReportingConfiguration]
type customerReportingConfigurationJSON struct {
Exempt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CustomerReportingConfiguration) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customerReportingConfigurationJSON) RawJSON() string {
return r.raw
}
type CustomerHierarchyConfigParam struct {
// A list of child customer IDs to add to the hierarchy. The desired child
// customers must not already be part of another hierarchy.
ChildCustomerIDs param.Field[[]string] `json:"child_customer_ids"`
// The ID of the parent customer in the hierarchy. The desired parent customer must
// not be a child of another customer.
ParentCustomerID param.Field[string] `json:"parent_customer_id"`
}
func (r CustomerHierarchyConfigParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type NewAccountingSyncConfigurationParam struct {
AccountingProviders param.Field[[]AccountingProviderConfigParam] `json:"accounting_providers"`
Excluded param.Field[bool] `json:"excluded"`
}
func (r NewAccountingSyncConfigurationParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type NewAvalaraTaxConfigurationParam struct {
TaxExempt param.Field[bool] `json:"tax_exempt,required"`
TaxProvider param.Field[NewAvalaraTaxConfigurationTaxProvider] `json:"tax_provider,required"`
TaxExemptionCode param.Field[string] `json:"tax_exemption_code"`
}
func (r NewAvalaraTaxConfigurationParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r NewAvalaraTaxConfigurationParam) implementsCustomerNewParamsTaxConfigurationUnion() {}
func (r NewAvalaraTaxConfigurationParam) implementsCustomerUpdateParamsTaxConfigurationUnion() {}
func (r NewAvalaraTaxConfigurationParam) implementsCustomerUpdateByExternalIDParamsTaxConfigurationUnion() {
}
type NewAvalaraTaxConfigurationTaxProvider string
const (
NewAvalaraTaxConfigurationTaxProviderAvalara NewAvalaraTaxConfigurationTaxProvider = "avalara"
)
func (r NewAvalaraTaxConfigurationTaxProvider) IsKnown() bool {
switch r {
case NewAvalaraTaxConfigurationTaxProviderAvalara:
return true
}
return false
}
type NewReportingConfigurationParam struct {
Exempt param.Field[bool] `json:"exempt,required"`
}
func (r NewReportingConfigurationParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type NewSphereConfigurationParam struct {
TaxExempt param.Field[bool] `json:"tax_exempt,required"`
TaxProvider param.Field[NewSphereConfigurationTaxProvider] `json:"tax_provider,required"`
}
func (r NewSphereConfigurationParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r NewSphereConfigurationParam) implementsCustomerNewParamsTaxConfigurationUnion() {}
func (r NewSphereConfigurationParam) implementsCustomerUpdateParamsTaxConfigurationUnion() {}
func (r NewSphereConfigurationParam) implementsCustomerUpdateByExternalIDParamsTaxConfigurationUnion() {
}
type NewSphereConfigurationTaxProvider string
const (
NewSphereConfigurationTaxProviderSphere NewSphereConfigurationTaxProvider = "sphere"
)
func (r NewSphereConfigurationTaxProvider) IsKnown() bool {
switch r {
case NewSphereConfigurationTaxProviderSphere:
return true
}
return false
}
type NewTaxJarConfigurationParam struct {
TaxExempt param.Field[bool] `json:"tax_exempt,required"`
TaxProvider param.Field[NewTaxJarConfigurationTaxProvider] `json:"tax_provider,required"`
}
func (r NewTaxJarConfigurationParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r NewTaxJarConfigurationParam) implementsCustomerNewParamsTaxConfigurationUnion() {}
func (r NewTaxJarConfigurationParam) implementsCustomerUpdateParamsTaxConfigurationUnion() {}
func (r NewTaxJarConfigurationParam) implementsCustomerUpdateByExternalIDParamsTaxConfigurationUnion() {
}
type NewTaxJarConfigurationTaxProvider string
const (
NewTaxJarConfigurationTaxProviderTaxjar NewTaxJarConfigurationTaxProvider = "taxjar"
)
func (r NewTaxJarConfigurationTaxProvider) IsKnown() bool {
switch r {
case NewTaxJarConfigurationTaxProviderTaxjar:
return true
}
return false
}
type CustomerNewParams struct {
// A valid customer email, to be used for notifications. When Orb triggers payment
// through a payment gateway, this email will be used for any automatically issued
// receipts.
Email param.Field[string] `json:"email,required" format:"email"`
// The full name of the customer
Name param.Field[string] `json:"name,required"`
AccountingSyncConfiguration param.Field[NewAccountingSyncConfigurationParam] `json:"accounting_sync_configuration"`
// Additional email addresses for this customer. If populated, these email
// addresses will be CC'd for customer communications. The total number of email
// addresses (including the primary email) cannot exceed 50.
AdditionalEmails param.Field[[]string] `json:"additional_emails" format:"email"`
// Used to determine if invoices for this customer will automatically attempt to
// charge a saved payment method, if available. This parameter defaults to `True`
// when a payment provider is provided on customer creation.
AutoCollection param.Field[bool] `json:"auto_collection"`
// Used to determine if invoices for this customer will be automatically issued. If
// true, invoices will be automatically issued. If false, invoices will require
// manual approval. If `null` is specified, the customer's auto issuance setting
// will be inherited from the account-level setting.
AutoIssuance param.Field[bool] `json:"auto_issuance"`
BillingAddress param.Field[AddressInputParam] `json:"billing_address"`
// An ISO 4217 currency string used for the customer's invoices and balance. If not
// set at creation time, will be set at subscription creation time.
Currency param.Field[string] `json:"currency"`
EmailDelivery param.Field[bool] `json:"email_delivery"`
// An optional user-defined ID for this customer resource, used throughout the
// system as an alias for this Customer. Use this field to identify a customer by
// an existing identifier in your system.
ExternalCustomerID param.Field[string] `json:"external_customer_id"`
// The hierarchical relationships for this customer.
Hierarchy param.Field[CustomerHierarchyConfigParam] `json:"hierarchy"`
// User-specified key/value pairs for the resource. 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 param.Field[map[string]string] `json:"metadata"`
// This is used for creating charges or invoices in an external system via Orb.
// When not in test mode, the connection must first be configured in the Orb
// webapp.
PaymentProvider param.Field[CustomerNewParamsPaymentProvider] `json:"payment_provider"`
// The ID of this customer in an external payments solution, such as Stripe. This
// is used for creating charges or invoices in the external system via Orb.
PaymentProviderID param.Field[string] `json:"payment_provider_id"`
ReportingConfiguration param.Field[NewReportingConfigurationParam] `json:"reporting_configuration"`
ShippingAddress param.Field[AddressInputParam] `json:"shipping_address"`
TaxConfiguration param.Field[CustomerNewParamsTaxConfigurationUnion] `json:"tax_configuration"`
// 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 |
// | ---------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
// | Albania | `al_tin` | Albania Tax Identification Number |
// | Andorra | `ad_nrt` | Andorran NRT Number |
// | Angola | `ao_tin` | Angola Tax Identification Number |
// | Argentina | `ar_cuit` | Argentinian Tax ID Number |
// | Armenia | `am_tin` | Armenia Tax Identification Number |
// | Aruba | `aw_tin` | Aruba Tax Identification Number |
// | Australia | `au_abn` | Australian Business Number (AU ABN) |
// | Australia | `au_arn` | Australian Taxation Office Reference Number |
// | Austria | `eu_vat` | European VAT Number |
// | Azerbaijan | `az_tin` | Azerbaijan Tax Identification Number |
// | Bahamas | `bs_tin` | Bahamas Tax Identification Number |
// | Bahrain | `bh_vat` | Bahraini VAT Number |
// | Bangladesh | `bd_bin` | Bangladesh Business Identification Number |
// | Barbados | `bb_tin` | Barbados Tax Identification Number |
// | Belarus | `by_tin` | Belarus TIN Number |
// | Belgium | `eu_vat` | European VAT Number |
// | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant Fiscal Unique) |
// | Bolivia | `bo_tin` | Bolivian Tax ID |
// | Bosnia and Herzegovina | `ba_tin` | Bosnia and Herzegovina Tax Identification Number |
// | 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 |
// | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification Number (Numéro d'Identifiant Fiscal Unique) |
// | Cambodia | `kh_tin` | Cambodia Tax Identification Number |
// | Cameroon | `cm_niu` | Cameroon Tax Identification Number (Numéro d'Identifiant fiscal Unique) |
// | 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) |
// | Cape Verde | `cv_nif` | Cape Verde Tax Identification Number (Número de Identificação Fiscal) |
// | Chile | `cl_tin` | Chilean TIN |
// | China | `cn_tin` | Chinese Tax ID |
// | Colombia | `co_nit` | Colombian NIT Number |
// | Congo-Kinshasa | `cd_nif` | Congo (DR) Tax Identification Number (Número de Identificação Fiscal) |
// | Costa Rica | `cr_tin` | Costa Rican Tax ID |
// | Croatia | `eu_vat` | European VAT Number |
// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) |
// | 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 |
// | Ethiopia | `et_tin` | Ethiopia Tax Identification Number |
// | European Union | `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 | `de_stn` | German Tax Number (Steuernummer) |
// | Germany | `eu_vat` | European VAT Number |
// | Greece | `eu_vat` | European VAT Number |
// | Guinea | `gn_nif` | Guinea Tax Identification Number (Número de Identificação Fiscal) |
// | 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 |
// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number |
// | Laos | `la_tin` | Laos Tax Identification Number |
// | Latvia | `eu_vat` | European VAT Number |
// | Liechtenstein | `li_uid` | Liechtensteinian UID Number |
// | Liechtenstein | `li_vat` | Liechtenstein VAT 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 |
// | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de Identificação Fiscal) |
// | Mexico | `mx_rfc` | Mexican RFC Number |
// | Moldova | `md_vat` | Moldova VAT Number |
// | Montenegro | `me_pib` | Montenegro PIB Number |
// | Morocco | `ma_vat` | Morocco VAT Number |
// | Nepal | `np_pan` | Nepal PAN Number |
// | Netherlands | `eu_vat` | European VAT Number |
// | New Zealand | `nz_gst` | New Zealand GST Number |
// | Nigeria | `ng_tin` | Nigerian Tax Identification Number |
// | North Macedonia | `mk_vat` | North Macedonia VAT Number |
// | Northern Ireland | `eu_vat` | Northern Ireland VAT 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 |
// | Senegal | `sn_ninea` | Senegal NINEA Number |
// | 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 |
// | Suriname | `sr_fin` | Suriname FIN Number |
// | Sweden | `eu_vat` | European VAT Number |
// | Switzerland | `ch_uid` | Switzerland UID Number |
// | Switzerland | `ch_vat` | Switzerland VAT Number |
// | Taiwan | `tw_vat` | Taiwanese VAT |
// | Tajikistan | `tj_tin` | Tajikistan Tax Identification Number |
// | Tanzania | `tz_vat` | Tanzania VAT Number |
// | Thailand | `th_vat` | Thai VAT |
// | Turkey | `tr_tin` | Turkish Tax Identification Number |
// | Uganda | `ug_tin` | Uganda Tax Identification Number |
// | Ukraine | `ua_vat` | Ukrainian VAT |
// | United Arab Emirates | `ae_trn` | United Arab Emirates TRN |
// | United Kingdom | `gb_vat` | United Kingdom VAT Number |
// | United States | `us_ein` | United States EIN |
// | Uruguay | `uy_ruc` | Uruguayan RUC Number |
// | Uzbekistan | `uz_tin` | Uzbekistan TIN Number |
// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number |
// | Venezuela | `ve_rif` | Venezuelan RIF Number |
// | Vietnam | `vn_tin` | Vietnamese Tax ID Number |
// | Zambia | `zm_tin` | Zambia Tax Identification Number |
// | Zimbabwe | `zw_tin` | Zimbabwe Tax Identification Number |
TaxID param.Field[shared.CustomerTaxIDParam] `json:"tax_id"`
// A timezone identifier from the IANA timezone database, such as
// `"America/Los_Angeles"`. This defaults to your account's timezone if not set.
// This cannot be changed after customer creation.
Timezone param.Field[string] `json:"timezone"`
}
func (r CustomerNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// This is used for creating charges or invoices in an external system via Orb.
// When not in test mode, the connection must first be configured in the Orb
// webapp.
type CustomerNewParamsPaymentProvider string
const (
CustomerNewParamsPaymentProviderQuickbooks CustomerNewParamsPaymentProvider = "quickbooks"
CustomerNewParamsPaymentProviderBillCom CustomerNewParamsPaymentProvider = "bill.com"
CustomerNewParamsPaymentProviderStripeCharge CustomerNewParamsPaymentProvider = "stripe_charge"
CustomerNewParamsPaymentProviderStripeInvoice CustomerNewParamsPaymentProvider = "stripe_invoice"
CustomerNewParamsPaymentProviderNetsuite CustomerNewParamsPaymentProvider = "netsuite"
)
func (r CustomerNewParamsPaymentProvider) IsKnown() bool {
switch r {
case CustomerNewParamsPaymentProviderQuickbooks, CustomerNewParamsPaymentProviderBillCom, CustomerNewParamsPaymentProviderStripeCharge, CustomerNewParamsPaymentProviderStripeInvoice, CustomerNewParamsPaymentProviderNetsuite:
return true
}
return false
}
type CustomerNewParamsTaxConfiguration struct {
TaxExempt param.Field[bool] `json:"tax_exempt,required"`
TaxProvider param.Field[CustomerNewParamsTaxConfigurationTaxProvider] `json:"tax_provider,required"`
TaxExemptionCode param.Field[string] `json:"tax_exemption_code"`
}
func (r CustomerNewParamsTaxConfiguration) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r CustomerNewParamsTaxConfiguration) implementsCustomerNewParamsTaxConfigurationUnion() {}
// Satisfied by [NewAvalaraTaxConfigurationParam], [NewTaxJarConfigurationParam],
// [NewSphereConfigurationParam],
// [CustomerNewParamsTaxConfigurationNewNumeralConfiguration],
// [CustomerNewParamsTaxConfiguration].
type CustomerNewParamsTaxConfigurationUnion interface {
implementsCustomerNewParamsTaxConfigurationUnion()
}
type CustomerNewParamsTaxConfigurationNewNumeralConfiguration struct {
TaxExempt param.Field[bool] `json:"tax_exempt,required"`
TaxProvider param.Field[CustomerNewParamsTaxConfigurationNewNumeralConfigurationTaxProvider] `json:"tax_provider,required"`
}
func (r CustomerNewParamsTaxConfigurationNewNumeralConfiguration) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r CustomerNewParamsTaxConfigurationNewNumeralConfiguration) implementsCustomerNewParamsTaxConfigurationUnion() {
}
type CustomerNewParamsTaxConfigurationNewNumeralConfigurationTaxProvider string
const (
CustomerNewParamsTaxConfigurationNewNumeralConfigurationTaxProviderNumeral CustomerNewParamsTaxConfigurationNewNumeralConfigurationTaxProvider = "numeral"