/
PaymentMethod.java
1305 lines (1123 loc) · 46 KB
/
PaymentMethod.java
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
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.PaymentMethodAttachParams;
import com.stripe.param.PaymentMethodCreateParams;
import com.stripe.param.PaymentMethodDetachParams;
import com.stripe.param.PaymentMethodListParams;
import com.stripe.param.PaymentMethodRetrieveParams;
import com.stripe.param.PaymentMethodUpdateParams;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* PaymentMethod objects represent your customer's payment instruments. You can use them with <a
* href="https://stripe.com/docs/payments/payment-intents">PaymentIntents</a> to collect payments or
* save them to Customer objects to store instrument details for future payments.
*
* <p>Related guides: <a href="https://stripe.com/docs/payments/payment-methods">Payment Methods</a>
* and <a href="https://stripe.com/docs/payments/more-payment-scenarios">More Payment Scenarios</a>.
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class PaymentMethod extends ApiResource implements HasId, MetadataStore<PaymentMethod> {
@SerializedName("acss_debit")
AcssDebit acssDebit;
@SerializedName("affirm")
Affirm affirm;
@SerializedName("afterpay_clearpay")
AfterpayClearpay afterpayClearpay;
@SerializedName("alipay")
Alipay alipay;
@SerializedName("au_becs_debit")
AuBecsDebit auBecsDebit;
@SerializedName("bacs_debit")
BacsDebit bacsDebit;
@SerializedName("bancontact")
Bancontact bancontact;
@SerializedName("billing_details")
BillingDetails billingDetails;
@SerializedName("blik")
Blik blik;
@SerializedName("boleto")
Boleto boleto;
@SerializedName("card")
Card card;
@SerializedName("card_present")
CardPresent cardPresent;
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
/**
* The ID of the Customer to which this PaymentMethod is saved. This will not be set when the
* PaymentMethod has not been saved to a Customer.
*/
@SerializedName("customer")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Customer> customer;
@SerializedName("customer_balance")
CustomerBalance customerBalance;
@SerializedName("eps")
Eps eps;
@SerializedName("fpx")
Fpx fpx;
@SerializedName("giropay")
Giropay giropay;
@SerializedName("grabpay")
Grabpay grabpay;
/** Unique identifier for the object. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
@SerializedName("ideal")
Ideal ideal;
@SerializedName("interac_present")
InteracPresent interacPresent;
@SerializedName("klarna")
Klarna klarna;
@SerializedName("konbini")
Konbini konbini;
@SerializedName("link")
Link link;
/**
* Has the value {@code true} if the object exists in live mode or the value {@code false} if the
* object exists in test mode.
*/
@SerializedName("livemode")
Boolean livemode;
/**
* Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
* to an object. This can be useful for storing additional information about the object in a
* structured format.
*/
@Getter(onMethod_ = {@Override})
@SerializedName("metadata")
Map<String, String> metadata;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* <p>Equal to {@code payment_method}.
*/
@SerializedName("object")
String object;
@SerializedName("oxxo")
Oxxo oxxo;
@SerializedName("p24")
P24 p24;
@SerializedName("paynow")
Paynow paynow;
@SerializedName("pix")
Pix pix;
@SerializedName("promptpay")
Promptpay promptpay;
/**
* Options to configure Radar. See <a href="https://stripe.com/docs/radar/radar-session">Radar
* Session</a> for more information.
*/
@SerializedName("radar_options")
RadarOptions radarOptions;
@SerializedName("sepa_debit")
SepaDebit sepaDebit;
@SerializedName("sofort")
Sofort sofort;
/**
* The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name
* matching this value. It contains additional information specific to the PaymentMethod type.
*
* <p>One of {@code acss_debit}, {@code affirm}, {@code afterpay_clearpay}, {@code alipay}, {@code
* au_becs_debit}, {@code bacs_debit}, {@code bancontact}, {@code blik}, {@code boleto}, {@code
* card}, {@code card_present}, {@code customer_balance}, {@code eps}, {@code fpx}, {@code
* giropay}, {@code grabpay}, {@code ideal}, {@code interac_present}, {@code klarna}, {@code
* konbini}, {@code link}, {@code oxxo}, {@code p24}, {@code paynow}, {@code pix}, {@code
* promptpay}, {@code sepa_debit}, {@code sofort}, {@code us_bank_account}, or {@code wechat_pay}.
*/
@SerializedName("type")
String type;
@SerializedName("us_bank_account")
USBankAccount usBankAccount;
@SerializedName("wechat_pay")
WechatPay wechatPay;
/** Get ID of expandable {@code customer} object. */
public String getCustomer() {
return (this.customer != null) ? this.customer.getId() : null;
}
public void setCustomer(String id) {
this.customer = ApiResource.setExpandableFieldId(id, this.customer);
}
/** Get expanded {@code customer}. */
public Customer getCustomerObject() {
return (this.customer != null) ? this.customer.getExpanded() : null;
}
public void setCustomerObject(Customer expandableObject) {
this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
}
/**
* Attaches a PaymentMethod object to a Customer.
*
* <p>To attach a new PaymentMethod to a customer for future payments, we recommend you use a <a
* href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent with <a
* href="https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
* These approaches will perform any necessary steps to set up the PaymentMethod for future
* payments. Using the <code>/v1/payment_methods/:id/attach</code> endpoint without first using a
* SetupIntent or PaymentIntent with <code>setup_future_usage</code> does not optimize the
* PaymentMethod for future use, which makes later declines and payment friction more likely. See
* <a href="https://stripe.com/docs/payments/payment-intents#future-usage">Optimizing cards for
* future payments</a> for more information about setting up future payments.
*
* <p>To use this PaymentMethod as the default for invoice or subscription payments, set <a
* href="https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method">
* <code>invoice_settings.default_payment_method</code></a>, on the Customer to the
* PaymentMethod’s ID.
*/
public PaymentMethod attach(Map<String, Object> params) throws StripeException {
return attach(params, (RequestOptions) null);
}
/**
* Attaches a PaymentMethod object to a Customer.
*
* <p>To attach a new PaymentMethod to a customer for future payments, we recommend you use a <a
* href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent with <a
* href="https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
* These approaches will perform any necessary steps to set up the PaymentMethod for future
* payments. Using the <code>/v1/payment_methods/:id/attach</code> endpoint without first using a
* SetupIntent or PaymentIntent with <code>setup_future_usage</code> does not optimize the
* PaymentMethod for future use, which makes later declines and payment friction more likely. See
* <a href="https://stripe.com/docs/payments/payment-intents#future-usage">Optimizing cards for
* future payments</a> for more information about setting up future payments.
*
* <p>To use this PaymentMethod as the default for invoice or subscription payments, set <a
* href="https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method">
* <code>invoice_settings.default_payment_method</code></a>, on the Customer to the
* PaymentMethod’s ID.
*/
public PaymentMethod attach(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Attaches a PaymentMethod object to a Customer.
*
* <p>To attach a new PaymentMethod to a customer for future payments, we recommend you use a <a
* href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent with <a
* href="https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
* These approaches will perform any necessary steps to set up the PaymentMethod for future
* payments. Using the <code>/v1/payment_methods/:id/attach</code> endpoint without first using a
* SetupIntent or PaymentIntent with <code>setup_future_usage</code> does not optimize the
* PaymentMethod for future use, which makes later declines and payment friction more likely. See
* <a href="https://stripe.com/docs/payments/payment-intents#future-usage">Optimizing cards for
* future payments</a> for more information about setting up future payments.
*
* <p>To use this PaymentMethod as the default for invoice or subscription payments, set <a
* href="https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method">
* <code>invoice_settings.default_payment_method</code></a>, on the Customer to the
* PaymentMethod’s ID.
*/
public PaymentMethod attach(PaymentMethodAttachParams params) throws StripeException {
return attach(params, (RequestOptions) null);
}
/**
* Attaches a PaymentMethod object to a Customer.
*
* <p>To attach a new PaymentMethod to a customer for future payments, we recommend you use a <a
* href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> or a PaymentIntent with <a
* href="https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
* These approaches will perform any necessary steps to set up the PaymentMethod for future
* payments. Using the <code>/v1/payment_methods/:id/attach</code> endpoint without first using a
* SetupIntent or PaymentIntent with <code>setup_future_usage</code> does not optimize the
* PaymentMethod for future use, which makes later declines and payment friction more likely. See
* <a href="https://stripe.com/docs/payments/payment-intents#future-usage">Optimizing cards for
* future payments</a> for more information about setting up future payments.
*
* <p>To use this PaymentMethod as the default for invoice or subscription payments, set <a
* href="https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method">
* <code>invoice_settings.default_payment_method</code></a>, on the Customer to the
* PaymentMethod’s ID.
*/
public PaymentMethod attach(PaymentMethodAttachParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Creates a PaymentMethod object. Read the <a
* href="https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js
* reference</a> to learn how to create PaymentMethods via Stripe.js.
*
* <p>Instead of creating a PaymentMethod directly, we recommend using the <a
* href="https://stripe.com/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a
* payment immediately or the <a
* href="https://stripe.com/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment
* method details ahead of a future payment.
*/
public static PaymentMethod create(Map<String, Object> params) throws StripeException {
return create(params, (RequestOptions) null);
}
/**
* Creates a PaymentMethod object. Read the <a
* href="https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js
* reference</a> to learn how to create PaymentMethods via Stripe.js.
*
* <p>Instead of creating a PaymentMethod directly, we recommend using the <a
* href="https://stripe.com/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a
* payment immediately or the <a
* href="https://stripe.com/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment
* method details ahead of a future payment.
*/
public static PaymentMethod create(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_methods");
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Creates a PaymentMethod object. Read the <a
* href="https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js
* reference</a> to learn how to create PaymentMethods via Stripe.js.
*
* <p>Instead of creating a PaymentMethod directly, we recommend using the <a
* href="https://stripe.com/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a
* payment immediately or the <a
* href="https://stripe.com/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment
* method details ahead of a future payment.
*/
public static PaymentMethod create(PaymentMethodCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}
/**
* Creates a PaymentMethod object. Read the <a
* href="https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js
* reference</a> to learn how to create PaymentMethods via Stripe.js.
*
* <p>Instead of creating a PaymentMethod directly, we recommend using the <a
* href="https://stripe.com/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a
* payment immediately or the <a
* href="https://stripe.com/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment
* method details ahead of a future payment.
*/
public static PaymentMethod create(PaymentMethodCreateParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_methods");
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach() throws StripeException {
return detach((Map<String, Object>) null, (RequestOptions) null);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach(RequestOptions options) throws StripeException {
return detach((Map<String, Object>) null, options);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach(Map<String, Object> params) throws StripeException {
return detach(params, (RequestOptions) null);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach(PaymentMethodDetachParams params) throws StripeException {
return detach(params, (RequestOptions) null);
}
/**
* Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no
* longer be used for a payment or re-attached to a Customer.
*/
public PaymentMethod detach(PaymentMethodDetachParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/**
* Returns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s
* payment methods, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer_list">List a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethodCollection list(Map<String, Object> params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s
* payment methods, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer_list">List a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethodCollection list(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_methods");
return ApiResource.requestCollection(url, params, PaymentMethodCollection.class, options);
}
/**
* Returns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s
* payment methods, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer_list">List a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethodCollection list(PaymentMethodListParams params)
throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s
* payment methods, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer_list">List a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethodCollection list(PaymentMethodListParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_methods");
return ApiResource.requestCollection(url, params, PaymentMethodCollection.class, options);
}
/**
* Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method
* attached to a Customer, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer">Retrieve a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethod retrieve(String paymentMethod) throws StripeException {
return retrieve(paymentMethod, (Map<String, Object>) null, (RequestOptions) null);
}
/**
* Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method
* attached to a Customer, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer">Retrieve a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethod retrieve(String paymentMethod, RequestOptions options)
throws StripeException {
return retrieve(paymentMethod, (Map<String, Object>) null, options);
}
/**
* Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method
* attached to a Customer, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer">Retrieve a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethod retrieve(
String paymentMethod, Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod)));
return ApiResource.request(
ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options);
}
/**
* Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method
* attached to a Customer, you should use <a
* href="https://stripe.com/docs/api/payment_methods/customer">Retrieve a Customer’s
* PaymentMethods</a>
*/
public static PaymentMethod retrieve(
String paymentMethod, PaymentMethodRetrieveParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod)));
return ApiResource.request(
ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options);
}
/** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */
@Override
public PaymentMethod update(Map<String, Object> params) throws StripeException {
return update(params, (RequestOptions) null);
}
/** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */
@Override
public PaymentMethod update(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
/** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */
public PaymentMethod update(PaymentMethodUpdateParams params) throws StripeException {
return update(params, (RequestOptions) null);
}
/** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */
public PaymentMethod update(PaymentMethodUpdateParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AcssDebit extends StripeObject {
/** Name of the bank associated with the bank account. */
@SerializedName("bank_name")
String bankName;
/**
* Uniquely identifies this particular bank account. You can use this attribute to check whether
* two bank accounts are the same.
*/
@SerializedName("fingerprint")
String fingerprint;
/** Institution number of the bank account. */
@SerializedName("institution_number")
String institutionNumber;
/** Last four digits of the bank account number. */
@SerializedName("last4")
String last4;
/** Transit number of the bank account. */
@SerializedName("transit_number")
String transitNumber;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Affirm extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AfterpayClearpay extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Alipay extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AuBecsDebit extends StripeObject {
/** Six-digit number identifying bank and branch associated with this bank account. */
@SerializedName("bsb_number")
String bsbNumber;
/**
* Uniquely identifies this particular bank account. You can use this attribute to check whether
* two bank accounts are the same.
*/
@SerializedName("fingerprint")
String fingerprint;
/** Last four digits of the bank account number. */
@SerializedName("last4")
String last4;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BacsDebit extends StripeObject {
/**
* Uniquely identifies this particular bank account. You can use this attribute to check whether
* two bank accounts are the same.
*/
@SerializedName("fingerprint")
String fingerprint;
/** Last four digits of the bank account number. */
@SerializedName("last4")
String last4;
/** Sort code of the bank account. (e.g., {@code 10-20-30}) */
@SerializedName("sort_code")
String sortCode;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Bancontact extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BillingDetails extends StripeObject {
/** Billing address. */
@SerializedName("address")
Address address;
/** Email address. */
@SerializedName("email")
String email;
/** Full name. */
@SerializedName("name")
String name;
/** Billing phone number (including extension). */
@SerializedName("phone")
String phone;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Blik extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Boleto extends StripeObject {
/** Uniquely identifies the customer tax id (CNPJ or CPF). */
@SerializedName("tax_id")
String taxId;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Card extends StripeObject {
/**
* Card brand. Can be {@code amex}, {@code diners}, {@code discover}, {@code jcb}, {@code
* mastercard}, {@code unionpay}, {@code visa}, or {@code unknown}.
*/
@SerializedName("brand")
String brand;
/** Checks on Card address and CVC if provided. */
@SerializedName("checks")
Checks checks;
/**
* Two-letter ISO code representing the country of the card. You could use this attribute to get
* a sense of the international breakdown of cards you've collected.
*/
@SerializedName("country")
String country;
/**
* A high-level description of the type of cards issued in this range. (For internal use only
* and not typically available in standard API requests.)
*/
@SerializedName("description")
String description;
/** Two-digit number representing the card's expiration month. */
@SerializedName("exp_month")
Long expMonth;
/** Four-digit number representing the card's expiration year. */
@SerializedName("exp_year")
Long expYear;
/**
* Uniquely identifies this particular card number. You can use this attribute to check whether
* two customers who’ve signed up with you are using the same card number, for example. For
* payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number
* might be provided instead of the underlying card number.
*
* <p><em>Starting May 1, 2021, card fingerprint in India for Connect will change to allow two
* fingerprints for the same card --- one for India and one for the rest of the world.</em>
*/
@SerializedName("fingerprint")
String fingerprint;
/**
* Card funding type. Can be {@code credit}, {@code debit}, {@code prepaid}, or {@code unknown}.
*/
@SerializedName("funding")
String funding;
/**
* Issuer identification number of the card. (For internal use only and not typically available
* in standard API requests.)
*/
@SerializedName("iin")
String iin;
/**
* The name of the card's issuing bank. (For internal use only and not typically available in
* standard API requests.)
*/
@SerializedName("issuer")
String issuer;
/** The last four digits of the card. */
@SerializedName("last4")
String last4;
/** Contains information about card networks that can be used to process the payment. */
@SerializedName("networks")
Networks networks;
/** Contains details on how this Card maybe be used for 3D Secure authentication. */
@SerializedName("three_d_secure_usage")
ThreeDSecureUsage threeDSecureUsage;
/** If this Card is part of a card wallet, this contains the details of the card wallet. */
@SerializedName("wallet")
Wallet wallet;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Checks extends StripeObject {
/**
* If a address line1 was provided, results of the check, one of {@code pass}, {@code fail},
* {@code unavailable}, or {@code unchecked}.
*/
@SerializedName("address_line1_check")
String addressLine1Check;
/**
* If a address postal code was provided, results of the check, one of {@code pass}, {@code
* fail}, {@code unavailable}, or {@code unchecked}.
*/
@SerializedName("address_postal_code_check")
String addressPostalCodeCheck;
/**
* If a CVC was provided, results of the check, one of {@code pass}, {@code fail}, {@code
* unavailable}, or {@code unchecked}.
*/
@SerializedName("cvc_check")
String cvcCheck;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Networks extends StripeObject {
/** All available networks for the card. */
@SerializedName("available")
List<String> available;
/** The preferred network for the card. */
@SerializedName("preferred")
String preferred;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ThreeDSecureUsage extends StripeObject {
/** Whether 3D Secure is supported on this card. */
@SerializedName("supported")
Boolean supported;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Wallet extends StripeObject {
@SerializedName("amex_express_checkout")
AmexExpressCheckout amexExpressCheckout;
@SerializedName("apple_pay")
ApplePay applePay;
/** (For tokenized numbers only.) The last four digits of the device account number. */
@SerializedName("dynamic_last4")
String dynamicLast4;
@SerializedName("google_pay")
GooglePay googlePay;
@SerializedName("masterpass")
Masterpass masterpass;
@SerializedName("samsung_pay")
SamsungPay samsungPay;
/**
* The type of the card wallet, one of {@code amex_express_checkout}, {@code apple_pay},
* {@code google_pay}, {@code masterpass}, {@code samsung_pay}, or {@code visa_checkout}. An
* additional hash is included on the Wallet subhash with a name matching this value. It
* contains additional information specific to the card wallet type.
*/
@SerializedName("type")
String type;
@SerializedName("visa_checkout")
VisaCheckout visaCheckout;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AmexExpressCheckout extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ApplePay extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class GooglePay extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Masterpass extends StripeObject {
/**
* Owner's verified billing address. Values are verified or provided by the wallet directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("billing_address")
Address billingAddress;
/**
* Owner's verified email. Values are verified or provided by the wallet directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("email")
String email;
/**
* Owner's verified full name. Values are verified or provided by the wallet directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("name")
String name;
/**
* Owner's verified shipping address. Values are verified or provided by the wallet directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("shipping_address")
Address shippingAddress;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class SamsungPay extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class VisaCheckout extends StripeObject {
/**
* Owner's verified billing address. Values are verified or provided by the wallet directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("billing_address")
Address billingAddress;
/**
* Owner's verified email. Values are verified or provided by the wallet directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("email")
String email;
/**
* Owner's verified full name. Values are verified or provided by the wallet directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("name")
String name;
/**
* Owner's verified shipping address. Values are verified or provided by the wallet directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
@SerializedName("shipping_address")
Address shippingAddress;
}
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class CardPresent extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class CustomerBalance extends StripeObject {}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Eps extends StripeObject {
/**
* The customer's bank. Should be one of {@code arzte_und_apotheker_bank}, {@code
* austrian_anadi_bank_ag}, {@code bank_austria}, {@code bankhaus_carl_spangler}, {@code
* bankhaus_schelhammer_und_schattera_ag}, {@code bawag_psk_ag}, {@code bks_bank_ag}, {@code
* brull_kallmus_bank_ag}, {@code btv_vier_lander_bank}, {@code capital_bank_grawe_gruppe_ag},
* {@code deutsche_bank_ag}, {@code dolomitenbank}, {@code easybank_ag}, {@code
* erste_bank_und_sparkassen}, {@code hypo_alpeadriabank_international_ag}, {@code
* hypo_noe_lb_fur_niederosterreich_u_wien}, {@code hypo_oberosterreich_salzburg_steiermark},
* {@code hypo_tirol_bank_ag}, {@code hypo_vorarlberg_bank_ag}, {@code
* hypo_bank_burgenland_aktiengesellschaft}, {@code marchfelder_bank}, {@code oberbank_ag},
* {@code raiffeisen_bankengruppe_osterreich}, {@code schoellerbank_ag}, {@code
* sparda_bank_wien}, {@code volksbank_gruppe}, {@code volkskreditbank_ag}, or {@code
* vr_bank_braunau}.
*/
@SerializedName("bank")
String bank;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Fpx extends StripeObject {
/** Account holder type, if provided. Can be one of {@code individual} or {@code company}. */
@SerializedName("account_holder_type")
String accountHolderType;
/**
* The customer's bank, if provided. Can be one of {@code affin_bank}, {@code agrobank}, {@code
* alliance_bank}, {@code ambank}, {@code bank_islam}, {@code bank_muamalat}, {@code
* bank_rakyat}, {@code bsn}, {@code cimb}, {@code hong_leong_bank}, {@code hsbc}, {@code kfh},
* {@code maybank2u}, {@code ocbc}, {@code public_bank}, {@code rhb}, {@code
* standard_chartered}, {@code uob}, {@code deutsche_bank}, {@code maybank2e}, or {@code
* pb_enterprise}.