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

stripe / stripe-php / 6471862601

10 Oct 2023 04:02PM UTC coverage: 69.665% (-0.5%) from 70.141%
6471862601

push

github

web-flow
Merge pull request #1570 from localheinz/feature/coveralls

Enhancement: Use `coverallsapp/github-action` to report code coverage

2393 of 3435 relevant lines covered (69.67%)

3.5 hits per line

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

63.64
/lib/Service/PaymentIntentService.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Service;
6

7
class PaymentIntentService extends \Stripe\Service\AbstractService
8
{
9
    /**
10
     * Returns a list of PaymentIntents.
11
     *
12
     * @param null|array $params
13
     * @param null|array|\Stripe\Util\RequestOptions $opts
14
     *
15
     * @throws \Stripe\Exception\ApiErrorException if the request fails
16
     *
17
     * @return \Stripe\Collection<\Stripe\PaymentIntent>
18
     */
19
    public function all($params = null, $opts = null)
1✔
20
    {
21
        return $this->requestCollection('get', '/v1/payment_intents', $params, $opts);
1✔
22
    }
23

24
    /**
25
     * Manually reconcile the remaining amount for a <code>customer_balance</code>
26
     * PaymentIntent.
27
     *
28
     * @param string $id
29
     * @param null|array $params
30
     * @param null|array|\Stripe\Util\RequestOptions $opts
31
     *
32
     * @throws \Stripe\Exception\ApiErrorException if the request fails
33
     *
34
     * @return \Stripe\PaymentIntent
35
     */
36
    public function applyCustomerBalance($id, $params = null, $opts = null)
×
37
    {
38
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts);
×
39
    }
40

41
    /**
42
     * You can cancel a PaymentIntent object when it’s in one of these statuses:
43
     * <code>requires_payment_method</code>, <code>requires_capture</code>,
44
     * <code>requires_confirmation</code>, <code>requires_action</code> or, <a
45
     * href="/docs/payments/intents">in rare cases</a>, <code>processing</code>.
46
     *
47
     * After it’s canceled, no additional charges are made by the PaymentIntent and any
48
     * operations on the PaymentIntent fail with an error. For PaymentIntents with a
49
     * <code>status</code> of <code>requires_capture</code>, the remaining
50
     * <code>amount_capturable</code> is automatically refunded.
51
     *
52
     * You can’t cancel the PaymentIntent for a Checkout Session. <a
53
     * href="/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
54
     * instead.
55
     *
56
     * @param string $id
57
     * @param null|array $params
58
     * @param null|array|\Stripe\Util\RequestOptions $opts
59
     *
60
     * @throws \Stripe\Exception\ApiErrorException if the request fails
61
     *
62
     * @return \Stripe\PaymentIntent
63
     */
64
    public function cancel($id, $params = null, $opts = null)
1✔
65
    {
66
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts);
1✔
67
    }
68

69
    /**
70
     * Capture the funds of an existing uncaptured PaymentIntent when its status is
71
     * <code>requires_capture</code>.
72
     *
73
     * Uncaptured PaymentIntents are cancelled a set number of days (7 by default)
74
     * after their creation.
75
     *
76
     * Learn more about <a href="/docs/payments/capture-later">separate authorization
77
     * and capture</a>.
78
     *
79
     * @param string $id
80
     * @param null|array $params
81
     * @param null|array|\Stripe\Util\RequestOptions $opts
82
     *
83
     * @throws \Stripe\Exception\ApiErrorException if the request fails
84
     *
85
     * @return \Stripe\PaymentIntent
86
     */
87
    public function capture($id, $params = null, $opts = null)
1✔
88
    {
89
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts);
1✔
90
    }
91

92
    /**
93
     * Confirm that your customer intends to pay with current or provided payment
94
     * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
95
     * If the selected payment method requires additional authentication steps, the
96
     * PaymentIntent will transition to the <code>requires_action</code> status and
97
     * suggest additional actions via <code>next_action</code>. If payment fails, the
98
     * PaymentIntent transitions to the <code>requires_payment_method</code> status or
99
     * the <code>canceled</code> status if the confirmation limit is reached. If
100
     * payment succeeds, the PaymentIntent will transition to the
101
     * <code>succeeded</code> status (or <code>requires_capture</code>, if
102
     * <code>capture_method</code> is set to <code>manual</code>). If the
103
     * <code>confirmation_method</code> is <code>automatic</code>, payment may be
104
     * attempted using our <a
105
     * href="/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a> and
106
     * the PaymentIntent’s <a
107
     * href="#payment_intent_object-client_secret">client_secret</a>. After
108
     * <code>next_action</code>s are handled by the client, no additional confirmation
109
     * is required to complete the payment. If the <code>confirmation_method</code> is
110
     * <code>manual</code>, all payment attempts must be initiated using a secret key.
111
     * If any actions are required for the payment, the PaymentIntent will return to
112
     * the <code>requires_confirmation</code> state after those actions are completed.
113
     * Your server needs to then explicitly re-confirm the PaymentIntent to initiate
114
     * the next payment attempt. Read the <a
115
     * href="/docs/payments/payment-intents/web-manual">expanded documentation</a> to
116
     * learn more about manual confirmation.
117
     *
118
     * @param string $id
119
     * @param null|array $params
120
     * @param null|array|\Stripe\Util\RequestOptions $opts
121
     *
122
     * @throws \Stripe\Exception\ApiErrorException if the request fails
123
     *
124
     * @return \Stripe\PaymentIntent
125
     */
126
    public function confirm($id, $params = null, $opts = null)
1✔
127
    {
128
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts);
1✔
129
    }
130

131
    /**
132
     * Creates a PaymentIntent object.
133
     *
134
     * After the PaymentIntent is created, attach a payment method and <a
135
     * href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment.
136
     * Learn more about <a href="/docs/payments/payment-intents">the available payment
137
     * flows with the Payment Intents API</a>.
138
     *
139
     * When you use <code>confirm=true</code> during creation, it’s equivalent to
140
     * creating and confirming the PaymentIntent in the same call. You can use any
141
     * parameters available in the <a href="/docs/api/payment_intents/confirm">confirm
142
     * API</a> when you supply <code>confirm=true</code>.
143
     *
144
     * @param null|array $params
145
     * @param null|array|\Stripe\Util\RequestOptions $opts
146
     *
147
     * @throws \Stripe\Exception\ApiErrorException if the request fails
148
     *
149
     * @return \Stripe\PaymentIntent
150
     */
151
    public function create($params = null, $opts = null)
1✔
152
    {
153
        return $this->request('post', '/v1/payment_intents', $params, $opts);
1✔
154
    }
155

156
    /**
157
     * Perform an incremental authorization on an eligible <a
158
     * href="/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible, the
159
     * PaymentIntent’s status must be <code>requires_capture</code> and <a
160
     * href="/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a>
161
     * must be <code>true</code>.
162
     *
163
     * Incremental authorizations attempt to increase the authorized amount on your
164
     * customer’s card to the new, higher <code>amount</code> provided. Similar to the
165
     * initial authorization, incremental authorizations can be declined. A single
166
     * PaymentIntent can call this endpoint multiple times to further increase the
167
     * authorized amount.
168
     *
169
     * If the incremental authorization succeeds, the PaymentIntent object returns with
170
     * the updated <a
171
     * href="/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
172
     * If the incremental authorization fails, a <a
173
     * href="/docs/error-codes#card-declined">card_declined</a> error returns, and no
174
     * other fields on the PaymentIntent or Charge update. The PaymentIntent object
175
     * remains capturable for the previously authorized amount.
176
     *
177
     * Each PaymentIntent can have a maximum of 10 incremental authorization attempts,
178
     * including declines. After it’s captured, a PaymentIntent can no longer be
179
     * incremented.
180
     *
181
     * Learn more about <a
182
     * href="/docs/terminal/features/incremental-authorizations">incremental
183
     * authorizations</a>.
184
     *
185
     * @param string $id
186
     * @param null|array $params
187
     * @param null|array|\Stripe\Util\RequestOptions $opts
188
     *
189
     * @throws \Stripe\Exception\ApiErrorException if the request fails
190
     *
191
     * @return \Stripe\PaymentIntent
192
     */
193
    public function incrementAuthorization($id, $params = null, $opts = null)
×
194
    {
195
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/increment_authorization', $id), $params, $opts);
×
196
    }
197

198
    /**
199
     * Retrieves the details of a PaymentIntent that has previously been created.
200
     *
201
     * You can retrieve a PaymentIntent client-side using a publishable key when the
202
     * <code>client_secret</code> is in the query string.
203
     *
204
     * If you retrieve a PaymentIntent with a publishable key, it only returns a subset
205
     * of properties. Refer to the <a href="#payment_intent_object">payment intent</a>
206
     * object reference for more details.
207
     *
208
     * @param string $id
209
     * @param null|array $params
210
     * @param null|array|\Stripe\Util\RequestOptions $opts
211
     *
212
     * @throws \Stripe\Exception\ApiErrorException if the request fails
213
     *
214
     * @return \Stripe\PaymentIntent
215
     */
216
    public function retrieve($id, $params = null, $opts = null)
1✔
217
    {
218
        return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
1✔
219
    }
220

221
    /**
222
     * Search for PaymentIntents you’ve previously created using Stripe’s <a
223
     * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use
224
     * search in read-after-write flows where strict consistency is necessary. Under
225
     * normal operating conditions, data is searchable in less than a minute.
226
     * Occasionally, propagation of new or updated data can be up to an hour behind
227
     * during outages. Search functionality is not available to merchants in India.
228
     *
229
     * @param null|array $params
230
     * @param null|array|\Stripe\Util\RequestOptions $opts
231
     *
232
     * @throws \Stripe\Exception\ApiErrorException if the request fails
233
     *
234
     * @return \Stripe\SearchResult<\Stripe\PaymentIntent>
235
     */
236
    public function search($params = null, $opts = null)
×
237
    {
238
        return $this->requestSearchResult('get', '/v1/payment_intents/search', $params, $opts);
×
239
    }
240

241
    /**
242
     * Updates properties on a PaymentIntent object without confirming.
243
     *
244
     * Depending on which properties you update, you might need to confirm the
245
     * PaymentIntent again. For example, updating the <code>payment_method</code>
246
     * always requires you to confirm the PaymentIntent again. If you prefer to update
247
     * and confirm at the same time, we recommend updating properties through the <a
248
     * href="/docs/api/payment_intents/confirm">confirm API</a> instead.
249
     *
250
     * @param string $id
251
     * @param null|array $params
252
     * @param null|array|\Stripe\Util\RequestOptions $opts
253
     *
254
     * @throws \Stripe\Exception\ApiErrorException if the request fails
255
     *
256
     * @return \Stripe\PaymentIntent
257
     */
258
    public function update($id, $params = null, $opts = null)
1✔
259
    {
260
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
1✔
261
    }
262

263
    /**
264
     * Verifies microdeposits on a PaymentIntent object.
265
     *
266
     * @param string $id
267
     * @param null|array $params
268
     * @param null|array|\Stripe\Util\RequestOptions $opts
269
     *
270
     * @throws \Stripe\Exception\ApiErrorException if the request fails
271
     *
272
     * @return \Stripe\PaymentIntent
273
     */
274
    public function verifyMicrodeposits($id, $params = null, $opts = null)
×
275
    {
276
        return $this->request('post', $this->buildPath('/v1/payment_intents/%s/verify_microdeposits', $id), $params, $opts);
×
277
    }
278
}
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