• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16599

29 Oct 2024 11:04PM UTC coverage: 12.519% (-0.1%) from 12.62%
#16599

push

github

web-flow
Merge pull request #1914 from stripe/latest-codegen-beta

Update generated code for beta

40 of 1580 new or added lines in 51 files covered. (2.53%)

19 existing lines in 15 files now uncovered.

18843 of 150513 relevant lines covered (12.52%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.74
/src/main/java/com/stripe/service/PaymentIntentService.java
1
// File generated from our OpenAPI spec
2
package com.stripe.service;
3

4
import com.google.gson.reflect.TypeToken;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.PaymentIntent;
7
import com.stripe.model.StripeCollection;
8
import com.stripe.model.StripeSearchResult;
9
import com.stripe.net.ApiRequest;
10
import com.stripe.net.ApiRequestParams;
11
import com.stripe.net.ApiResource;
12
import com.stripe.net.ApiService;
13
import com.stripe.net.BaseAddress;
14
import com.stripe.net.RequestOptions;
15
import com.stripe.net.StripeResponseGetter;
16
import com.stripe.param.PaymentIntentApplyCustomerBalanceParams;
17
import com.stripe.param.PaymentIntentCancelParams;
18
import com.stripe.param.PaymentIntentCaptureParams;
19
import com.stripe.param.PaymentIntentConfirmParams;
20
import com.stripe.param.PaymentIntentCreateParams;
21
import com.stripe.param.PaymentIntentDecrementAuthorizationParams;
22
import com.stripe.param.PaymentIntentIncrementAuthorizationParams;
23
import com.stripe.param.PaymentIntentListParams;
24
import com.stripe.param.PaymentIntentRetrieveParams;
25
import com.stripe.param.PaymentIntentSearchParams;
26
import com.stripe.param.PaymentIntentTriggerActionParams;
27
import com.stripe.param.PaymentIntentUpdateParams;
28
import com.stripe.param.PaymentIntentVerifyMicrodepositsParams;
29

30
public final class PaymentIntentService extends ApiService {
31
  public PaymentIntentService(StripeResponseGetter responseGetter) {
32
    super(responseGetter);
1✔
33
  }
1✔
34

35
  /** Returns a list of PaymentIntents. */
36
  public StripeCollection<PaymentIntent> list(PaymentIntentListParams params)
37
      throws StripeException {
38
    return list(params, (RequestOptions) null);
1✔
39
  }
40
  /** Returns a list of PaymentIntents. */
41
  public StripeCollection<PaymentIntent> list(RequestOptions options) throws StripeException {
42
    return list((PaymentIntentListParams) null, options);
×
43
  }
44
  /** Returns a list of PaymentIntents. */
45
  public StripeCollection<PaymentIntent> list() throws StripeException {
46
    return list((PaymentIntentListParams) null, (RequestOptions) null);
×
47
  }
48
  /** Returns a list of PaymentIntents. */
49
  public StripeCollection<PaymentIntent> list(
50
      PaymentIntentListParams params, RequestOptions options) throws StripeException {
51
    String path = "/v1/payment_intents";
1✔
52
    ApiRequest request =
1✔
53
        new ApiRequest(
54
            BaseAddress.API,
55
            ApiResource.RequestMethod.GET,
56
            path,
57
            ApiRequestParams.paramsToMap(params),
1✔
58
            options);
59
    return this.request(request, new TypeToken<StripeCollection<PaymentIntent>>() {}.getType());
1✔
60
  }
61
  /**
62
   * Creates a PaymentIntent object.
63
   *
64
   * <p>After the PaymentIntent is created, attach a payment method and <a
65
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm</a> to continue the payment.
66
   * Learn more about <a href="https://stripe.com/docs/payments/payment-intents">the available
67
   * payment flows with the Payment Intents API</a>.
68
   *
69
   * <p>When you use {@code confirm=true} during creation, it’s equivalent to creating and
70
   * confirming the PaymentIntent in the same call. You can use any parameters available in the <a
71
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> when you supply
72
   * {@code confirm=true}.
73
   */
74
  public PaymentIntent create(PaymentIntentCreateParams params) throws StripeException {
75
    return create(params, (RequestOptions) null);
1✔
76
  }
77
  /**
78
   * Creates a PaymentIntent object.
79
   *
80
   * <p>After the PaymentIntent is created, attach a payment method and <a
81
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm</a> to continue the payment.
82
   * Learn more about <a href="https://stripe.com/docs/payments/payment-intents">the available
83
   * payment flows with the Payment Intents API</a>.
84
   *
85
   * <p>When you use {@code confirm=true} during creation, it’s equivalent to creating and
86
   * confirming the PaymentIntent in the same call. You can use any parameters available in the <a
87
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> when you supply
88
   * {@code confirm=true}.
89
   */
90
  public PaymentIntent create(PaymentIntentCreateParams params, RequestOptions options)
91
      throws StripeException {
92
    String path = "/v1/payment_intents";
1✔
93
    ApiRequest request =
1✔
94
        new ApiRequest(
95
            BaseAddress.API,
96
            ApiResource.RequestMethod.POST,
97
            path,
98
            ApiRequestParams.paramsToMap(params),
1✔
99
            options);
100
    return this.request(request, PaymentIntent.class);
1✔
101
  }
102
  /**
103
   * Retrieves the details of a PaymentIntent that has previously been created.
104
   *
105
   * <p>You can retrieve a PaymentIntent client-side using a publishable key when the {@code
106
   * client_secret} is in the query string.
107
   *
108
   * <p>If you retrieve a PaymentIntent with a publishable key, it only returns a subset of
109
   * properties. Refer to the <a href="https://stripe.com/docs/api#payment_intent_object">payment
110
   * intent</a> object reference for more details.
111
   */
112
  public PaymentIntent retrieve(String intent, PaymentIntentRetrieveParams params)
113
      throws StripeException {
114
    return retrieve(intent, params, (RequestOptions) null);
1✔
115
  }
116
  /**
117
   * Retrieves the details of a PaymentIntent that has previously been created.
118
   *
119
   * <p>You can retrieve a PaymentIntent client-side using a publishable key when the {@code
120
   * client_secret} is in the query string.
121
   *
122
   * <p>If you retrieve a PaymentIntent with a publishable key, it only returns a subset of
123
   * properties. Refer to the <a href="https://stripe.com/docs/api#payment_intent_object">payment
124
   * intent</a> object reference for more details.
125
   */
126
  public PaymentIntent retrieve(String intent, RequestOptions options) throws StripeException {
127
    return retrieve(intent, (PaymentIntentRetrieveParams) null, options);
×
128
  }
129
  /**
130
   * Retrieves the details of a PaymentIntent that has previously been created.
131
   *
132
   * <p>You can retrieve a PaymentIntent client-side using a publishable key when the {@code
133
   * client_secret} is in the query string.
134
   *
135
   * <p>If you retrieve a PaymentIntent with a publishable key, it only returns a subset of
136
   * properties. Refer to the <a href="https://stripe.com/docs/api#payment_intent_object">payment
137
   * intent</a> object reference for more details.
138
   */
139
  public PaymentIntent retrieve(String intent) throws StripeException {
140
    return retrieve(intent, (PaymentIntentRetrieveParams) null, (RequestOptions) null);
×
141
  }
142
  /**
143
   * Retrieves the details of a PaymentIntent that has previously been created.
144
   *
145
   * <p>You can retrieve a PaymentIntent client-side using a publishable key when the {@code
146
   * client_secret} is in the query string.
147
   *
148
   * <p>If you retrieve a PaymentIntent with a publishable key, it only returns a subset of
149
   * properties. Refer to the <a href="https://stripe.com/docs/api#payment_intent_object">payment
150
   * intent</a> object reference for more details.
151
   */
152
  public PaymentIntent retrieve(
153
      String intent, PaymentIntentRetrieveParams params, RequestOptions options)
154
      throws StripeException {
155
    String path = String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent));
1✔
156
    ApiRequest request =
1✔
157
        new ApiRequest(
158
            BaseAddress.API,
159
            ApiResource.RequestMethod.GET,
160
            path,
161
            ApiRequestParams.paramsToMap(params),
1✔
162
            options);
163
    return this.request(request, PaymentIntent.class);
1✔
164
  }
165
  /**
166
   * Updates properties on a PaymentIntent object without confirming.
167
   *
168
   * <p>Depending on which properties you update, you might need to confirm the PaymentIntent again.
169
   * For example, updating the {@code payment_method} always requires you to confirm the
170
   * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend
171
   * updating properties through the <a
172
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> instead.
173
   */
174
  public PaymentIntent update(String intent, PaymentIntentUpdateParams params)
175
      throws StripeException {
176
    return update(intent, params, (RequestOptions) null);
1✔
177
  }
178
  /**
179
   * Updates properties on a PaymentIntent object without confirming.
180
   *
181
   * <p>Depending on which properties you update, you might need to confirm the PaymentIntent again.
182
   * For example, updating the {@code payment_method} always requires you to confirm the
183
   * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend
184
   * updating properties through the <a
185
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> instead.
186
   */
187
  public PaymentIntent update(String intent, RequestOptions options) throws StripeException {
188
    return update(intent, (PaymentIntentUpdateParams) null, options);
×
189
  }
190
  /**
191
   * Updates properties on a PaymentIntent object without confirming.
192
   *
193
   * <p>Depending on which properties you update, you might need to confirm the PaymentIntent again.
194
   * For example, updating the {@code payment_method} always requires you to confirm the
195
   * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend
196
   * updating properties through the <a
197
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> instead.
198
   */
199
  public PaymentIntent update(String intent) throws StripeException {
200
    return update(intent, (PaymentIntentUpdateParams) null, (RequestOptions) null);
×
201
  }
202
  /**
203
   * Updates properties on a PaymentIntent object without confirming.
204
   *
205
   * <p>Depending on which properties you update, you might need to confirm the PaymentIntent again.
206
   * For example, updating the {@code payment_method} always requires you to confirm the
207
   * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend
208
   * updating properties through the <a
209
   * href="https://stripe.com/docs/api/payment_intents/confirm">confirm API</a> instead.
210
   */
211
  public PaymentIntent update(
212
      String intent, PaymentIntentUpdateParams params, RequestOptions options)
213
      throws StripeException {
214
    String path = String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent));
1✔
215
    ApiRequest request =
1✔
216
        new ApiRequest(
217
            BaseAddress.API,
218
            ApiResource.RequestMethod.POST,
219
            path,
220
            ApiRequestParams.paramsToMap(params),
1✔
221
            options);
222
    return this.request(request, PaymentIntent.class);
1✔
223
  }
224
  /**
225
   * Search for PaymentIntents you’ve previously created using Stripe’s <a
226
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
227
   * use search in read-after-write flows where strict consistency is necessary. Under normal
228
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
229
   * new or updated data can be up to an hour behind during outages. Search functionality is not
230
   * available to merchants in India.
231
   */
232
  public StripeSearchResult<PaymentIntent> search(PaymentIntentSearchParams params)
233
      throws StripeException {
234
    return search(params, (RequestOptions) null);
1✔
235
  }
236
  /**
237
   * Search for PaymentIntents you’ve previously created using Stripe’s <a
238
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
239
   * use search in read-after-write flows where strict consistency is necessary. Under normal
240
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
241
   * new or updated data can be up to an hour behind during outages. Search functionality is not
242
   * available to merchants in India.
243
   */
244
  public StripeSearchResult<PaymentIntent> search(
245
      PaymentIntentSearchParams params, RequestOptions options) throws StripeException {
246
    String path = "/v1/payment_intents/search";
1✔
247
    ApiRequest request =
1✔
248
        new ApiRequest(
249
            BaseAddress.API,
250
            ApiResource.RequestMethod.GET,
251
            path,
252
            ApiRequestParams.paramsToMap(params),
1✔
253
            options);
254
    return this.request(request, new TypeToken<StripeSearchResult<PaymentIntent>>() {}.getType());
1✔
255
  }
256
  /** Manually reconcile the remaining amount for a {@code customer_balance} PaymentIntent. */
257
  public PaymentIntent applyCustomerBalance(
258
      String intent, PaymentIntentApplyCustomerBalanceParams params) throws StripeException {
259
    return applyCustomerBalance(intent, params, (RequestOptions) null);
1✔
260
  }
261
  /** Manually reconcile the remaining amount for a {@code customer_balance} PaymentIntent. */
262
  public PaymentIntent applyCustomerBalance(String intent, RequestOptions options)
263
      throws StripeException {
264
    return applyCustomerBalance(intent, (PaymentIntentApplyCustomerBalanceParams) null, options);
×
265
  }
266
  /** Manually reconcile the remaining amount for a {@code customer_balance} PaymentIntent. */
267
  public PaymentIntent applyCustomerBalance(String intent) throws StripeException {
268
    return applyCustomerBalance(
×
269
        intent, (PaymentIntentApplyCustomerBalanceParams) null, (RequestOptions) null);
270
  }
271
  /** Manually reconcile the remaining amount for a {@code customer_balance} PaymentIntent. */
272
  public PaymentIntent applyCustomerBalance(
273
      String intent, PaymentIntentApplyCustomerBalanceParams params, RequestOptions options)
274
      throws StripeException {
275
    String path =
1✔
276
        String.format(
1✔
277
            "/v1/payment_intents/%s/apply_customer_balance", ApiResource.urlEncodeId(intent));
1✔
278
    ApiRequest request =
1✔
279
        new ApiRequest(
280
            BaseAddress.API,
281
            ApiResource.RequestMethod.POST,
282
            path,
283
            ApiRequestParams.paramsToMap(params),
1✔
284
            options);
285
    return this.request(request, PaymentIntent.class);
1✔
286
  }
287
  /**
288
   * You can cancel a PaymentIntent object when it’s in one of these statuses: {@code
289
   * requires_payment_method}, {@code requires_capture}, {@code requires_confirmation}, {@code
290
   * requires_action} or, <a href="https://stripe.com/docs/payments/intents">in rare cases</a>,
291
   * {@code processing}.
292
   *
293
   * <p>After it’s canceled, no additional charges are made by the PaymentIntent and any operations
294
   * on the PaymentIntent fail with an error. For PaymentIntents with a {@code status} of {@code
295
   * requires_capture}, the remaining {@code amount_capturable} is automatically refunded.
296
   *
297
   * <p>You can’t cancel the PaymentIntent for a Checkout Session. <a
298
   * href="https://stripe.com/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
299
   * instead.
300
   */
301
  public PaymentIntent cancel(String intent, PaymentIntentCancelParams params)
302
      throws StripeException {
303
    return cancel(intent, params, (RequestOptions) null);
1✔
304
  }
305
  /**
306
   * You can cancel a PaymentIntent object when it’s in one of these statuses: {@code
307
   * requires_payment_method}, {@code requires_capture}, {@code requires_confirmation}, {@code
308
   * requires_action} or, <a href="https://stripe.com/docs/payments/intents">in rare cases</a>,
309
   * {@code processing}.
310
   *
311
   * <p>After it’s canceled, no additional charges are made by the PaymentIntent and any operations
312
   * on the PaymentIntent fail with an error. For PaymentIntents with a {@code status} of {@code
313
   * requires_capture}, the remaining {@code amount_capturable} is automatically refunded.
314
   *
315
   * <p>You can’t cancel the PaymentIntent for a Checkout Session. <a
316
   * href="https://stripe.com/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
317
   * instead.
318
   */
319
  public PaymentIntent cancel(String intent, RequestOptions options) throws StripeException {
320
    return cancel(intent, (PaymentIntentCancelParams) null, options);
×
321
  }
322
  /**
323
   * You can cancel a PaymentIntent object when it’s in one of these statuses: {@code
324
   * requires_payment_method}, {@code requires_capture}, {@code requires_confirmation}, {@code
325
   * requires_action} or, <a href="https://stripe.com/docs/payments/intents">in rare cases</a>,
326
   * {@code processing}.
327
   *
328
   * <p>After it’s canceled, no additional charges are made by the PaymentIntent and any operations
329
   * on the PaymentIntent fail with an error. For PaymentIntents with a {@code status} of {@code
330
   * requires_capture}, the remaining {@code amount_capturable} is automatically refunded.
331
   *
332
   * <p>You can’t cancel the PaymentIntent for a Checkout Session. <a
333
   * href="https://stripe.com/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
334
   * instead.
335
   */
336
  public PaymentIntent cancel(String intent) throws StripeException {
337
    return cancel(intent, (PaymentIntentCancelParams) null, (RequestOptions) null);
×
338
  }
339
  /**
340
   * You can cancel a PaymentIntent object when it’s in one of these statuses: {@code
341
   * requires_payment_method}, {@code requires_capture}, {@code requires_confirmation}, {@code
342
   * requires_action} or, <a href="https://stripe.com/docs/payments/intents">in rare cases</a>,
343
   * {@code processing}.
344
   *
345
   * <p>After it’s canceled, no additional charges are made by the PaymentIntent and any operations
346
   * on the PaymentIntent fail with an error. For PaymentIntents with a {@code status} of {@code
347
   * requires_capture}, the remaining {@code amount_capturable} is automatically refunded.
348
   *
349
   * <p>You can’t cancel the PaymentIntent for a Checkout Session. <a
350
   * href="https://stripe.com/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
351
   * instead.
352
   */
353
  public PaymentIntent cancel(
354
      String intent, PaymentIntentCancelParams params, RequestOptions options)
355
      throws StripeException {
356
    String path = String.format("/v1/payment_intents/%s/cancel", ApiResource.urlEncodeId(intent));
1✔
357
    ApiRequest request =
1✔
358
        new ApiRequest(
359
            BaseAddress.API,
360
            ApiResource.RequestMethod.POST,
361
            path,
362
            ApiRequestParams.paramsToMap(params),
1✔
363
            options);
364
    return this.request(request, PaymentIntent.class);
1✔
365
  }
366
  /**
367
   * Capture the funds of an existing uncaptured PaymentIntent when its status is {@code
368
   * requires_capture}.
369
   *
370
   * <p>Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their
371
   * creation.
372
   *
373
   * <p>Learn more about <a href="https://stripe.com/docs/payments/capture-later">separate
374
   * authorization and capture</a>.
375
   */
376
  public PaymentIntent capture(String intent, PaymentIntentCaptureParams params)
377
      throws StripeException {
378
    return capture(intent, params, (RequestOptions) null);
1✔
379
  }
380
  /**
381
   * Capture the funds of an existing uncaptured PaymentIntent when its status is {@code
382
   * requires_capture}.
383
   *
384
   * <p>Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their
385
   * creation.
386
   *
387
   * <p>Learn more about <a href="https://stripe.com/docs/payments/capture-later">separate
388
   * authorization and capture</a>.
389
   */
390
  public PaymentIntent capture(String intent, RequestOptions options) throws StripeException {
391
    return capture(intent, (PaymentIntentCaptureParams) null, options);
×
392
  }
393
  /**
394
   * Capture the funds of an existing uncaptured PaymentIntent when its status is {@code
395
   * requires_capture}.
396
   *
397
   * <p>Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their
398
   * creation.
399
   *
400
   * <p>Learn more about <a href="https://stripe.com/docs/payments/capture-later">separate
401
   * authorization and capture</a>.
402
   */
403
  public PaymentIntent capture(String intent) throws StripeException {
404
    return capture(intent, (PaymentIntentCaptureParams) null, (RequestOptions) null);
×
405
  }
406
  /**
407
   * Capture the funds of an existing uncaptured PaymentIntent when its status is {@code
408
   * requires_capture}.
409
   *
410
   * <p>Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their
411
   * creation.
412
   *
413
   * <p>Learn more about <a href="https://stripe.com/docs/payments/capture-later">separate
414
   * authorization and capture</a>.
415
   */
416
  public PaymentIntent capture(
417
      String intent, PaymentIntentCaptureParams params, RequestOptions options)
418
      throws StripeException {
419
    String path = String.format("/v1/payment_intents/%s/capture", ApiResource.urlEncodeId(intent));
1✔
420
    ApiRequest request =
1✔
421
        new ApiRequest(
422
            BaseAddress.API,
423
            ApiResource.RequestMethod.POST,
424
            path,
425
            ApiRequestParams.paramsToMap(params),
1✔
426
            options);
427
    return this.request(request, PaymentIntent.class);
1✔
428
  }
429
  /**
430
   * Confirm that your customer intends to pay with current or provided payment method. Upon
431
   * confirmation, the PaymentIntent will attempt to initiate a payment. If the selected payment
432
   * method requires additional authentication steps, the PaymentIntent will transition to the
433
   * {@code requires_action} status and suggest additional actions via {@code next_action}. If
434
   * payment fails, the PaymentIntent transitions to the {@code requires_payment_method} status or
435
   * the {@code canceled} status if the confirmation limit is reached. If payment succeeds, the
436
   * PaymentIntent will transition to the {@code succeeded} status (or {@code requires_capture}, if
437
   * {@code capture_method} is set to {@code manual}). If the {@code confirmation_method} is {@code
438
   * automatic}, payment may be attempted using our <a
439
   * href="https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a>
440
   * and the PaymentIntent’s <a
441
   * href="https://stripe.com/docs/api#payment_intent_object-client_secret">client_secret</a>. After
442
   * {@code next_action}s are handled by the client, no additional confirmation is required to
443
   * complete the payment. If the {@code confirmation_method} is {@code manual}, all payment
444
   * attempts must be initiated using a secret key. If any actions are required for the payment, the
445
   * PaymentIntent will return to the {@code requires_confirmation} state after those actions are
446
   * completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the
447
   * next payment attempt. There is a variable upper limit on how many times a PaymentIntent can be
448
   * confirmed. After this limit is reached, any further calls to this endpoint will transition the
449
   * PaymentIntent to the {@code canceled} state.
450
   */
451
  public PaymentIntent confirm(String intent, PaymentIntentConfirmParams params)
452
      throws StripeException {
453
    return confirm(intent, params, (RequestOptions) null);
1✔
454
  }
455
  /**
456
   * Confirm that your customer intends to pay with current or provided payment method. Upon
457
   * confirmation, the PaymentIntent will attempt to initiate a payment. If the selected payment
458
   * method requires additional authentication steps, the PaymentIntent will transition to the
459
   * {@code requires_action} status and suggest additional actions via {@code next_action}. If
460
   * payment fails, the PaymentIntent transitions to the {@code requires_payment_method} status or
461
   * the {@code canceled} status if the confirmation limit is reached. If payment succeeds, the
462
   * PaymentIntent will transition to the {@code succeeded} status (or {@code requires_capture}, if
463
   * {@code capture_method} is set to {@code manual}). If the {@code confirmation_method} is {@code
464
   * automatic}, payment may be attempted using our <a
465
   * href="https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a>
466
   * and the PaymentIntent’s <a
467
   * href="https://stripe.com/docs/api#payment_intent_object-client_secret">client_secret</a>. After
468
   * {@code next_action}s are handled by the client, no additional confirmation is required to
469
   * complete the payment. If the {@code confirmation_method} is {@code manual}, all payment
470
   * attempts must be initiated using a secret key. If any actions are required for the payment, the
471
   * PaymentIntent will return to the {@code requires_confirmation} state after those actions are
472
   * completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the
473
   * next payment attempt. There is a variable upper limit on how many times a PaymentIntent can be
474
   * confirmed. After this limit is reached, any further calls to this endpoint will transition the
475
   * PaymentIntent to the {@code canceled} state.
476
   */
477
  public PaymentIntent confirm(String intent, RequestOptions options) throws StripeException {
478
    return confirm(intent, (PaymentIntentConfirmParams) null, options);
×
479
  }
480
  /**
481
   * Confirm that your customer intends to pay with current or provided payment method. Upon
482
   * confirmation, the PaymentIntent will attempt to initiate a payment. If the selected payment
483
   * method requires additional authentication steps, the PaymentIntent will transition to the
484
   * {@code requires_action} status and suggest additional actions via {@code next_action}. If
485
   * payment fails, the PaymentIntent transitions to the {@code requires_payment_method} status or
486
   * the {@code canceled} status if the confirmation limit is reached. If payment succeeds, the
487
   * PaymentIntent will transition to the {@code succeeded} status (or {@code requires_capture}, if
488
   * {@code capture_method} is set to {@code manual}). If the {@code confirmation_method} is {@code
489
   * automatic}, payment may be attempted using our <a
490
   * href="https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a>
491
   * and the PaymentIntent’s <a
492
   * href="https://stripe.com/docs/api#payment_intent_object-client_secret">client_secret</a>. After
493
   * {@code next_action}s are handled by the client, no additional confirmation is required to
494
   * complete the payment. If the {@code confirmation_method} is {@code manual}, all payment
495
   * attempts must be initiated using a secret key. If any actions are required for the payment, the
496
   * PaymentIntent will return to the {@code requires_confirmation} state after those actions are
497
   * completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the
498
   * next payment attempt. There is a variable upper limit on how many times a PaymentIntent can be
499
   * confirmed. After this limit is reached, any further calls to this endpoint will transition the
500
   * PaymentIntent to the {@code canceled} state.
501
   */
502
  public PaymentIntent confirm(String intent) throws StripeException {
503
    return confirm(intent, (PaymentIntentConfirmParams) null, (RequestOptions) null);
×
504
  }
505
  /**
506
   * Confirm that your customer intends to pay with current or provided payment method. Upon
507
   * confirmation, the PaymentIntent will attempt to initiate a payment. If the selected payment
508
   * method requires additional authentication steps, the PaymentIntent will transition to the
509
   * {@code requires_action} status and suggest additional actions via {@code next_action}. If
510
   * payment fails, the PaymentIntent transitions to the {@code requires_payment_method} status or
511
   * the {@code canceled} status if the confirmation limit is reached. If payment succeeds, the
512
   * PaymentIntent will transition to the {@code succeeded} status (or {@code requires_capture}, if
513
   * {@code capture_method} is set to {@code manual}). If the {@code confirmation_method} is {@code
514
   * automatic}, payment may be attempted using our <a
515
   * href="https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a>
516
   * and the PaymentIntent’s <a
517
   * href="https://stripe.com/docs/api#payment_intent_object-client_secret">client_secret</a>. After
518
   * {@code next_action}s are handled by the client, no additional confirmation is required to
519
   * complete the payment. If the {@code confirmation_method} is {@code manual}, all payment
520
   * attempts must be initiated using a secret key. If any actions are required for the payment, the
521
   * PaymentIntent will return to the {@code requires_confirmation} state after those actions are
522
   * completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the
523
   * next payment attempt. There is a variable upper limit on how many times a PaymentIntent can be
524
   * confirmed. After this limit is reached, any further calls to this endpoint will transition the
525
   * PaymentIntent to the {@code canceled} state.
526
   */
527
  public PaymentIntent confirm(
528
      String intent, PaymentIntentConfirmParams params, RequestOptions options)
529
      throws StripeException {
530
    String path = String.format("/v1/payment_intents/%s/confirm", ApiResource.urlEncodeId(intent));
1✔
531
    ApiRequest request =
1✔
532
        new ApiRequest(
533
            BaseAddress.API,
534
            ApiResource.RequestMethod.POST,
535
            path,
536
            ApiRequestParams.paramsToMap(params),
1✔
537
            options);
538
    return this.request(request, PaymentIntent.class);
1✔
539
  }
540
  /**
541
   * Perform a decremental authorization on an eligible <a
542
   * href="https://stripe.com/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible,
543
   * the PaymentIntent’s status must be {@code requires_capture} and <a
544
   * href="https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization">decremental_authorization.status</a>
545
   * must be {@code available}.
546
   *
547
   * <p>Decremental authorizations decrease the authorized amount on your customer’s card to the
548
   * new, lower {@code amount} provided. A single PaymentIntent can call this endpoint multiple
549
   * times to further decrease the authorized amount.
550
   *
551
   * <p>After decrement, the PaymentIntent object returns with the updated <a
552
   * href="https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
553
   * The PaymentIntent will now be capturable up to the new authorized amount.
554
   *
555
   * <p>Each PaymentIntent can have a maximum of 10 decremental or incremental authorization
556
   * attempts, including declines. After it’s fully captured, a PaymentIntent can no longer be
557
   * decremented.
558
   */
559
  public PaymentIntent decrementAuthorization(
560
      String intent, PaymentIntentDecrementAuthorizationParams params) throws StripeException {
561
    return decrementAuthorization(intent, params, (RequestOptions) null);
×
562
  }
563
  /**
564
   * Perform a decremental authorization on an eligible <a
565
   * href="https://stripe.com/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible,
566
   * the PaymentIntent’s status must be {@code requires_capture} and <a
567
   * href="https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization">decremental_authorization.status</a>
568
   * must be {@code available}.
569
   *
570
   * <p>Decremental authorizations decrease the authorized amount on your customer’s card to the
571
   * new, lower {@code amount} provided. A single PaymentIntent can call this endpoint multiple
572
   * times to further decrease the authorized amount.
573
   *
574
   * <p>After decrement, the PaymentIntent object returns with the updated <a
575
   * href="https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
576
   * The PaymentIntent will now be capturable up to the new authorized amount.
577
   *
578
   * <p>Each PaymentIntent can have a maximum of 10 decremental or incremental authorization
579
   * attempts, including declines. After it’s fully captured, a PaymentIntent can no longer be
580
   * decremented.
581
   */
582
  public PaymentIntent decrementAuthorization(
583
      String intent, PaymentIntentDecrementAuthorizationParams params, RequestOptions options)
584
      throws StripeException {
585
    String path =
×
586
        String.format(
×
587
            "/v1/payment_intents/%s/decrement_authorization", ApiResource.urlEncodeId(intent));
×
588
    ApiRequest request =
×
589
        new ApiRequest(
590
            BaseAddress.API,
591
            ApiResource.RequestMethod.POST,
592
            path,
593
            ApiRequestParams.paramsToMap(params),
×
594
            options);
595
    return this.request(request, PaymentIntent.class);
×
596
  }
597
  /**
598
   * Perform an incremental authorization on an eligible <a
599
   * href="https://stripe.com/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible,
600
   * the PaymentIntent’s status must be {@code requires_capture} and <a
601
   * href="https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a>
602
   * must be {@code true}.
603
   *
604
   * <p>Incremental authorizations attempt to increase the authorized amount on your customer’s card
605
   * to the new, higher {@code amount} provided. Similar to the initial authorization, incremental
606
   * authorizations can be declined. A single PaymentIntent can call this endpoint multiple times to
607
   * further increase the authorized amount.
608
   *
609
   * <p>If the incremental authorization succeeds, the PaymentIntent object returns with the updated
610
   * <a
611
   * href="https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
612
   * If the incremental authorization fails, a <a
613
   * href="https://stripe.com/docs/error-codes#card-declined">card_declined</a> error returns, and
614
   * no other fields on the PaymentIntent or Charge update. The PaymentIntent object remains
615
   * capturable for the previously authorized amount.
616
   *
617
   * <p>Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including
618
   * declines. After it’s captured, a PaymentIntent can no longer be incremented.
619
   *
620
   * <p>Learn more about <a
621
   * href="https://stripe.com/docs/terminal/features/incremental-authorizations">incremental
622
   * authorizations</a>.
623
   */
624
  public PaymentIntent incrementAuthorization(
625
      String intent, PaymentIntentIncrementAuthorizationParams params) throws StripeException {
626
    return incrementAuthorization(intent, params, (RequestOptions) null);
1✔
627
  }
628
  /**
629
   * Perform an incremental authorization on an eligible <a
630
   * href="https://stripe.com/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible,
631
   * the PaymentIntent’s status must be {@code requires_capture} and <a
632
   * href="https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a>
633
   * must be {@code true}.
634
   *
635
   * <p>Incremental authorizations attempt to increase the authorized amount on your customer’s card
636
   * to the new, higher {@code amount} provided. Similar to the initial authorization, incremental
637
   * authorizations can be declined. A single PaymentIntent can call this endpoint multiple times to
638
   * further increase the authorized amount.
639
   *
640
   * <p>If the incremental authorization succeeds, the PaymentIntent object returns with the updated
641
   * <a
642
   * href="https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
643
   * If the incremental authorization fails, a <a
644
   * href="https://stripe.com/docs/error-codes#card-declined">card_declined</a> error returns, and
645
   * no other fields on the PaymentIntent or Charge update. The PaymentIntent object remains
646
   * capturable for the previously authorized amount.
647
   *
648
   * <p>Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including
649
   * declines. After it’s captured, a PaymentIntent can no longer be incremented.
650
   *
651
   * <p>Learn more about <a
652
   * href="https://stripe.com/docs/terminal/features/incremental-authorizations">incremental
653
   * authorizations</a>.
654
   */
655
  public PaymentIntent incrementAuthorization(
656
      String intent, PaymentIntentIncrementAuthorizationParams params, RequestOptions options)
657
      throws StripeException {
658
    String path =
1✔
659
        String.format(
1✔
660
            "/v1/payment_intents/%s/increment_authorization", ApiResource.urlEncodeId(intent));
1✔
661
    ApiRequest request =
1✔
662
        new ApiRequest(
663
            BaseAddress.API,
664
            ApiResource.RequestMethod.POST,
665
            path,
666
            ApiRequestParams.paramsToMap(params),
1✔
667
            options);
668
    return this.request(request, PaymentIntent.class);
1✔
669
  }
670
  /** Verifies microdeposits on a PaymentIntent object. */
671
  public PaymentIntent verifyMicrodeposits(
672
      String intent, PaymentIntentVerifyMicrodepositsParams params) throws StripeException {
673
    return verifyMicrodeposits(intent, params, (RequestOptions) null);
1✔
674
  }
675
  /** Verifies microdeposits on a PaymentIntent object. */
676
  public PaymentIntent verifyMicrodeposits(String intent, RequestOptions options)
677
      throws StripeException {
678
    return verifyMicrodeposits(intent, (PaymentIntentVerifyMicrodepositsParams) null, options);
×
679
  }
680
  /** Verifies microdeposits on a PaymentIntent object. */
681
  public PaymentIntent verifyMicrodeposits(String intent) throws StripeException {
682
    return verifyMicrodeposits(
×
683
        intent, (PaymentIntentVerifyMicrodepositsParams) null, (RequestOptions) null);
684
  }
685
  /** Verifies microdeposits on a PaymentIntent object. */
686
  public PaymentIntent verifyMicrodeposits(
687
      String intent, PaymentIntentVerifyMicrodepositsParams params, RequestOptions options)
688
      throws StripeException {
689
    String path =
1✔
690
        String.format(
1✔
691
            "/v1/payment_intents/%s/verify_microdeposits", ApiResource.urlEncodeId(intent));
1✔
692
    ApiRequest request =
1✔
693
        new ApiRequest(
694
            BaseAddress.API,
695
            ApiResource.RequestMethod.POST,
696
            path,
697
            ApiRequestParams.paramsToMap(params),
1✔
698
            options);
699
    return this.request(request, PaymentIntent.class);
1✔
700
  }
701
  /** Trigger an external action on a PaymentIntent. */
702
  public PaymentIntent triggerAction(String intent, PaymentIntentTriggerActionParams params)
703
      throws StripeException {
NEW
704
    return triggerAction(intent, params, (RequestOptions) null);
×
705
  }
706
  /** Trigger an external action on a PaymentIntent. */
707
  public PaymentIntent triggerAction(
708
      String intent, PaymentIntentTriggerActionParams params, RequestOptions options)
709
      throws StripeException {
NEW
710
    String path =
×
NEW
711
        String.format(
×
NEW
712
            "/v1/test/payment_intents/%s/trigger_action", ApiResource.urlEncodeId(intent));
×
NEW
713
    ApiRequest request =
×
714
        new ApiRequest(
715
            BaseAddress.API,
716
            ApiResource.RequestMethod.POST,
717
            path,
NEW
718
            ApiRequestParams.paramsToMap(params),
×
719
            options);
NEW
720
    return this.request(request, PaymentIntent.class);
×
721
  }
722
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc