-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcardpayment.go
More file actions
8550 lines (7567 loc) · 489 KB
/
cardpayment.go
File metadata and controls
8550 lines (7567 loc) · 489 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 increase
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"slices"
"time"
"github.com/Increase/increase-go/internal/apijson"
"github.com/Increase/increase-go/internal/apiquery"
"github.com/Increase/increase-go/internal/param"
"github.com/Increase/increase-go/internal/requestconfig"
"github.com/Increase/increase-go/option"
"github.com/Increase/increase-go/packages/pagination"
)
// CardPaymentService contains methods and other services that help with
// interacting with the increase 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 [NewCardPaymentService] method instead.
type CardPaymentService struct {
Options []option.RequestOption
}
// NewCardPaymentService 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 NewCardPaymentService(opts ...option.RequestOption) (r *CardPaymentService) {
r = &CardPaymentService{}
r.Options = opts
return
}
// Retrieve a Card Payment
func (r *CardPaymentService) Get(ctx context.Context, cardPaymentID string, opts ...option.RequestOption) (res *CardPayment, err error) {
opts = slices.Concat(r.Options, opts)
if cardPaymentID == "" {
err = errors.New("missing required card_payment_id parameter")
return nil, err
}
path := fmt.Sprintf("card_payments/%s", cardPaymentID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// List Card Payments
func (r *CardPaymentService) List(ctx context.Context, query CardPaymentListParams, opts ...option.RequestOption) (res *pagination.Page[CardPayment], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "card_payments"
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
}
// List Card Payments
func (r *CardPaymentService) ListAutoPaging(ctx context.Context, query CardPaymentListParams, opts ...option.RequestOption) *pagination.PageAutoPager[CardPayment] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Card Payments group together interactions related to a single card payment, such
// as an authorization and its corresponding settlement.
type CardPayment struct {
// The Card Payment identifier.
ID string `json:"id" api:"required"`
// The identifier for the Account the Transaction belongs to.
AccountID string `json:"account_id" api:"required"`
// The Card identifier for this payment.
CardID string `json:"card_id" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
// Payment was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The Digital Wallet Token identifier for this payment.
DigitalWalletTokenID string `json:"digital_wallet_token_id" api:"required,nullable"`
// The interactions related to this card payment.
Elements []CardPaymentElement `json:"elements" api:"required"`
// The Physical Card identifier for this payment.
PhysicalCardID string `json:"physical_card_id" api:"required,nullable"`
// The scheme fees associated with this card payment.
SchemeFees []CardPaymentSchemeFee `json:"scheme_fees" api:"required"`
// The summarized state of this card payment.
State CardPaymentState `json:"state" api:"required"`
// A constant representing the object's type. For this resource it will always be
// `card_payment`.
Type CardPaymentType `json:"type" api:"required"`
JSON cardPaymentJSON `json:"-"`
}
// cardPaymentJSON contains the JSON metadata for the struct [CardPayment]
type cardPaymentJSON struct {
ID apijson.Field
AccountID apijson.Field
CardID apijson.Field
CreatedAt apijson.Field
DigitalWalletTokenID apijson.Field
Elements apijson.Field
PhysicalCardID apijson.Field
SchemeFees apijson.Field
State apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPayment) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentJSON) RawJSON() string {
return r.raw
}
type CardPaymentElement struct {
// The type of the resource. We may add additional possible values for this enum
// over time; your application should be able to handle such additions gracefully.
Category CardPaymentElementsCategory `json:"category" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the card payment element was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// A Card Authentication object. This field will be present in the JSON response if
// and only if `category` is equal to `card_authentication`. Card Authentications
// are attempts to authenticate a transaction or a card with 3DS.
CardAuthentication CardPaymentElementsCardAuthentication `json:"card_authentication" api:"nullable"`
// A Card Authorization object. This field will be present in the JSON response if
// and only if `category` is equal to `card_authorization`. Card Authorizations are
// temporary holds placed on a customer's funds with the intent to later clear a
// transaction.
CardAuthorization CardPaymentElementsCardAuthorization `json:"card_authorization" api:"nullable"`
// A Card Authorization Expiration object. This field will be present in the JSON
// response if and only if `category` is equal to `card_authorization_expiration`.
// Card Authorization Expirations are cancellations of authorizations that were
// never settled by the acquirer.
CardAuthorizationExpiration CardPaymentElementsCardAuthorizationExpiration `json:"card_authorization_expiration" api:"nullable"`
// A Card Balance Inquiry object. This field will be present in the JSON response
// if and only if `category` is equal to `card_balance_inquiry`. Card Balance
// Inquiries are transactions that allow merchants to check the available balance
// on a card without placing a hold on funds, commonly used when a customer
// requests their balance at an ATM.
CardBalanceInquiry CardPaymentElementsCardBalanceInquiry `json:"card_balance_inquiry" api:"nullable"`
// A Card Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `card_decline`.
CardDecline CardPaymentElementsCardDecline `json:"card_decline" api:"nullable"`
// A Card Financial object. This field will be present in the JSON response if and
// only if `category` is equal to `card_financial`. Card Financials are temporary
// holds placed on a customer's funds with the intent to later clear a transaction.
CardFinancial CardPaymentElementsCardFinancial `json:"card_financial" api:"nullable"`
// A Card Fuel Confirmation object. This field will be present in the JSON response
// if and only if `category` is equal to `card_fuel_confirmation`. Card Fuel
// Confirmations update the amount of a Card Authorization after a fuel pump
// transaction is completed.
CardFuelConfirmation CardPaymentElementsCardFuelConfirmation `json:"card_fuel_confirmation" api:"nullable"`
// A Card Increment object. This field will be present in the JSON response if and
// only if `category` is equal to `card_increment`. Card Increments increase the
// pending amount of an authorized transaction.
CardIncrement CardPaymentElementsCardIncrement `json:"card_increment" api:"nullable"`
// A Card Refund object. This field will be present in the JSON response if and
// only if `category` is equal to `card_refund`. Card Refunds move money back to
// the cardholder. While they are usually connected to a Card Settlement, an
// acquirer can also refund money directly to a card without relation to a
// transaction.
CardRefund CardPaymentElementsCardRefund `json:"card_refund" api:"nullable"`
// A Card Reversal object. This field will be present in the JSON response if and
// only if `category` is equal to `card_reversal`. Card Reversals cancel parts of
// or the entirety of an existing Card Authorization.
CardReversal CardPaymentElementsCardReversal `json:"card_reversal" api:"nullable"`
// A Card Settlement object. This field will be present in the JSON response if and
// only if `category` is equal to `card_settlement`. Card Settlements are card
// transactions that have cleared and settled. While a settlement is usually
// preceded by an authorization, an acquirer can also directly clear a transaction
// without first authorizing it.
CardSettlement CardPaymentElementsCardSettlement `json:"card_settlement" api:"nullable"`
// An Inbound Card Validation object. This field will be present in the JSON
// response if and only if `category` is equal to `card_validation`. Inbound Card
// Validations are requests from a merchant to verify that a card number and
// optionally its address and/or Card Verification Value are valid.
CardValidation CardPaymentElementsCardValidation `json:"card_validation" api:"nullable"`
// If the category of this Transaction source is equal to `other`, this field will
// contain an empty object, otherwise it will contain null.
Other CardPaymentElementsOther `json:"other" api:"nullable"`
JSON cardPaymentElementJSON `json:"-"`
}
// cardPaymentElementJSON contains the JSON metadata for the struct
// [CardPaymentElement]
type cardPaymentElementJSON struct {
Category apijson.Field
CreatedAt apijson.Field
CardAuthentication apijson.Field
CardAuthorization apijson.Field
CardAuthorizationExpiration apijson.Field
CardBalanceInquiry apijson.Field
CardDecline apijson.Field
CardFinancial apijson.Field
CardFuelConfirmation apijson.Field
CardIncrement apijson.Field
CardRefund apijson.Field
CardReversal apijson.Field
CardSettlement apijson.Field
CardValidation apijson.Field
Other apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElement) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementJSON) RawJSON() string {
return r.raw
}
// The type of the resource. We may add additional possible values for this enum
// over time; your application should be able to handle such additions gracefully.
type CardPaymentElementsCategory string
const (
CardPaymentElementsCategoryCardAuthorization CardPaymentElementsCategory = "card_authorization"
CardPaymentElementsCategoryCardAuthentication CardPaymentElementsCategory = "card_authentication"
CardPaymentElementsCategoryCardBalanceInquiry CardPaymentElementsCategory = "card_balance_inquiry"
CardPaymentElementsCategoryCardValidation CardPaymentElementsCategory = "card_validation"
CardPaymentElementsCategoryCardDecline CardPaymentElementsCategory = "card_decline"
CardPaymentElementsCategoryCardReversal CardPaymentElementsCategory = "card_reversal"
CardPaymentElementsCategoryCardAuthorizationExpiration CardPaymentElementsCategory = "card_authorization_expiration"
CardPaymentElementsCategoryCardIncrement CardPaymentElementsCategory = "card_increment"
CardPaymentElementsCategoryCardSettlement CardPaymentElementsCategory = "card_settlement"
CardPaymentElementsCategoryCardRefund CardPaymentElementsCategory = "card_refund"
CardPaymentElementsCategoryCardFuelConfirmation CardPaymentElementsCategory = "card_fuel_confirmation"
CardPaymentElementsCategoryCardFinancial CardPaymentElementsCategory = "card_financial"
CardPaymentElementsCategoryOther CardPaymentElementsCategory = "other"
)
func (r CardPaymentElementsCategory) IsKnown() bool {
switch r {
case CardPaymentElementsCategoryCardAuthorization, CardPaymentElementsCategoryCardAuthentication, CardPaymentElementsCategoryCardBalanceInquiry, CardPaymentElementsCategoryCardValidation, CardPaymentElementsCategoryCardDecline, CardPaymentElementsCategoryCardReversal, CardPaymentElementsCategoryCardAuthorizationExpiration, CardPaymentElementsCategoryCardIncrement, CardPaymentElementsCategoryCardSettlement, CardPaymentElementsCategoryCardRefund, CardPaymentElementsCategoryCardFuelConfirmation, CardPaymentElementsCategoryCardFinancial, CardPaymentElementsCategoryOther:
return true
}
return false
}
// A Card Authentication object. This field will be present in the JSON response if
// and only if `category` is equal to `card_authentication`. Card Authentications
// are attempts to authenticate a transaction or a card with 3DS.
type CardPaymentElementsCardAuthentication struct {
// The Card Authentication identifier.
ID string `json:"id" api:"required"`
// A unique identifier assigned by the Access Control Server (us) for this
// transaction.
AccessControlServerTransactionIdentifier string `json:"access_control_server_transaction_identifier" api:"required"`
// The city of the cardholder billing address associated with the card used for
// this purchase.
BillingAddressCity string `json:"billing_address_city" api:"required,nullable"`
// The country of the cardholder billing address associated with the card used for
// this purchase.
BillingAddressCountry string `json:"billing_address_country" api:"required,nullable"`
// The first line of the cardholder billing address associated with the card used
// for this purchase.
BillingAddressLine1 string `json:"billing_address_line1" api:"required,nullable"`
// The second line of the cardholder billing address associated with the card used
// for this purchase.
BillingAddressLine2 string `json:"billing_address_line2" api:"required,nullable"`
// The third line of the cardholder billing address associated with the card used
// for this purchase.
BillingAddressLine3 string `json:"billing_address_line3" api:"required,nullable"`
// The postal code of the cardholder billing address associated with the card used
// for this purchase.
BillingAddressPostalCode string `json:"billing_address_postal_code" api:"required,nullable"`
// The US state of the cardholder billing address associated with the card used for
// this purchase.
BillingAddressState string `json:"billing_address_state" api:"required,nullable"`
// The identifier of the Card.
CardID string `json:"card_id" api:"required"`
// The ID of the Card Payment this transaction belongs to.
CardPaymentID string `json:"card_payment_id" api:"required"`
// The email address of the cardholder.
CardholderEmail string `json:"cardholder_email" api:"required,nullable"`
// The name of the cardholder.
CardholderName string `json:"cardholder_name" api:"required,nullable"`
// Details about the challenge, if one was requested.
Challenge CardPaymentElementsCardAuthenticationChallenge `json:"challenge" api:"required,nullable"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
// Authentication was attempted.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The reason why this authentication attempt was denied, if it was.
DenyReason CardPaymentElementsCardAuthenticationDenyReason `json:"deny_reason" api:"required,nullable"`
// The device channel of the card authentication attempt.
DeviceChannel CardPaymentElementsCardAuthenticationDeviceChannel `json:"device_channel" api:"required"`
// A unique identifier assigned by the Directory Server (the card network) for this
// transaction.
DirectoryServerTransactionIdentifier string `json:"directory_server_transaction_identifier" api:"required"`
// The merchant identifier (commonly abbreviated as MID) of the merchant the card
// is transacting with.
MerchantAcceptorID string `json:"merchant_acceptor_id" api:"required,nullable"`
// The Merchant Category Code (commonly abbreviated as MCC) of the merchant the
// card is transacting with.
MerchantCategoryCode string `json:"merchant_category_code" api:"required,nullable"`
// The country the merchant resides in.
MerchantCountry string `json:"merchant_country" api:"required,nullable"`
// The name of the merchant.
MerchantName string `json:"merchant_name" api:"required,nullable"`
// The message category of the card authentication attempt.
MessageCategory CardPaymentElementsCardAuthenticationMessageCategory `json:"message_category" api:"required"`
// The ID of a prior Card Authentication that the requestor used to authenticate
// this cardholder for a previous transaction.
PriorAuthenticatedCardPaymentID string `json:"prior_authenticated_card_payment_id" api:"required,nullable"`
// The identifier of the Real-Time Decision sent to approve or decline this
// authentication attempt.
RealTimeDecisionID string `json:"real_time_decision_id" api:"required,nullable"`
// The 3DS requestor authentication indicator describes why the authentication
// attempt is performed, such as for a recurring transaction.
RequestorAuthenticationIndicator CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator `json:"requestor_authentication_indicator" api:"required,nullable"`
// Indicates whether a challenge is requested for this transaction.
RequestorChallengeIndicator CardPaymentElementsCardAuthenticationRequestorChallengeIndicator `json:"requestor_challenge_indicator" api:"required,nullable"`
// The name of the 3DS requestor.
RequestorName string `json:"requestor_name" api:"required"`
// The URL of the 3DS requestor.
RequestorURL string `json:"requestor_url" api:"required"`
// The city of the shipping address associated with this purchase.
ShippingAddressCity string `json:"shipping_address_city" api:"required,nullable"`
// The country of the shipping address associated with this purchase.
ShippingAddressCountry string `json:"shipping_address_country" api:"required,nullable"`
// The first line of the shipping address associated with this purchase.
ShippingAddressLine1 string `json:"shipping_address_line1" api:"required,nullable"`
// The second line of the shipping address associated with this purchase.
ShippingAddressLine2 string `json:"shipping_address_line2" api:"required,nullable"`
// The third line of the shipping address associated with this purchase.
ShippingAddressLine3 string `json:"shipping_address_line3" api:"required,nullable"`
// The postal code of the shipping address associated with this purchase.
ShippingAddressPostalCode string `json:"shipping_address_postal_code" api:"required,nullable"`
// The US state of the shipping address associated with this purchase.
ShippingAddressState string `json:"shipping_address_state" api:"required,nullable"`
// The status of the card authentication.
Status CardPaymentElementsCardAuthenticationStatus `json:"status" api:"required"`
// A unique identifier assigned by the 3DS Server initiating the authentication
// attempt for this transaction.
ThreeDSecureServerTransactionIdentifier string `json:"three_d_secure_server_transaction_identifier" api:"required"`
// A constant representing the object's type. For this resource it will always be
// `card_authentication`.
Type CardPaymentElementsCardAuthenticationType `json:"type" api:"required"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON cardPaymentElementsCardAuthenticationJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationJSON contains the JSON metadata for the
// struct [CardPaymentElementsCardAuthentication]
type cardPaymentElementsCardAuthenticationJSON struct {
ID apijson.Field
AccessControlServerTransactionIdentifier apijson.Field
BillingAddressCity apijson.Field
BillingAddressCountry apijson.Field
BillingAddressLine1 apijson.Field
BillingAddressLine2 apijson.Field
BillingAddressLine3 apijson.Field
BillingAddressPostalCode apijson.Field
BillingAddressState apijson.Field
CardID apijson.Field
CardPaymentID apijson.Field
CardholderEmail apijson.Field
CardholderName apijson.Field
Challenge apijson.Field
CreatedAt apijson.Field
DenyReason apijson.Field
DeviceChannel apijson.Field
DirectoryServerTransactionIdentifier apijson.Field
MerchantAcceptorID apijson.Field
MerchantCategoryCode apijson.Field
MerchantCountry apijson.Field
MerchantName apijson.Field
MessageCategory apijson.Field
PriorAuthenticatedCardPaymentID apijson.Field
RealTimeDecisionID apijson.Field
RequestorAuthenticationIndicator apijson.Field
RequestorChallengeIndicator apijson.Field
RequestorName apijson.Field
RequestorURL apijson.Field
ShippingAddressCity apijson.Field
ShippingAddressCountry apijson.Field
ShippingAddressLine1 apijson.Field
ShippingAddressLine2 apijson.Field
ShippingAddressLine3 apijson.Field
ShippingAddressPostalCode apijson.Field
ShippingAddressState apijson.Field
Status apijson.Field
ThreeDSecureServerTransactionIdentifier apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthentication) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationJSON) RawJSON() string {
return r.raw
}
// Details about the challenge, if one was requested.
type CardPaymentElementsCardAuthenticationChallenge struct {
// Details about the challenge verification attempts, if any happened.
Attempts []CardPaymentElementsCardAuthenticationChallengeAttempt `json:"attempts" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
// Authentication Challenge was started.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The one-time code used for the Card Authentication Challenge.
OneTimeCode string `json:"one_time_code" api:"required"`
// The identifier of the Real-Time Decision used to deliver this challenge.
RealTimeDecisionID string `json:"real_time_decision_id" api:"required,nullable"`
// The method used to verify the Card Authentication Challenge.
VerificationMethod CardPaymentElementsCardAuthenticationChallengeVerificationMethod `json:"verification_method" api:"required"`
// E.g., the email address or phone number used for the Card Authentication
// Challenge.
VerificationValue string `json:"verification_value" api:"required,nullable"`
JSON cardPaymentElementsCardAuthenticationChallengeJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationChallengeJSON contains the JSON metadata
// for the struct [CardPaymentElementsCardAuthenticationChallenge]
type cardPaymentElementsCardAuthenticationChallengeJSON struct {
Attempts apijson.Field
CreatedAt apijson.Field
OneTimeCode apijson.Field
RealTimeDecisionID apijson.Field
VerificationMethod apijson.Field
VerificationValue apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationChallenge) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationChallengeJSON) RawJSON() string {
return r.raw
}
type CardPaymentElementsCardAuthenticationChallengeAttempt struct {
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time of the Card
// Authentication Challenge Attempt.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The outcome of the Card Authentication Challenge Attempt.
Outcome CardPaymentElementsCardAuthenticationChallengeAttemptsOutcome `json:"outcome" api:"required"`
JSON cardPaymentElementsCardAuthenticationChallengeAttemptJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationChallengeAttemptJSON contains the JSON
// metadata for the struct [CardPaymentElementsCardAuthenticationChallengeAttempt]
type cardPaymentElementsCardAuthenticationChallengeAttemptJSON struct {
CreatedAt apijson.Field
Outcome apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationChallengeAttempt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationChallengeAttemptJSON) RawJSON() string {
return r.raw
}
// The outcome of the Card Authentication Challenge Attempt.
type CardPaymentElementsCardAuthenticationChallengeAttemptsOutcome string
const (
CardPaymentElementsCardAuthenticationChallengeAttemptsOutcomeSuccessful CardPaymentElementsCardAuthenticationChallengeAttemptsOutcome = "successful"
CardPaymentElementsCardAuthenticationChallengeAttemptsOutcomeFailed CardPaymentElementsCardAuthenticationChallengeAttemptsOutcome = "failed"
)
func (r CardPaymentElementsCardAuthenticationChallengeAttemptsOutcome) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationChallengeAttemptsOutcomeSuccessful, CardPaymentElementsCardAuthenticationChallengeAttemptsOutcomeFailed:
return true
}
return false
}
// The method used to verify the Card Authentication Challenge.
type CardPaymentElementsCardAuthenticationChallengeVerificationMethod string
const (
CardPaymentElementsCardAuthenticationChallengeVerificationMethodTextMessage CardPaymentElementsCardAuthenticationChallengeVerificationMethod = "text_message"
CardPaymentElementsCardAuthenticationChallengeVerificationMethodEmail CardPaymentElementsCardAuthenticationChallengeVerificationMethod = "email"
CardPaymentElementsCardAuthenticationChallengeVerificationMethodNoneAvailable CardPaymentElementsCardAuthenticationChallengeVerificationMethod = "none_available"
)
func (r CardPaymentElementsCardAuthenticationChallengeVerificationMethod) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationChallengeVerificationMethodTextMessage, CardPaymentElementsCardAuthenticationChallengeVerificationMethodEmail, CardPaymentElementsCardAuthenticationChallengeVerificationMethodNoneAvailable:
return true
}
return false
}
// The reason why this authentication attempt was denied, if it was.
type CardPaymentElementsCardAuthenticationDenyReason string
const (
CardPaymentElementsCardAuthenticationDenyReasonGroupLocked CardPaymentElementsCardAuthenticationDenyReason = "group_locked"
CardPaymentElementsCardAuthenticationDenyReasonCardNotActive CardPaymentElementsCardAuthenticationDenyReason = "card_not_active"
CardPaymentElementsCardAuthenticationDenyReasonEntityNotActive CardPaymentElementsCardAuthenticationDenyReason = "entity_not_active"
CardPaymentElementsCardAuthenticationDenyReasonTransactionNotAllowed CardPaymentElementsCardAuthenticationDenyReason = "transaction_not_allowed"
CardPaymentElementsCardAuthenticationDenyReasonWebhookDenied CardPaymentElementsCardAuthenticationDenyReason = "webhook_denied"
CardPaymentElementsCardAuthenticationDenyReasonWebhookTimedOut CardPaymentElementsCardAuthenticationDenyReason = "webhook_timed_out"
)
func (r CardPaymentElementsCardAuthenticationDenyReason) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationDenyReasonGroupLocked, CardPaymentElementsCardAuthenticationDenyReasonCardNotActive, CardPaymentElementsCardAuthenticationDenyReasonEntityNotActive, CardPaymentElementsCardAuthenticationDenyReasonTransactionNotAllowed, CardPaymentElementsCardAuthenticationDenyReasonWebhookDenied, CardPaymentElementsCardAuthenticationDenyReasonWebhookTimedOut:
return true
}
return false
}
// The device channel of the card authentication attempt.
type CardPaymentElementsCardAuthenticationDeviceChannel struct {
// Fields specific to the browser device channel.
Browser CardPaymentElementsCardAuthenticationDeviceChannelBrowser `json:"browser" api:"required,nullable"`
// The category of the device channel.
Category CardPaymentElementsCardAuthenticationDeviceChannelCategory `json:"category" api:"required"`
// Fields specific to merchant initiated transactions.
MerchantInitiated CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiated `json:"merchant_initiated" api:"required,nullable"`
JSON cardPaymentElementsCardAuthenticationDeviceChannelJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationDeviceChannelJSON contains the JSON
// metadata for the struct [CardPaymentElementsCardAuthenticationDeviceChannel]
type cardPaymentElementsCardAuthenticationDeviceChannelJSON struct {
Browser apijson.Field
Category apijson.Field
MerchantInitiated apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationDeviceChannel) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationDeviceChannelJSON) RawJSON() string {
return r.raw
}
// Fields specific to the browser device channel.
type CardPaymentElementsCardAuthenticationDeviceChannelBrowser struct {
// The accept header from the cardholder's browser.
AcceptHeader string `json:"accept_header" api:"required,nullable"`
// The IP address of the cardholder's browser.
IPAddress string `json:"ip_address" api:"required,nullable"`
// Whether JavaScript is enabled in the cardholder's browser.
JavascriptEnabled CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabled `json:"javascript_enabled" api:"required,nullable"`
// The language of the cardholder's browser.
Language string `json:"language" api:"required,nullable"`
// The user agent of the cardholder's browser.
UserAgent string `json:"user_agent" api:"required,nullable"`
JSON cardPaymentElementsCardAuthenticationDeviceChannelBrowserJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationDeviceChannelBrowserJSON contains the JSON
// metadata for the struct
// [CardPaymentElementsCardAuthenticationDeviceChannelBrowser]
type cardPaymentElementsCardAuthenticationDeviceChannelBrowserJSON struct {
AcceptHeader apijson.Field
IPAddress apijson.Field
JavascriptEnabled apijson.Field
Language apijson.Field
UserAgent apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationDeviceChannelBrowser) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationDeviceChannelBrowserJSON) RawJSON() string {
return r.raw
}
// Whether JavaScript is enabled in the cardholder's browser.
type CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabled string
const (
CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabledEnabled CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabled = "enabled"
CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabledDisabled CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabled = "disabled"
)
func (r CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabled) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabledEnabled, CardPaymentElementsCardAuthenticationDeviceChannelBrowserJavascriptEnabledDisabled:
return true
}
return false
}
// The category of the device channel.
type CardPaymentElementsCardAuthenticationDeviceChannelCategory string
const (
CardPaymentElementsCardAuthenticationDeviceChannelCategoryApp CardPaymentElementsCardAuthenticationDeviceChannelCategory = "app"
CardPaymentElementsCardAuthenticationDeviceChannelCategoryBrowser CardPaymentElementsCardAuthenticationDeviceChannelCategory = "browser"
CardPaymentElementsCardAuthenticationDeviceChannelCategoryThreeDSRequestorInitiated CardPaymentElementsCardAuthenticationDeviceChannelCategory = "three_ds_requestor_initiated"
)
func (r CardPaymentElementsCardAuthenticationDeviceChannelCategory) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationDeviceChannelCategoryApp, CardPaymentElementsCardAuthenticationDeviceChannelCategoryBrowser, CardPaymentElementsCardAuthenticationDeviceChannelCategoryThreeDSRequestorInitiated:
return true
}
return false
}
// Fields specific to merchant initiated transactions.
type CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiated struct {
// The merchant initiated indicator for the transaction.
Indicator CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator `json:"indicator" api:"required"`
JSON cardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedJSON contains
// the JSON metadata for the struct
// [CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiated]
type cardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedJSON struct {
Indicator apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiated) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedJSON) RawJSON() string {
return r.raw
}
// The merchant initiated indicator for the transaction.
type CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator string
const (
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorRecurringTransaction CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "recurring_transaction"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorInstallmentTransaction CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "installment_transaction"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorAddCard CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "add_card"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorMaintainCardInformation CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "maintain_card_information"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorAccountVerification CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "account_verification"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorSplitDelayedShipment CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "split_delayed_shipment"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorTopUp CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "top_up"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorMailOrder CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "mail_order"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorTelephoneOrder CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "telephone_order"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorWhitelistStatusCheck CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "whitelist_status_check"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorOtherPayment CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "other_payment"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorBillingAgreement CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "billing_agreement"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDeviceBindingStatusCheck CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "device_binding_status_check"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorCardSecurityCodeStatusCheck CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "card_security_code_status_check"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDelayedShipment CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "delayed_shipment"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorSplitPayment CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "split_payment"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorFidoCredentialDeletion CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "fido_credential_deletion"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorFidoCredentialRegistration CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "fido_credential_registration"
CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDecoupledAuthenticationFallback CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator = "decoupled_authentication_fallback"
)
func (r CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicator) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorRecurringTransaction, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorInstallmentTransaction, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorAddCard, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorMaintainCardInformation, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorAccountVerification, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorSplitDelayedShipment, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorTopUp, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorMailOrder, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorTelephoneOrder, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorWhitelistStatusCheck, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorOtherPayment, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorBillingAgreement, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDeviceBindingStatusCheck, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorCardSecurityCodeStatusCheck, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDelayedShipment, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorSplitPayment, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorFidoCredentialDeletion, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorFidoCredentialRegistration, CardPaymentElementsCardAuthenticationDeviceChannelMerchantInitiatedIndicatorDecoupledAuthenticationFallback:
return true
}
return false
}
// The message category of the card authentication attempt.
type CardPaymentElementsCardAuthenticationMessageCategory struct {
// The category of the card authentication attempt.
Category CardPaymentElementsCardAuthenticationMessageCategoryCategory `json:"category" api:"required"`
// Fields specific to non-payment authentication attempts.
NonPayment CardPaymentElementsCardAuthenticationMessageCategoryNonPayment `json:"non_payment" api:"required,nullable"`
// Fields specific to payment authentication attempts.
Payment CardPaymentElementsCardAuthenticationMessageCategoryPayment `json:"payment" api:"required,nullable"`
JSON cardPaymentElementsCardAuthenticationMessageCategoryJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationMessageCategoryJSON contains the JSON
// metadata for the struct [CardPaymentElementsCardAuthenticationMessageCategory]
type cardPaymentElementsCardAuthenticationMessageCategoryJSON struct {
Category apijson.Field
NonPayment apijson.Field
Payment apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationMessageCategory) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationMessageCategoryJSON) RawJSON() string {
return r.raw
}
// The category of the card authentication attempt.
type CardPaymentElementsCardAuthenticationMessageCategoryCategory string
const (
CardPaymentElementsCardAuthenticationMessageCategoryCategoryPaymentAuthentication CardPaymentElementsCardAuthenticationMessageCategoryCategory = "payment_authentication"
CardPaymentElementsCardAuthenticationMessageCategoryCategoryNonPaymentAuthentication CardPaymentElementsCardAuthenticationMessageCategoryCategory = "non_payment_authentication"
)
func (r CardPaymentElementsCardAuthenticationMessageCategoryCategory) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationMessageCategoryCategoryPaymentAuthentication, CardPaymentElementsCardAuthenticationMessageCategoryCategoryNonPaymentAuthentication:
return true
}
return false
}
// Fields specific to non-payment authentication attempts.
type CardPaymentElementsCardAuthenticationMessageCategoryNonPayment struct {
JSON cardPaymentElementsCardAuthenticationMessageCategoryNonPaymentJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationMessageCategoryNonPaymentJSON contains the
// JSON metadata for the struct
// [CardPaymentElementsCardAuthenticationMessageCategoryNonPayment]
type cardPaymentElementsCardAuthenticationMessageCategoryNonPaymentJSON struct {
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationMessageCategoryNonPayment) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationMessageCategoryNonPaymentJSON) RawJSON() string {
return r.raw
}
// Fields specific to payment authentication attempts.
type CardPaymentElementsCardAuthenticationMessageCategoryPayment struct {
// The purchase amount in minor units.
PurchaseAmount int64 `json:"purchase_amount" api:"required"`
// The purchase amount in the cardholder's currency (i.e., USD) estimated using
// daily conversion rates from the card network.
PurchaseAmountCardholderEstimated int64 `json:"purchase_amount_cardholder_estimated" api:"required,nullable"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// authentication attempt's purchase currency.
PurchaseCurrency string `json:"purchase_currency" api:"required"`
// The type of transaction being authenticated.
TransactionType CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType `json:"transaction_type" api:"required,nullable"`
JSON cardPaymentElementsCardAuthenticationMessageCategoryPaymentJSON `json:"-"`
}
// cardPaymentElementsCardAuthenticationMessageCategoryPaymentJSON contains the
// JSON metadata for the struct
// [CardPaymentElementsCardAuthenticationMessageCategoryPayment]
type cardPaymentElementsCardAuthenticationMessageCategoryPaymentJSON struct {
PurchaseAmount apijson.Field
PurchaseAmountCardholderEstimated apijson.Field
PurchaseCurrency apijson.Field
TransactionType apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CardPaymentElementsCardAuthenticationMessageCategoryPayment) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r cardPaymentElementsCardAuthenticationMessageCategoryPaymentJSON) RawJSON() string {
return r.raw
}
// The type of transaction being authenticated.
type CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType string
const (
CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeGoodsServicePurchase CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType = "goods_service_purchase"
CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeCheckAcceptance CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType = "check_acceptance"
CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeAccountFunding CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType = "account_funding"
CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeQuasiCashTransaction CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType = "quasi_cash_transaction"
CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypePrepaidActivationAndLoad CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType = "prepaid_activation_and_load"
)
func (r CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionType) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeGoodsServicePurchase, CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeCheckAcceptance, CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeAccountFunding, CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypeQuasiCashTransaction, CardPaymentElementsCardAuthenticationMessageCategoryPaymentTransactionTypePrepaidActivationAndLoad:
return true
}
return false
}
// The 3DS requestor authentication indicator describes why the authentication
// attempt is performed, such as for a recurring transaction.
type CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator string
const (
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorPaymentTransaction CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "payment_transaction"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorRecurringTransaction CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "recurring_transaction"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorInstallmentTransaction CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "installment_transaction"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorAddCard CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "add_card"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorMaintainCard CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "maintain_card"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorEmvTokenCardholderVerification CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "emv_token_cardholder_verification"
CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorBillingAgreement CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator = "billing_agreement"
)
func (r CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicator) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorPaymentTransaction, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorRecurringTransaction, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorInstallmentTransaction, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorAddCard, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorMaintainCard, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorEmvTokenCardholderVerification, CardPaymentElementsCardAuthenticationRequestorAuthenticationIndicatorBillingAgreement:
return true
}
return false
}
// Indicates whether a challenge is requested for this transaction.
type CardPaymentElementsCardAuthenticationRequestorChallengeIndicator string
const (
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoPreference CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_preference"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequested CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_challenge_requested"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequested3DSRequestorPreference CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "challenge_requested_3ds_requestor_preference"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequestedMandate CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "challenge_requested_mandate"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedTransactionalRiskAnalysisAlreadyPerformed CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_challenge_requested_transactional_risk_analysis_already_performed"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedDataShareOnly CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_challenge_requested_data_share_only"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedStrongConsumerAuthenticationAlreadyPerformed CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_challenge_requested_strong_consumer_authentication_already_performed"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedUtilizeWhitelistExemptionIfNoChallengeRequired CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required"
CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequestedWhitelistPromptRequestedIfChallengeRequired CardPaymentElementsCardAuthenticationRequestorChallengeIndicator = "challenge_requested_whitelist_prompt_requested_if_challenge_required"
)
func (r CardPaymentElementsCardAuthenticationRequestorChallengeIndicator) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoPreference, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequested, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequested3DSRequestorPreference, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequestedMandate, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedTransactionalRiskAnalysisAlreadyPerformed, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedDataShareOnly, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedStrongConsumerAuthenticationAlreadyPerformed, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorNoChallengeRequestedUtilizeWhitelistExemptionIfNoChallengeRequired, CardPaymentElementsCardAuthenticationRequestorChallengeIndicatorChallengeRequestedWhitelistPromptRequestedIfChallengeRequired:
return true
}
return false
}
// The status of the card authentication.
type CardPaymentElementsCardAuthenticationStatus string
const (
CardPaymentElementsCardAuthenticationStatusDenied CardPaymentElementsCardAuthenticationStatus = "denied"
CardPaymentElementsCardAuthenticationStatusAuthenticatedWithChallenge CardPaymentElementsCardAuthenticationStatus = "authenticated_with_challenge"
CardPaymentElementsCardAuthenticationStatusAuthenticatedWithoutChallenge CardPaymentElementsCardAuthenticationStatus = "authenticated_without_challenge"
CardPaymentElementsCardAuthenticationStatusAwaitingChallenge CardPaymentElementsCardAuthenticationStatus = "awaiting_challenge"
CardPaymentElementsCardAuthenticationStatusValidatingChallenge CardPaymentElementsCardAuthenticationStatus = "validating_challenge"
CardPaymentElementsCardAuthenticationStatusCanceled CardPaymentElementsCardAuthenticationStatus = "canceled"
CardPaymentElementsCardAuthenticationStatusTimedOutAwaitingChallenge CardPaymentElementsCardAuthenticationStatus = "timed_out_awaiting_challenge"
CardPaymentElementsCardAuthenticationStatusErrored CardPaymentElementsCardAuthenticationStatus = "errored"
CardPaymentElementsCardAuthenticationStatusExceededAttemptThreshold CardPaymentElementsCardAuthenticationStatus = "exceeded_attempt_threshold"
)
func (r CardPaymentElementsCardAuthenticationStatus) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationStatusDenied, CardPaymentElementsCardAuthenticationStatusAuthenticatedWithChallenge, CardPaymentElementsCardAuthenticationStatusAuthenticatedWithoutChallenge, CardPaymentElementsCardAuthenticationStatusAwaitingChallenge, CardPaymentElementsCardAuthenticationStatusValidatingChallenge, CardPaymentElementsCardAuthenticationStatusCanceled, CardPaymentElementsCardAuthenticationStatusTimedOutAwaitingChallenge, CardPaymentElementsCardAuthenticationStatusErrored, CardPaymentElementsCardAuthenticationStatusExceededAttemptThreshold:
return true
}
return false
}
// A constant representing the object's type. For this resource it will always be
// `card_authentication`.
type CardPaymentElementsCardAuthenticationType string
const (
CardPaymentElementsCardAuthenticationTypeCardAuthentication CardPaymentElementsCardAuthenticationType = "card_authentication"
)
func (r CardPaymentElementsCardAuthenticationType) IsKnown() bool {
switch r {
case CardPaymentElementsCardAuthenticationTypeCardAuthentication:
return true
}
return false
}
// A Card Authorization object. This field will be present in the JSON response if
// and only if `category` is equal to `card_authorization`. Card Authorizations are
// temporary holds placed on a customer's funds with the intent to later clear a
// transaction.
type CardPaymentElementsCardAuthorization struct {
// The Card Authorization identifier.
ID string `json:"id" api:"required"`
// Whether this authorization was approved by Increase, the card network through
// stand-in processing, or the user through a real-time decision.
Actioner CardPaymentElementsCardAuthorizationActioner `json:"actioner" api:"required"`
// Additional amounts associated with the card authorization, such as ATM
// surcharges fees. These are usually a subset of the `amount` field and are used
// to provide more detailed information about the transaction.
AdditionalAmounts CardPaymentElementsCardAuthorizationAdditionalAmounts `json:"additional_amounts" api:"required"`
// The pending amount in the minor unit of the transaction's currency. For dollars,
// for example, this is cents.
Amount int64 `json:"amount" api:"required"`
// The ID of the Card Payment this transaction belongs to.
CardPaymentID string `json:"card_payment_id" api:"required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's currency.
Currency CardPaymentElementsCardAuthorizationCurrency `json:"currency" api:"required"`
// If the authorization was made via a Digital Wallet Token (such as an Apple Pay
// purchase), the identifier of the token that was used.
DigitalWalletTokenID string `json:"digital_wallet_token_id" api:"required,nullable"`
// The direction describes the direction the funds will move, either from the
// cardholder to the merchant or from the merchant to the cardholder.
Direction CardPaymentElementsCardAuthorizationDirection `json:"direction" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization
// will expire and the pending transaction will be released.
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// The merchant identifier (commonly abbreviated as MID) of the merchant the card
// is transacting with.
MerchantAcceptorID string `json:"merchant_acceptor_id" api:"required"`
// The Merchant Category Code (commonly abbreviated as MCC) of the merchant the
// card is transacting with.
MerchantCategoryCode string `json:"merchant_category_code" api:"required"`
// The city the merchant resides in.
MerchantCity string `json:"merchant_city" api:"required,nullable"`
// The country the merchant resides in.
MerchantCountry string `json:"merchant_country" api:"required"`
// The merchant descriptor of the merchant the card is transacting with.
MerchantDescriptor string `json:"merchant_descriptor" api:"required"`
// The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
// ZIP code, where the first 5 and last 4 are separated by a dash.
MerchantPostalCode string `json:"merchant_postal_code" api:"required,nullable"`
// The state the merchant resides in.
MerchantState string `json:"merchant_state" api:"required,nullable"`
// Fields specific to the `network`.
NetworkDetails CardPaymentElementsCardAuthorizationNetworkDetails `json:"network_details" api:"required"`
// Network-specific identifiers for a specific request or transaction.
NetworkIdentifiers CardPaymentElementsCardAuthorizationNetworkIdentifiers `json:"network_identifiers" api:"required"`
// The risk score generated by the card network. For Visa this is the Visa Advanced
// Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
// score is from 0 to 999, where 999 is the riskiest.
NetworkRiskScore int64 `json:"network_risk_score" api:"required,nullable"`
// The identifier of the Pending Transaction associated with this Transaction.
PendingTransactionID string `json:"pending_transaction_id" api:"required,nullable"`
// If the authorization was made in-person with a physical card, the Physical Card
// that was used.
PhysicalCardID string `json:"physical_card_id" api:"required,nullable"`
// The pending amount in the minor unit of the transaction's presentment currency.
PresentmentAmount int64 `json:"presentment_amount" api:"required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's presentment currency.
PresentmentCurrency string `json:"presentment_currency" api:"required"`
// The processing category describes the intent behind the authorization, such as
// whether it was used for bill payments or an automatic fuel dispenser.
ProcessingCategory CardPaymentElementsCardAuthorizationProcessingCategory `json:"processing_category" api:"required"`
// The identifier of the Real-Time Decision sent to approve or decline this
// transaction.
RealTimeDecisionID string `json:"real_time_decision_id" api:"required,nullable"`
// The terminal identifier (commonly abbreviated as TID) of the terminal the card
// is transacting with.
TerminalID string `json:"terminal_id" api:"required,nullable"`
// A constant representing the object's type. For this resource it will always be
// `card_authorization`.
Type CardPaymentElementsCardAuthorizationType `json:"type" api:"required"`
// Fields related to verification of cardholder-provided values.
Verification CardPaymentElementsCardAuthorizationVerification `json:"verification" api:"required"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON cardPaymentElementsCardAuthorizationJSON `json:"-"`
}
// cardPaymentElementsCardAuthorizationJSON contains the JSON metadata for the
// struct [CardPaymentElementsCardAuthorization]
type cardPaymentElementsCardAuthorizationJSON struct {
ID apijson.Field
Actioner apijson.Field
AdditionalAmounts apijson.Field
Amount apijson.Field
CardPaymentID apijson.Field
Currency apijson.Field
DigitalWalletTokenID apijson.Field
Direction apijson.Field
ExpiresAt apijson.Field
MerchantAcceptorID apijson.Field
MerchantCategoryCode apijson.Field
MerchantCity apijson.Field
MerchantCountry apijson.Field
MerchantDescriptor apijson.Field
MerchantPostalCode apijson.Field
MerchantState apijson.Field
NetworkDetails apijson.Field
NetworkIdentifiers apijson.Field
NetworkRiskScore apijson.Field
PendingTransactionID apijson.Field
PhysicalCardID apijson.Field
PresentmentAmount apijson.Field
PresentmentCurrency apijson.Field