PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / stripe / stripe-php / lib / Service / PaymentIntentService.php

PaymentIntentService.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php

280 lines 11.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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)
20 {
21 return $this->requestCollection('get', '/v1/payment_intents', $params, $opts);
22 }
23
24 /**
25 * Manually reconcile the remaining amount for a customer_balance PaymentIntent.
26 *
27 * @param string $id
28 * @param null|array $params
29 * @param null|array|\Stripe\Util\RequestOptions $opts
30 *
31 * @throws \Stripe\Exception\ApiErrorException if the request fails
32 *
33 * @return \Stripe\PaymentIntent
34 */
35 public function applyCustomerBalance($id, $params = null, $opts = null)
36 {
37 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts);
38 }
39
40 /**
41 * A PaymentIntent object can be canceled when it is in one of these statuses:
42 * <code>requires_payment_method</code>, <code>requires_capture</code>,
43 * <code>requires_confirmation</code>, <code>requires_action</code>, or
44 * <code>processing</code>.
45 *
46 * Once canceled, no additional charges will be made by the PaymentIntent and any
47 * operations on the PaymentIntent will fail with an error. For PaymentIntents with
48 * <code>status=’requires_capture’</code>, the remaining
49 * <code>amount_capturable</code> will automatically be refunded.
50 *
51 * You cannot cancel the PaymentIntent for a Checkout Session. <a
52 * href="/docs/api/checkout/sessions/expire">Expire the Checkout Session</a>
53 * instead
54 *
55 * @param string $id
56 * @param null|array $params
57 * @param null|array|\Stripe\Util\RequestOptions $opts
58 *
59 * @throws \Stripe\Exception\ApiErrorException if the request fails
60 *
61 * @return \Stripe\PaymentIntent
62 */
63 public function cancel($id, $params = null, $opts = null)
64 {
65 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts);
66 }
67
68 /**
69 * Capture the funds of an existing uncaptured PaymentIntent when its status is
70 * <code>requires_capture</code>.
71 *
72 * Uncaptured PaymentIntents will be canceled a set number of days after they are
73 * created (7 by default).
74 *
75 * Learn more about <a href="/docs/payments/capture-later">separate authorization
76 * and capture</a>.
77 *
78 * @param string $id
79 * @param null|array $params
80 * @param null|array|\Stripe\Util\RequestOptions $opts
81 *
82 * @throws \Stripe\Exception\ApiErrorException if the request fails
83 *
84 * @return \Stripe\PaymentIntent
85 */
86 public function capture($id, $params = null, $opts = null)
87 {
88 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts);
89 }
90
91 /**
92 * Confirm that your customer intends to pay with current or provided payment
93 * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
94 *
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 will transition to the <code>requires_payment_method</code>
99 * status. If payment succeeds, the PaymentIntent will transition to the
100 * <code>succeeded</code> status (or <code>requires_capture</code>, if
101 * <code>capture_method</code> is set to <code>manual</code>).
102 *
103 * If the <code>confirmation_method</code> is <code>automatic</code>, payment may
104 * be 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.
110 *
111 * If the <code>confirmation_method</code> is <code>manual</code>, all payment
112 * attempts must be initiated using a secret key. If any actions are required for
113 * the payment, the PaymentIntent will return to the
114 * <code>requires_confirmation</code> state after those actions are completed. Your
115 * server needs to then explicitly re-confirm the PaymentIntent to initiate the
116 * next payment attempt. Read the <a
117 * href="/docs/payments/payment-intents/web-manual">expanded documentation</a> to
118 * learn more about manual confirmation.
119 *
120 * @param string $id
121 * @param null|array $params
122 * @param null|array|\Stripe\Util\RequestOptions $opts
123 *
124 * @throws \Stripe\Exception\ApiErrorException if the request fails
125 *
126 * @return \Stripe\PaymentIntent
127 */
128 public function confirm($id, $params = null, $opts = null)
129 {
130 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts);
131 }
132
133 /**
134 * Creates a PaymentIntent object.
135 *
136 * After the PaymentIntent is created, attach a payment method and <a
137 * href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment.
138 * You can read more about the different payment flows available via the Payment
139 * Intents API <a href="/docs/payments/payment-intents">here</a>.
140 *
141 * When <code>confirm=true</code> is used during creation, it is equivalent to
142 * creating and confirming the PaymentIntent in the same call. You may use any
143 * parameters available in the <a href="/docs/api/payment_intents/confirm">confirm
144 * API</a> when <code>confirm=true</code> is supplied.
145 *
146 * @param null|array $params
147 * @param null|array|\Stripe\Util\RequestOptions $opts
148 *
149 * @throws \Stripe\Exception\ApiErrorException if the request fails
150 *
151 * @return \Stripe\PaymentIntent
152 */
153 public function create($params = null, $opts = null)
154 {
155 return $this->request('post', '/v1/payment_intents', $params, $opts);
156 }
157
158 /**
159 * Perform an incremental authorization on an eligible <a
160 * href="/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible, the
161 * PaymentIntent’s status must be <code>requires_capture</code> and <a
162 * href="/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a>
163 * must be <code>true</code>.
164 *
165 * Incremental authorizations attempt to increase the authorized amount on your
166 * customer’s card to the new, higher <code>amount</code> provided. As with the
167 * initial authorization, incremental authorizations may be declined. A single
168 * PaymentIntent can call this endpoint multiple times to further increase the
169 * authorized amount.
170 *
171 * If the incremental authorization succeeds, the PaymentIntent object is returned
172 * with the updated <a
173 * href="/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>.
174 * If the incremental authorization fails, a <a
175 * href="/docs/error-codes#card-declined">card_declined</a> error is returned, and
176 * no fields on the PaymentIntent or Charge are updated. The PaymentIntent object
177 * remains capturable for the previously authorized amount.
178 *
179 * Each PaymentIntent can have a maximum of 10 incremental authorization attempts,
180 * including declines. Once captured, a PaymentIntent can no longer be incremented.
181 *
182 * Learn more about <a
183 * href="/docs/terminal/features/incremental-authorizations">incremental
184 * authorizations</a>.
185 *
186 * @param string $id
187 * @param null|array $params
188 * @param null|array|\Stripe\Util\RequestOptions $opts
189 *
190 * @throws \Stripe\Exception\ApiErrorException if the request fails
191 *
192 * @return \Stripe\PaymentIntent
193 */
194 public function incrementAuthorization($id, $params = null, $opts = null)
195 {
196 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/increment_authorization', $id), $params, $opts);
197 }
198
199 /**
200 * Retrieves the details of a PaymentIntent that has previously been created.
201 *
202 * Client-side retrieval using a publishable key is allowed when the
203 * <code>client_secret</code> is provided in the query string.
204 *
205 * When retrieved with a publishable key, only a subset of properties will be
206 * returned. Please refer to the <a href="#payment_intent_object">payment
207 * intent</a> object reference for more details.
208 *
209 * @param string $id
210 * @param null|array $params
211 * @param null|array|\Stripe\Util\RequestOptions $opts
212 *
213 * @throws \Stripe\Exception\ApiErrorException if the request fails
214 *
215 * @return \Stripe\PaymentIntent
216 */
217 public function retrieve($id, $params = null, $opts = null)
218 {
219 return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
220 }
221
222 /**
223 * Search for PaymentIntents you’ve previously created using Stripe’s <a
224 * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use
225 * search in read-after-write flows where strict consistency is necessary. Under
226 * normal operating conditions, data is searchable in less than a minute.
227 * Occasionally, propagation of new or updated data can be up to an hour behind
228 * during outages. Search functionality is not available to merchants in India.
229 *
230 * @param null|array $params
231 * @param null|array|\Stripe\Util\RequestOptions $opts
232 *
233 * @throws \Stripe\Exception\ApiErrorException if the request fails
234 *
235 * @return \Stripe\SearchResult<\Stripe\PaymentIntent>
236 */
237 public function search($params = null, $opts = null)
238 {
239 return $this->requestSearchResult('get', '/v1/payment_intents/search', $params, $opts);
240 }
241
242 /**
243 * Updates properties on a PaymentIntent object without confirming.
244 *
245 * Depending on which properties you update, you may need to confirm the
246 * PaymentIntent again. For example, updating the <code>payment_method</code> will
247 * always require you to confirm the PaymentIntent again. If you prefer to update
248 * and confirm at the same time, we recommend updating properties via the <a
249 * href="/docs/api/payment_intents/confirm">confirm API</a> instead.
250 *
251 * @param string $id
252 * @param null|array $params
253 * @param null|array|\Stripe\Util\RequestOptions $opts
254 *
255 * @throws \Stripe\Exception\ApiErrorException if the request fails
256 *
257 * @return \Stripe\PaymentIntent
258 */
259 public function update($id, $params = null, $opts = null)
260 {
261 return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts);
262 }
263
264 /**
265 * Verifies microdeposits on a PaymentIntent object.
266 *
267 * @param string $id
268 * @param null|array $params
269 * @param null|array|\Stripe\Util\RequestOptions $opts
270 *
271 * @throws \Stripe\Exception\ApiErrorException if the request fails
272 *
273 * @return \Stripe\PaymentIntent
274 */
275 public function verifyMicrodeposits($id, $params = null, $opts = null)
276 {
277 return $this->request('post', $this->buildPath('/v1/payment_intents/%s/verify_microdeposits', $id), $params, $opts);
278 }
279 }
280