-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeclinedtransaction.go
1335 lines (1231 loc) · 80.5 KB
/
declinedtransaction.go
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.
package acme
import (
"context"
"fmt"
"net/http"
"net/url"
"time"
"github.com/acme/acme-go/internal/apijson"
"github.com/acme/acme-go/internal/apiquery"
"github.com/acme/acme-go/internal/param"
"github.com/acme/acme-go/internal/requestconfig"
"github.com/acme/acme-go/internal/shared"
"github.com/acme/acme-go/option"
)
// DeclinedTransactionService contains methods and other services that help with
// interacting with the acme 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 [NewDeclinedTransactionService]
// method instead.
type DeclinedTransactionService struct {
Options []option.RequestOption
}
// NewDeclinedTransactionService 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 NewDeclinedTransactionService(opts ...option.RequestOption) (r *DeclinedTransactionService) {
r = &DeclinedTransactionService{}
r.Options = opts
return
}
// Retrieve a Declined Transaction
func (r *DeclinedTransactionService) Get(ctx context.Context, declinedTransactionID string, opts ...option.RequestOption) (res *DeclinedTransaction, err error) {
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("declined_transactions/%s", declinedTransactionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// List Declined Transactions
func (r *DeclinedTransactionService) List(ctx context.Context, query DeclinedTransactionListParams, opts ...option.RequestOption) (res *shared.Page[DeclinedTransaction], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "declined_transactions"
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 Declined Transactions
func (r *DeclinedTransactionService) ListAutoPaging(ctx context.Context, query DeclinedTransactionListParams, opts ...option.RequestOption) *shared.PageAutoPager[DeclinedTransaction] {
return shared.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Declined Transactions are refused additions and removals of money from your bank
// account. For example, Declined Transactions are caused when your Account has an
// insufficient balance or your Limits are triggered.
type DeclinedTransaction struct {
// The Declined Transaction identifier.
ID string `json:"id,required"`
// The identifier for the Account the Declined Transaction belongs to.
AccountID string `json:"account_id,required"`
// The Declined Transaction amount in the minor unit of its currency. For dollars,
// for example, this is cents.
Amount int64 `json:"amount,required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the
// Transaction occurred.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Declined
// Transaction's currency. This will match the currency on the Declined
// Transaction's Account.
Currency DeclinedTransactionCurrency `json:"currency,required"`
// This is the description the vendor provides.
Description string `json:"description,required"`
// The identifier for the route this Declined Transaction came through. Routes are
// things like cards and ACH details.
RouteID string `json:"route_id,required,nullable"`
// The type of the route this Declined Transaction came through.
RouteType DeclinedTransactionRouteType `json:"route_type,required,nullable"`
// This is an object giving more details on the network-level event that caused the
// Declined Transaction. For example, for a card transaction this lists the
// merchant's industry and location. Note that for backwards compatibility reasons,
// additional undocumented keys may appear in this object. These should be treated
// as deprecated and will be removed in the future.
Source DeclinedTransactionSource `json:"source,required"`
// A constant representing the object's type. For this resource it will always be
// `declined_transaction`.
Type DeclinedTransactionType `json:"type,required"`
JSON declinedTransactionJSON `json:"-"`
}
// declinedTransactionJSON contains the JSON metadata for the struct
// [DeclinedTransaction]
type declinedTransactionJSON struct {
ID apijson.Field
AccountID apijson.Field
Amount apijson.Field
CreatedAt apijson.Field
Currency apijson.Field
Description apijson.Field
RouteID apijson.Field
RouteType apijson.Field
Source apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransaction) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Declined
// Transaction's currency. This will match the currency on the Declined
// Transaction's Account.
type DeclinedTransactionCurrency string
const (
// Canadian Dollar (CAD)
DeclinedTransactionCurrencyCad DeclinedTransactionCurrency = "CAD"
// Swiss Franc (CHF)
DeclinedTransactionCurrencyChf DeclinedTransactionCurrency = "CHF"
// Euro (EUR)
DeclinedTransactionCurrencyEur DeclinedTransactionCurrency = "EUR"
// British Pound (GBP)
DeclinedTransactionCurrencyGbp DeclinedTransactionCurrency = "GBP"
// Japanese Yen (JPY)
DeclinedTransactionCurrencyJpy DeclinedTransactionCurrency = "JPY"
// US Dollar (USD)
DeclinedTransactionCurrencyUsd DeclinedTransactionCurrency = "USD"
)
// The type of the route this Declined Transaction came through.
type DeclinedTransactionRouteType string
const (
// An Account Number.
DeclinedTransactionRouteTypeAccountNumber DeclinedTransactionRouteType = "account_number"
// A Card.
DeclinedTransactionRouteTypeCard DeclinedTransactionRouteType = "card"
)
// This is an object giving more details on the network-level event that caused the
// Declined Transaction. For example, for a card transaction this lists the
// merchant's industry and location. Note that for backwards compatibility reasons,
// additional undocumented keys may appear in this object. These should be treated
// as deprecated and will be removed in the future.
type DeclinedTransactionSource struct {
// An ACH Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `ach_decline`.
ACHDecline DeclinedTransactionSourceACHDecline `json:"ach_decline,required,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 DeclinedTransactionSourceCardDecline `json:"card_decline,required,nullable"`
// 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 DeclinedTransactionSourceCategory `json:"category,required"`
// A Check Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `check_decline`.
CheckDecline DeclinedTransactionSourceCheckDecline `json:"check_decline,required,nullable"`
// An Inbound Real-Time Payments Transfer Decline object. This field will be
// present in the JSON response if and only if `category` is equal to
// `inbound_real_time_payments_transfer_decline`.
InboundRealTimePaymentsTransferDecline DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline `json:"inbound_real_time_payments_transfer_decline,required,nullable"`
// An International ACH Decline object. This field will be present in the JSON
// response if and only if `category` is equal to `international_ach_decline`.
InternationalACHDecline DeclinedTransactionSourceInternationalACHDecline `json:"international_ach_decline,required,nullable"`
// A Wire Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `wire_decline`.
WireDecline DeclinedTransactionSourceWireDecline `json:"wire_decline,required,nullable"`
JSON declinedTransactionSourceJSON `json:"-"`
}
// declinedTransactionSourceJSON contains the JSON metadata for the struct
// [DeclinedTransactionSource]
type declinedTransactionSourceJSON struct {
ACHDecline apijson.Field
CardDecline apijson.Field
Category apijson.Field
CheckDecline apijson.Field
InboundRealTimePaymentsTransferDecline apijson.Field
InternationalACHDecline apijson.Field
WireDecline apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSource) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// An ACH Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `ach_decline`.
type DeclinedTransactionSourceACHDecline struct {
// The ACH Decline's identifier.
ID string `json:"id,required"`
// The declined amount in the minor unit of the destination account currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount,required"`
// The descriptive date of the transfer.
OriginatorCompanyDescriptiveDate string `json:"originator_company_descriptive_date,required,nullable"`
// The additional information included with the transfer.
OriginatorCompanyDiscretionaryData string `json:"originator_company_discretionary_data,required,nullable"`
// The identifier of the company that initiated the transfer.
OriginatorCompanyID string `json:"originator_company_id,required"`
// The name of the company that initiated the transfer.
OriginatorCompanyName string `json:"originator_company_name,required"`
// Why the ACH transfer was declined.
Reason DeclinedTransactionSourceACHDeclineReason `json:"reason,required"`
// The id of the receiver of the transfer.
ReceiverIDNumber string `json:"receiver_id_number,required,nullable"`
// The name of the receiver of the transfer.
ReceiverName string `json:"receiver_name,required,nullable"`
// The trace number of the transfer.
TraceNumber string `json:"trace_number,required"`
// A constant representing the object's type. For this resource it will always be
// `ach_decline`.
Type DeclinedTransactionSourceACHDeclineType `json:"type,required"`
JSON declinedTransactionSourceACHDeclineJSON `json:"-"`
}
// declinedTransactionSourceACHDeclineJSON contains the JSON metadata for the
// struct [DeclinedTransactionSourceACHDecline]
type declinedTransactionSourceACHDeclineJSON struct {
ID apijson.Field
Amount apijson.Field
OriginatorCompanyDescriptiveDate apijson.Field
OriginatorCompanyDiscretionaryData apijson.Field
OriginatorCompanyID apijson.Field
OriginatorCompanyName apijson.Field
Reason apijson.Field
ReceiverIDNumber apijson.Field
ReceiverName apijson.Field
TraceNumber apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceACHDecline) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// Why the ACH transfer was declined.
type DeclinedTransactionSourceACHDeclineReason string
const (
// The account number is canceled.
DeclinedTransactionSourceACHDeclineReasonACHRouteCanceled DeclinedTransactionSourceACHDeclineReason = "ach_route_canceled"
// The account number is disabled.
DeclinedTransactionSourceACHDeclineReasonACHRouteDisabled DeclinedTransactionSourceACHDeclineReason = "ach_route_disabled"
// The transaction would cause an Acme limit to be exceeded.
DeclinedTransactionSourceACHDeclineReasonBreachesLimit DeclinedTransactionSourceACHDeclineReason = "breaches_limit"
// A credit was refused. This is a reasonable default reason for decline of
// credits.
DeclinedTransactionSourceACHDeclineReasonCreditEntryRefusedByReceiver DeclinedTransactionSourceACHDeclineReason = "credit_entry_refused_by_receiver"
// A rare return reason. The return this message refers to was a duplicate.
DeclinedTransactionSourceACHDeclineReasonDuplicateReturn DeclinedTransactionSourceACHDeclineReason = "duplicate_return"
// The account's entity is not active.
DeclinedTransactionSourceACHDeclineReasonEntityNotActive DeclinedTransactionSourceACHDeclineReason = "entity_not_active"
// Your account is inactive.
DeclinedTransactionSourceACHDeclineReasonGroupLocked DeclinedTransactionSourceACHDeclineReason = "group_locked"
// Your account contains insufficient funds.
DeclinedTransactionSourceACHDeclineReasonInsufficientFunds DeclinedTransactionSourceACHDeclineReason = "insufficient_funds"
// A rare return reason. The return this message refers to was misrouted.
DeclinedTransactionSourceACHDeclineReasonMisroutedReturn DeclinedTransactionSourceACHDeclineReason = "misrouted_return"
// The originating financial institution made a mistake and this return corrects
// it.
DeclinedTransactionSourceACHDeclineReasonReturnOfErroneousOrReversingDebit DeclinedTransactionSourceACHDeclineReason = "return_of_erroneous_or_reversing_debit"
// The account number that was debited does not exist.
DeclinedTransactionSourceACHDeclineReasonNoACHRoute DeclinedTransactionSourceACHDeclineReason = "no_ach_route"
// The originating financial institution asked for this transfer to be returned.
DeclinedTransactionSourceACHDeclineReasonOriginatorRequest DeclinedTransactionSourceACHDeclineReason = "originator_request"
// The transaction is not allowed per Acme's terms.
DeclinedTransactionSourceACHDeclineReasonTransactionNotAllowed DeclinedTransactionSourceACHDeclineReason = "transaction_not_allowed"
// The user initiated the decline.
DeclinedTransactionSourceACHDeclineReasonUserInitiated DeclinedTransactionSourceACHDeclineReason = "user_initiated"
)
// A constant representing the object's type. For this resource it will always be
// `ach_decline`.
type DeclinedTransactionSourceACHDeclineType string
const (
DeclinedTransactionSourceACHDeclineTypeACHDecline DeclinedTransactionSourceACHDeclineType = "ach_decline"
)
// A Card Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `card_decline`.
type DeclinedTransactionSourceCardDecline struct {
// The Card Decline identifier.
ID string `json:"id,required"`
// The declined amount in the minor unit of the destination account currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount,required"`
// The ID of the Card Payment this transaction belongs to.
CardPaymentID string `json:"card_payment_id,required,nullable"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination
// account currency.
Currency DeclinedTransactionSourceCardDeclineCurrency `json:"currency,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,required,nullable"`
// The merchant identifier (commonly abbreviated as MID) of the merchant the card
// is transacting with.
MerchantAcceptorID string `json:"merchant_acceptor_id,required"`
// The Merchant Category Code (commonly abbreviated as MCC) of the merchant the
// card is transacting with.
MerchantCategoryCode string `json:"merchant_category_code,required,nullable"`
// The city the merchant resides in.
MerchantCity string `json:"merchant_city,required,nullable"`
// The country the merchant resides in.
MerchantCountry string `json:"merchant_country,required,nullable"`
// The merchant descriptor of the merchant the card is transacting with.
MerchantDescriptor string `json:"merchant_descriptor,required"`
// The state the merchant resides in.
MerchantState string `json:"merchant_state,required,nullable"`
// Fields specific to the `network`.
NetworkDetails DeclinedTransactionSourceCardDeclineNetworkDetails `json:"network_details,required"`
// Network-specific identifiers for a specific request or transaction.
NetworkIdentifiers DeclinedTransactionSourceCardDeclineNetworkIdentifiers `json:"network_identifiers,required"`
// If the authorization was made in-person with a physical card, the Physical Card
// that was used.
PhysicalCardID string `json:"physical_card_id,required,nullable"`
// The processing category describes the intent behind the authorization, such as
// whether it was used for bill payments or an automatic fuel dispenser.
ProcessingCategory DeclinedTransactionSourceCardDeclineProcessingCategory `json:"processing_category,required"`
// The identifier of the Real-Time Decision sent to approve or decline this
// transaction.
RealTimeDecisionID string `json:"real_time_decision_id,required,nullable"`
// Why the transaction was declined.
Reason DeclinedTransactionSourceCardDeclineReason `json:"reason,required"`
// Fields related to verification of cardholder-provided values.
Verification DeclinedTransactionSourceCardDeclineVerification `json:"verification,required"`
JSON declinedTransactionSourceCardDeclineJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineJSON contains the JSON metadata for the
// struct [DeclinedTransactionSourceCardDecline]
type declinedTransactionSourceCardDeclineJSON struct {
ID apijson.Field
Amount apijson.Field
CardPaymentID apijson.Field
Currency apijson.Field
DigitalWalletTokenID apijson.Field
MerchantAcceptorID apijson.Field
MerchantCategoryCode apijson.Field
MerchantCity apijson.Field
MerchantCountry apijson.Field
MerchantDescriptor apijson.Field
MerchantState apijson.Field
NetworkDetails apijson.Field
NetworkIdentifiers apijson.Field
PhysicalCardID apijson.Field
ProcessingCategory apijson.Field
RealTimeDecisionID apijson.Field
Reason apijson.Field
Verification apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDecline) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination
// account currency.
type DeclinedTransactionSourceCardDeclineCurrency string
const (
// Canadian Dollar (CAD)
DeclinedTransactionSourceCardDeclineCurrencyCad DeclinedTransactionSourceCardDeclineCurrency = "CAD"
// Swiss Franc (CHF)
DeclinedTransactionSourceCardDeclineCurrencyChf DeclinedTransactionSourceCardDeclineCurrency = "CHF"
// Euro (EUR)
DeclinedTransactionSourceCardDeclineCurrencyEur DeclinedTransactionSourceCardDeclineCurrency = "EUR"
// British Pound (GBP)
DeclinedTransactionSourceCardDeclineCurrencyGbp DeclinedTransactionSourceCardDeclineCurrency = "GBP"
// Japanese Yen (JPY)
DeclinedTransactionSourceCardDeclineCurrencyJpy DeclinedTransactionSourceCardDeclineCurrency = "JPY"
// US Dollar (USD)
DeclinedTransactionSourceCardDeclineCurrencyUsd DeclinedTransactionSourceCardDeclineCurrency = "USD"
)
// Fields specific to the `network`.
type DeclinedTransactionSourceCardDeclineNetworkDetails struct {
// The payment network used to process this card authorization.
Category DeclinedTransactionSourceCardDeclineNetworkDetailsCategory `json:"category,required"`
// Fields specific to the `visa` network.
Visa DeclinedTransactionSourceCardDeclineNetworkDetailsVisa `json:"visa,required,nullable"`
JSON declinedTransactionSourceCardDeclineNetworkDetailsJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineNetworkDetailsJSON contains the JSON
// metadata for the struct [DeclinedTransactionSourceCardDeclineNetworkDetails]
type declinedTransactionSourceCardDeclineNetworkDetailsJSON struct {
Category apijson.Field
Visa apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineNetworkDetails) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The payment network used to process this card authorization.
type DeclinedTransactionSourceCardDeclineNetworkDetailsCategory string
const (
// Visa
DeclinedTransactionSourceCardDeclineNetworkDetailsCategoryVisa DeclinedTransactionSourceCardDeclineNetworkDetailsCategory = "visa"
)
// Fields specific to the `visa` network.
type DeclinedTransactionSourceCardDeclineNetworkDetailsVisa struct {
// For electronic commerce transactions, this identifies the level of security used
// in obtaining the customer's payment credential. For mail or telephone order
// transactions, identifies the type of mail or telephone order.
ElectronicCommerceIndicator DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator `json:"electronic_commerce_indicator,required,nullable"`
// The method used to enter the cardholder's primary account number and card
// expiration date.
PointOfServiceEntryMode DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode `json:"point_of_service_entry_mode,required,nullable"`
JSON declinedTransactionSourceCardDeclineNetworkDetailsVisaJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineNetworkDetailsVisaJSON contains the JSON
// metadata for the struct [DeclinedTransactionSourceCardDeclineNetworkDetailsVisa]
type declinedTransactionSourceCardDeclineNetworkDetailsVisaJSON struct {
ElectronicCommerceIndicator apijson.Field
PointOfServiceEntryMode apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineNetworkDetailsVisa) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// For electronic commerce transactions, this identifies the level of security used
// in obtaining the customer's payment credential. For mail or telephone order
// transactions, identifies the type of mail or telephone order.
type DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator string
const (
// Single transaction of a mail/phone order: Use to indicate that the transaction
// is a mail/phone order purchase, not a recurring transaction or installment
// payment. For domestic transactions in the US region, this value may also
// indicate one bill payment transaction in the card-present or card-absent
// environments.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorMailPhoneOrder DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "mail_phone_order"
// Recurring transaction: Payment indicator used to indicate a recurring
// transaction that originates from an acquirer in the US region.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorRecurring DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "recurring"
// Installment payment: Payment indicator used to indicate one purchase of goods or
// services that is billed to the account in multiple charges over a period of time
// agreed upon by the cardholder and merchant from transactions that originate from
// an acquirer in the US region.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorInstallment DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "installment"
// Unknown classification: other mail order: Use to indicate that the type of
// mail/telephone order is unknown.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorUnknownMailPhoneOrder DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "unknown_mail_phone_order"
// Secure electronic commerce transaction: Use to indicate that the electronic
// commerce transaction has been authenticated using e.g., 3-D Secure
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorSecureElectronicCommerce DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "secure_electronic_commerce"
// Non-authenticated security transaction at a 3-D Secure-capable merchant, and
// merchant attempted to authenticate the cardholder using 3-D Secure: Use to
// identify an electronic commerce transaction where the merchant attempted to
// authenticate the cardholder using 3-D Secure, but was unable to complete the
// authentication because the issuer or cardholder does not participate in the 3-D
// Secure program.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransactionAt3DSCapableMerchant DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "non_authenticated_security_transaction_at_3ds_capable_merchant"
// Non-authenticated security transaction: Use to identify an electronic commerce
// transaction that uses data encryption for security however , cardholder
// authentication is not performed using 3-D Secure.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransaction DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "non_authenticated_security_transaction"
// Non-secure transaction: Use to identify an electronic commerce transaction that
// has no data protection.
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicatorNonSecureTransaction DeclinedTransactionSourceCardDeclineNetworkDetailsVisaElectronicCommerceIndicator = "non_secure_transaction"
)
// The method used to enter the cardholder's primary account number and card
// expiration date.
type DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode string
const (
// Unknown
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeUnknown DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "unknown"
// Manual key entry
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeManual DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "manual"
// Magnetic stripe read, without card verification value
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeMagneticStripeNoCvv DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "magnetic_stripe_no_cvv"
// Optical code
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeOpticalCode DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "optical_code"
// Contact chip card
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCard DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "integrated_circuit_card"
// Contactless read of chip card
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeContactless DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "contactless"
// Transaction initiated using a credential that has previously been stored on file
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeCredentialOnFile DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "credential_on_file"
// Magnetic stripe read
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeMagneticStripe DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "magnetic_stripe"
// Contactless read of magnetic stripe data
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeContactlessMagneticStripe DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "contactless_magnetic_stripe"
// Contact chip card, without card verification value
DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCardNoCvv DeclinedTransactionSourceCardDeclineNetworkDetailsVisaPointOfServiceEntryMode = "integrated_circuit_card_no_cvv"
)
// Network-specific identifiers for a specific request or transaction.
type DeclinedTransactionSourceCardDeclineNetworkIdentifiers struct {
// A life-cycle identifier used across e.g., an authorization and a reversal.
// Expected to be unique per acquirer within a window of time. For some card
// networks the retrieval reference number includes the trace counter.
RetrievalReferenceNumber string `json:"retrieval_reference_number,required,nullable"`
// A counter used to verify an individual authorization. Expected to be unique per
// acquirer within a window of time.
TraceNumber string `json:"trace_number,required,nullable"`
// A globally unique transaction identifier provided by the card network, used
// across multiple life-cycle requests.
TransactionID string `json:"transaction_id,required,nullable"`
JSON declinedTransactionSourceCardDeclineNetworkIdentifiersJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineNetworkIdentifiersJSON contains the JSON
// metadata for the struct [DeclinedTransactionSourceCardDeclineNetworkIdentifiers]
type declinedTransactionSourceCardDeclineNetworkIdentifiersJSON struct {
RetrievalReferenceNumber apijson.Field
TraceNumber apijson.Field
TransactionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineNetworkIdentifiers) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The processing category describes the intent behind the authorization, such as
// whether it was used for bill payments or an automatic fuel dispenser.
type DeclinedTransactionSourceCardDeclineProcessingCategory string
const (
// Account funding transactions are transactions used to e.g., fund an account or
// transfer funds between accounts.
DeclinedTransactionSourceCardDeclineProcessingCategoryAccountFunding DeclinedTransactionSourceCardDeclineProcessingCategory = "account_funding"
// Automatic fuel dispenser authorizations occur when a card is used at a gas pump,
// prior to the actual transaction amount being known. They are followed by an
// advice message that updates the amount of the pending transaction.
DeclinedTransactionSourceCardDeclineProcessingCategoryAutomaticFuelDispenser DeclinedTransactionSourceCardDeclineProcessingCategory = "automatic_fuel_dispenser"
// A transaction used to pay a bill.
DeclinedTransactionSourceCardDeclineProcessingCategoryBillPayment DeclinedTransactionSourceCardDeclineProcessingCategory = "bill_payment"
// A regular purchase.
DeclinedTransactionSourceCardDeclineProcessingCategoryPurchase DeclinedTransactionSourceCardDeclineProcessingCategory = "purchase"
// Quasi-cash transactions represent purchases of items which may be convertible to
// cash.
DeclinedTransactionSourceCardDeclineProcessingCategoryQuasiCash DeclinedTransactionSourceCardDeclineProcessingCategory = "quasi_cash"
// A refund card authorization, sometimes referred to as a credit voucher
// authorization, where funds are credited to the cardholder.
DeclinedTransactionSourceCardDeclineProcessingCategoryRefund DeclinedTransactionSourceCardDeclineProcessingCategory = "refund"
)
// Why the transaction was declined.
type DeclinedTransactionSourceCardDeclineReason string
const (
// The Card was not active.
DeclinedTransactionSourceCardDeclineReasonCardNotActive DeclinedTransactionSourceCardDeclineReason = "card_not_active"
// The Physical Card was not active.
DeclinedTransactionSourceCardDeclineReasonPhysicalCardNotActive DeclinedTransactionSourceCardDeclineReason = "physical_card_not_active"
// The account's entity was not active.
DeclinedTransactionSourceCardDeclineReasonEntityNotActive DeclinedTransactionSourceCardDeclineReason = "entity_not_active"
// The account was inactive.
DeclinedTransactionSourceCardDeclineReasonGroupLocked DeclinedTransactionSourceCardDeclineReason = "group_locked"
// The Card's Account did not have a sufficient available balance.
DeclinedTransactionSourceCardDeclineReasonInsufficientFunds DeclinedTransactionSourceCardDeclineReason = "insufficient_funds"
// The given CVV2 did not match the card's value.
DeclinedTransactionSourceCardDeclineReasonCvv2Mismatch DeclinedTransactionSourceCardDeclineReason = "cvv2_mismatch"
// The attempted card transaction is not allowed per Acme's terms.
DeclinedTransactionSourceCardDeclineReasonTransactionNotAllowed DeclinedTransactionSourceCardDeclineReason = "transaction_not_allowed"
// The transaction was blocked by a Limit.
DeclinedTransactionSourceCardDeclineReasonBreachesLimit DeclinedTransactionSourceCardDeclineReason = "breaches_limit"
// Your application declined the transaction via webhook.
DeclinedTransactionSourceCardDeclineReasonWebhookDeclined DeclinedTransactionSourceCardDeclineReason = "webhook_declined"
// Your application webhook did not respond without the required timeout.
DeclinedTransactionSourceCardDeclineReasonWebhookTimedOut DeclinedTransactionSourceCardDeclineReason = "webhook_timed_out"
// Declined by stand-in processing.
DeclinedTransactionSourceCardDeclineReasonDeclinedByStandInProcessing DeclinedTransactionSourceCardDeclineReason = "declined_by_stand_in_processing"
// The card read had an invalid CVV, dCVV, or authorization request cryptogram.
DeclinedTransactionSourceCardDeclineReasonInvalidPhysicalCard DeclinedTransactionSourceCardDeclineReason = "invalid_physical_card"
// The original card authorization for this incremental authorization does not
// exist.
DeclinedTransactionSourceCardDeclineReasonMissingOriginalAuthorization DeclinedTransactionSourceCardDeclineReason = "missing_original_authorization"
// The transaction was suspected to be fraudulent. Please reach out to
// [email protected] for more information.
DeclinedTransactionSourceCardDeclineReasonSuspectedFraud DeclinedTransactionSourceCardDeclineReason = "suspected_fraud"
)
// Fields related to verification of cardholder-provided values.
type DeclinedTransactionSourceCardDeclineVerification struct {
// Fields related to verification of the Card Verification Code, a 3-digit code on
// the back of the card.
CardVerificationCode DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode `json:"card_verification_code,required"`
// Cardholder address provided in the authorization request and the address on file
// we verified it against.
CardholderAddress DeclinedTransactionSourceCardDeclineVerificationCardholderAddress `json:"cardholder_address,required"`
JSON declinedTransactionSourceCardDeclineVerificationJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineVerificationJSON contains the JSON metadata
// for the struct [DeclinedTransactionSourceCardDeclineVerification]
type declinedTransactionSourceCardDeclineVerificationJSON struct {
CardVerificationCode apijson.Field
CardholderAddress apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineVerification) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// Fields related to verification of the Card Verification Code, a 3-digit code on
// the back of the card.
type DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode struct {
// The result of verifying the Card Verification Code.
Result DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResult `json:"result,required"`
JSON declinedTransactionSourceCardDeclineVerificationCardVerificationCodeJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineVerificationCardVerificationCodeJSON
// contains the JSON metadata for the struct
// [DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode]
type declinedTransactionSourceCardDeclineVerificationCardVerificationCodeJSON struct {
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The result of verifying the Card Verification Code.
type DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResult string
const (
// No card verification code was provided in the authorization request.
DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResultNotChecked DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResult = "not_checked"
// The card verification code matched the one on file.
DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResultMatch DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResult = "match"
// The card verification code did not match the one on file.
DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResultNoMatch DeclinedTransactionSourceCardDeclineVerificationCardVerificationCodeResult = "no_match"
)
// Cardholder address provided in the authorization request and the address on file
// we verified it against.
type DeclinedTransactionSourceCardDeclineVerificationCardholderAddress struct {
// Line 1 of the address on file for the cardholder.
ActualLine1 string `json:"actual_line1,required,nullable"`
// The postal code of the address on file for the cardholder.
ActualPostalCode string `json:"actual_postal_code,required,nullable"`
// The cardholder address line 1 provided for verification in the authorization
// request.
ProvidedLine1 string `json:"provided_line1,required,nullable"`
// The postal code provided for verification in the authorization request.
ProvidedPostalCode string `json:"provided_postal_code,required,nullable"`
// The address verification result returned to the card network.
Result DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult `json:"result,required"`
JSON declinedTransactionSourceCardDeclineVerificationCardholderAddressJSON `json:"-"`
}
// declinedTransactionSourceCardDeclineVerificationCardholderAddressJSON contains
// the JSON metadata for the struct
// [DeclinedTransactionSourceCardDeclineVerificationCardholderAddress]
type declinedTransactionSourceCardDeclineVerificationCardholderAddressJSON struct {
ActualLine1 apijson.Field
ActualPostalCode apijson.Field
ProvidedLine1 apijson.Field
ProvidedPostalCode apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCardDeclineVerificationCardholderAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The address verification result returned to the card network.
type DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult string
const (
// No adress was provided in the authorization request.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultNotChecked DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "not_checked"
// Postal code matches, but the street address was not verified.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultPostalCodeMatchAddressNotChecked DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "postal_code_match_address_not_checked"
// Postal code matches, but the street address does not match.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultPostalCodeMatchAddressNoMatch DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "postal_code_match_address_no_match"
// Postal code does not match, but the street address matches.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultPostalCodeNoMatchAddressMatch DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "postal_code_no_match_address_match"
// Postal code and street address match.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultMatch DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "match"
// Postal code and street address do not match.
DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResultNoMatch DeclinedTransactionSourceCardDeclineVerificationCardholderAddressResult = "no_match"
)
// 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 DeclinedTransactionSourceCategory string
const (
// ACH Decline: details will be under the `ach_decline` object.
DeclinedTransactionSourceCategoryACHDecline DeclinedTransactionSourceCategory = "ach_decline"
// Card Decline: details will be under the `card_decline` object.
DeclinedTransactionSourceCategoryCardDecline DeclinedTransactionSourceCategory = "card_decline"
// Check Decline: details will be under the `check_decline` object.
DeclinedTransactionSourceCategoryCheckDecline DeclinedTransactionSourceCategory = "check_decline"
// Inbound Real-Time Payments Transfer Decline: details will be under the
// `inbound_real_time_payments_transfer_decline` object.
DeclinedTransactionSourceCategoryInboundRealTimePaymentsTransferDecline DeclinedTransactionSourceCategory = "inbound_real_time_payments_transfer_decline"
// International ACH Decline: details will be under the `international_ach_decline`
// object.
DeclinedTransactionSourceCategoryInternationalACHDecline DeclinedTransactionSourceCategory = "international_ach_decline"
// Wire Decline: details will be under the `wire_decline` object.
DeclinedTransactionSourceCategoryWireDecline DeclinedTransactionSourceCategory = "wire_decline"
// The Declined Transaction was made for an undocumented or deprecated reason.
DeclinedTransactionSourceCategoryOther DeclinedTransactionSourceCategory = "other"
)
// A Check Decline object. This field will be present in the JSON response if and
// only if `category` is equal to `check_decline`.
type DeclinedTransactionSourceCheckDecline struct {
// The declined amount in the minor unit of the destination account currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount,required"`
// A computer-readable number printed on the MICR line of business checks, usually
// the check number. This is useful for positive pay checks, but can be unreliably
// transmitted by the bank of first deposit.
AuxiliaryOnUs string `json:"auxiliary_on_us,required,nullable"`
// The identifier of the API File object containing an image of the back of the
// declined check.
BackImageFileID string `json:"back_image_file_id,required,nullable"`
// The identifier of the API File object containing an image of the front of the
// declined check.
FrontImageFileID string `json:"front_image_file_id,required,nullable"`
// Why the check was declined.
Reason DeclinedTransactionSourceCheckDeclineReason `json:"reason,required"`
JSON declinedTransactionSourceCheckDeclineJSON `json:"-"`
}
// declinedTransactionSourceCheckDeclineJSON contains the JSON metadata for the
// struct [DeclinedTransactionSourceCheckDecline]
type declinedTransactionSourceCheckDeclineJSON struct {
Amount apijson.Field
AuxiliaryOnUs apijson.Field
BackImageFileID apijson.Field
FrontImageFileID apijson.Field
Reason apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceCheckDecline) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// Why the check was declined.
type DeclinedTransactionSourceCheckDeclineReason string
const (
// The account number is disabled.
DeclinedTransactionSourceCheckDeclineReasonACHRouteDisabled DeclinedTransactionSourceCheckDeclineReason = "ach_route_disabled"
// The account number is canceled.
DeclinedTransactionSourceCheckDeclineReasonACHRouteCanceled DeclinedTransactionSourceCheckDeclineReason = "ach_route_canceled"
// The transaction would cause a limit to be exceeded.
DeclinedTransactionSourceCheckDeclineReasonBreachesLimit DeclinedTransactionSourceCheckDeclineReason = "breaches_limit"
// The account's entity is not active.
DeclinedTransactionSourceCheckDeclineReasonEntityNotActive DeclinedTransactionSourceCheckDeclineReason = "entity_not_active"
// Your account is inactive.
DeclinedTransactionSourceCheckDeclineReasonGroupLocked DeclinedTransactionSourceCheckDeclineReason = "group_locked"
// Your account contains insufficient funds.
DeclinedTransactionSourceCheckDeclineReasonInsufficientFunds DeclinedTransactionSourceCheckDeclineReason = "insufficient_funds"
// Stop payment requested for this check.
DeclinedTransactionSourceCheckDeclineReasonStopPaymentRequested DeclinedTransactionSourceCheckDeclineReason = "stop_payment_requested"
// The check was a duplicate deposit.
DeclinedTransactionSourceCheckDeclineReasonDuplicatePresentment DeclinedTransactionSourceCheckDeclineReason = "duplicate_presentment"
// The check was not authorized.
DeclinedTransactionSourceCheckDeclineReasonNotAuthorized DeclinedTransactionSourceCheckDeclineReason = "not_authorized"
// The amount the receiving bank is attempting to deposit does not match the amount
// on the check.
DeclinedTransactionSourceCheckDeclineReasonAmountMismatch DeclinedTransactionSourceCheckDeclineReason = "amount_mismatch"
// The check attempting to be deposited does not belong to Acme.
DeclinedTransactionSourceCheckDeclineReasonNotOurItem DeclinedTransactionSourceCheckDeclineReason = "not_our_item"
// The account number on the check does not exist at Acme.
DeclinedTransactionSourceCheckDeclineReasonNoAccountNumberFound DeclinedTransactionSourceCheckDeclineReason = "no_account_number_found"
)
// An Inbound Real-Time Payments Transfer Decline object. This field will be
// present in the JSON response if and only if `category` is equal to
// `inbound_real_time_payments_transfer_decline`.
type DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline struct {
// The declined amount in the minor unit of the destination account currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount,required"`
// The name the sender of the transfer specified as the recipient of the transfer.
CreditorName string `json:"creditor_name,required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined
// transfer's currency. This will always be "USD" for a Real-Time Payments
// transfer.
Currency DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency `json:"currency,required"`
// The account number of the account that sent the transfer.
DebtorAccountNumber string `json:"debtor_account_number,required"`
// The name provided by the sender of the transfer.
DebtorName string `json:"debtor_name,required"`
// The routing number of the account that sent the transfer.
DebtorRoutingNumber string `json:"debtor_routing_number,required"`
// Why the transfer was declined.
Reason DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason `json:"reason,required"`
// Additional information included with the transfer.
RemittanceInformation string `json:"remittance_information,required,nullable"`
// The Real-Time Payments network identification of the declined transfer.
TransactionIdentification string `json:"transaction_identification,required"`
JSON declinedTransactionSourceInboundRealTimePaymentsTransferDeclineJSON `json:"-"`
}
// declinedTransactionSourceInboundRealTimePaymentsTransferDeclineJSON contains the
// JSON metadata for the struct
// [DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline]
type declinedTransactionSourceInboundRealTimePaymentsTransferDeclineJSON struct {
Amount apijson.Field
CreditorName apijson.Field
Currency apijson.Field
DebtorAccountNumber apijson.Field
DebtorName apijson.Field
DebtorRoutingNumber apijson.Field
Reason apijson.Field
RemittanceInformation apijson.Field
TransactionIdentification apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined
// transfer's currency. This will always be "USD" for a Real-Time Payments
// transfer.
type DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency string
const (
// Canadian Dollar (CAD)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyCad DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "CAD"
// Swiss Franc (CHF)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyChf DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "CHF"
// Euro (EUR)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyEur DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "EUR"
// British Pound (GBP)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyGbp DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "GBP"
// Japanese Yen (JPY)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyJpy DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "JPY"
// US Dollar (USD)
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrencyUsd DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineCurrency = "USD"
)
// Why the transfer was declined.
type DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason string
const (
// The account number is canceled.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonAccountNumberCanceled DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "account_number_canceled"
// The account number is disabled.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonAccountNumberDisabled DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "account_number_disabled"
// Your account is restricted.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonAccountRestricted DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "account_restricted"
// Your account is inactive.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonGroupLocked DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "group_locked"
// The account's entity is not active.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonEntityNotActive DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "entity_not_active"
// Your account is not enabled to receive Real-Time Payments transfers.
DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReasonRealTimePaymentsNotEnabled DeclinedTransactionSourceInboundRealTimePaymentsTransferDeclineReason = "real_time_payments_not_enabled"
)
// An International ACH Decline object. This field will be present in the JSON
// response if and only if `category` is equal to `international_ach_decline`.
type DeclinedTransactionSourceInternationalACHDecline struct {
// The declined amount in the minor unit of the destination account currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount,required"`
// The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2
// country code of the destination country.
DestinationCountryCode string `json:"destination_country_code,required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the
// destination bank account.
DestinationCurrencyCode string `json:"destination_currency_code,required"`
// A description of how the foreign exchange rate was calculated.
ForeignExchangeIndicator DeclinedTransactionSourceInternationalACHDeclineForeignExchangeIndicator `json:"foreign_exchange_indicator,required"`
// Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a
// reference to a well-known rate.
ForeignExchangeReference string `json:"foreign_exchange_reference,required,nullable"`
// An instruction of how to interpret the `foreign_exchange_reference` field for
// this Transaction.
ForeignExchangeReferenceIndicator DeclinedTransactionSourceInternationalACHDeclineForeignExchangeReferenceIndicator `json:"foreign_exchange_reference_indicator,required"`
// The amount in the minor unit of the foreign payment currency. For dollars, for
// example, this is cents.
ForeignPaymentAmount int64 `json:"foreign_payment_amount,required"`
// A reference number in the foreign banking infrastructure.
ForeignTraceNumber string `json:"foreign_trace_number,required,nullable"`
// The type of transfer. Set by the originator.
InternationalTransactionTypeCode DeclinedTransactionSourceInternationalACHDeclineInternationalTransactionTypeCode `json:"international_transaction_type_code,required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the
// originating bank account.
OriginatingCurrencyCode string `json:"originating_currency_code,required"`
// The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2
// country code of the originating branch country.
OriginatingDepositoryFinancialInstitutionBranchCountry string `json:"originating_depository_financial_institution_branch_country,required"`
// An identifier for the originating bank. One of an International Bank Account
// Number (IBAN) bank identifier, SWIFT Bank Identification Code (BIC), or a
// domestic identifier like a US Routing Number.
OriginatingDepositoryFinancialInstitutionID string `json:"originating_depository_financial_institution_id,required"`
// An instruction of how to interpret the
// `originating_depository_financial_institution_id` field for this Transaction.
OriginatingDepositoryFinancialInstitutionIDQualifier DeclinedTransactionSourceInternationalACHDeclineOriginatingDepositoryFinancialInstitutionIDQualifier `json:"originating_depository_financial_institution_id_qualifier,required"`
// The name of the originating bank. Sometimes this will refer to an American bank
// and obscure the correspondent foreign bank.
OriginatingDepositoryFinancialInstitutionName string `json:"originating_depository_financial_institution_name,required"`
// A portion of the originator address. This may be incomplete.
OriginatorCity string `json:"originator_city,required"`
// A description field set by the originator.
OriginatorCompanyEntryDescription string `json:"originator_company_entry_description,required"`
// A portion of the originator address. The
// [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 country
// code of the originator country.
OriginatorCountry string `json:"originator_country,required"`
// An identifier for the originating company. This is generally stable across
// multiple ACH transfers.
OriginatorIdentification string `json:"originator_identification,required"`
// Either the name of the originator or an intermediary money transmitter.
OriginatorName string `json:"originator_name,required"`
// A portion of the originator address. This may be incomplete.
OriginatorPostalCode string `json:"originator_postal_code,required,nullable"`
// A portion of the originator address. This may be incomplete.
OriginatorStateOrProvince string `json:"originator_state_or_province,required,nullable"`
// A portion of the originator address. This may be incomplete.
OriginatorStreetAddress string `json:"originator_street_address,required"`
// A description field set by the originator.
PaymentRelatedInformation string `json:"payment_related_information,required,nullable"`
// A description field set by the originator.
PaymentRelatedInformation2 string `json:"payment_related_information2,required,nullable"`
// A portion of the receiver address. This may be incomplete.
ReceiverCity string `json:"receiver_city,required"`
// A portion of the receiver address. The
// [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 country
// code of the receiver country.
ReceiverCountry string `json:"receiver_country,required"`
// An identification number the originator uses for the receiver.
ReceiverIdentificationNumber string `json:"receiver_identification_number,required,nullable"`
// A portion of the receiver address. This may be incomplete.
ReceiverPostalCode string `json:"receiver_postal_code,required,nullable"`
// A portion of the receiver address. This may be incomplete.
ReceiverStateOrProvince string `json:"receiver_state_or_province,required,nullable"`
// A portion of the receiver address. This may be incomplete.
ReceiverStreetAddress string `json:"receiver_street_address,required"`
// The name of the receiver of the transfer. This is not verified by Acme.
ReceivingCompanyOrIndividualName string `json:"receiving_company_or_individual_name,required"`
// The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2
// country code of the receiving bank country.
ReceivingDepositoryFinancialInstitutionCountry string `json:"receiving_depository_financial_institution_country,required"`
// An identifier for the receiving bank. One of an International Bank Account
// Number (IBAN) bank identifier, SWIFT Bank Identification Code (BIC), or a
// domestic identifier like a US Routing Number.
ReceivingDepositoryFinancialInstitutionID string `json:"receiving_depository_financial_institution_id,required"`
// An instruction of how to interpret the
// `receiving_depository_financial_institution_id` field for this Transaction.
ReceivingDepositoryFinancialInstitutionIDQualifier DeclinedTransactionSourceInternationalACHDeclineReceivingDepositoryFinancialInstitutionIDQualifier `json:"receiving_depository_financial_institution_id_qualifier,required"`
// The name of the receiving bank, as set by the sending financial institution.
ReceivingDepositoryFinancialInstitutionName string `json:"receiving_depository_financial_institution_name,required"`
// A 15 digit number recorded in the Nacha file and available to both the
// originating and receiving bank. Along with the amount, date, and originating
// routing number, this can be used to identify the ACH transfer at either bank.
// ACH trace numbers are not unique, but are
// [used to correlate returns](https://acme.com/documentation/ach#returns).
TraceNumber string `json:"trace_number,required"`
JSON declinedTransactionSourceInternationalACHDeclineJSON `json:"-"`