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 / CustomerService.php

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

458 lines 16.2 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 CustomerService extends \Stripe\Service\AbstractService
8 {
9 /**
10 * Returns a list of your customers. The customers are returned sorted by creation
11 * date, with the most recent customers appearing first.
12 *
13 * @param null|array $params
14 * @param null|array|\Stripe\Util\RequestOptions $opts
15 *
16 * @throws \Stripe\Exception\ApiErrorException if the request fails
17 *
18 * @return \Stripe\Collection<\Stripe\Customer>
19 */
20 public function all($params = null, $opts = null)
21 {
22 return $this->requestCollection('get', '/v1/customers', $params, $opts);
23 }
24
25 /**
26 * Returns a list of transactions that updated the customer’s <a
27 * href="/docs/billing/customer/balance">balances</a>.
28 *
29 * @param string $parentId
30 * @param null|array $params
31 * @param null|array|\Stripe\Util\RequestOptions $opts
32 *
33 * @throws \Stripe\Exception\ApiErrorException if the request fails
34 *
35 * @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction>
36 */
37 public function allBalanceTransactions($parentId, $params = null, $opts = null)
38 {
39 return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
40 }
41
42 /**
43 * Returns a list of PaymentMethods for a given Customer.
44 *
45 * @param string $id
46 * @param null|array $params
47 * @param null|array|\Stripe\Util\RequestOptions $opts
48 *
49 * @throws \Stripe\Exception\ApiErrorException if the request fails
50 *
51 * @return \Stripe\Collection<\Stripe\PaymentMethod>
52 */
53 public function allPaymentMethods($id, $params = null, $opts = null)
54 {
55 return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/payment_methods', $id), $params, $opts);
56 }
57
58 /**
59 * List sources for a specified customer.
60 *
61 * @param string $parentId
62 * @param null|array $params
63 * @param null|array|\Stripe\Util\RequestOptions $opts
64 *
65 * @throws \Stripe\Exception\ApiErrorException if the request fails
66 *
67 * @return \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card|\Stripe\Source>
68 */
69 public function allSources($parentId, $params = null, $opts = null)
70 {
71 return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts);
72 }
73
74 /**
75 * Returns a list of tax IDs for a customer.
76 *
77 * @param string $parentId
78 * @param null|array $params
79 * @param null|array|\Stripe\Util\RequestOptions $opts
80 *
81 * @throws \Stripe\Exception\ApiErrorException if the request fails
82 *
83 * @return \Stripe\Collection<\Stripe\TaxId>
84 */
85 public function allTaxIds($parentId, $params = null, $opts = null)
86 {
87 return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts);
88 }
89
90 /**
91 * Creates a new customer object.
92 *
93 * @param null|array $params
94 * @param null|array|\Stripe\Util\RequestOptions $opts
95 *
96 * @throws \Stripe\Exception\ApiErrorException if the request fails
97 *
98 * @return \Stripe\Customer
99 */
100 public function create($params = null, $opts = null)
101 {
102 return $this->request('post', '/v1/customers', $params, $opts);
103 }
104
105 /**
106 * Creates an immutable transaction that updates the customer’s credit <a
107 * href="/docs/billing/customer/balance">balance</a>.
108 *
109 * @param string $parentId
110 * @param null|array $params
111 * @param null|array|\Stripe\Util\RequestOptions $opts
112 *
113 * @throws \Stripe\Exception\ApiErrorException if the request fails
114 *
115 * @return \Stripe\CustomerBalanceTransaction
116 */
117 public function createBalanceTransaction($parentId, $params = null, $opts = null)
118 {
119 return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
120 }
121
122 /**
123 * Retrieve funding instructions for a customer cash balance. If funding
124 * instructions do not yet exist for the customer, new funding instructions will be
125 * created. If funding instructions have already been created for a given customer,
126 * the same funding instructions will be retrieved. In other words, we will return
127 * the same funding instructions each time.
128 *
129 * @param string $id
130 * @param null|array $params
131 * @param null|array|\Stripe\Util\RequestOptions $opts
132 *
133 * @throws \Stripe\Exception\ApiErrorException if the request fails
134 *
135 * @return \Stripe\Customer
136 */
137 public function createFundingInstructions($id, $params = null, $opts = null)
138 {
139 return $this->request('post', $this->buildPath('/v1/customers/%s/funding_instructions', $id), $params, $opts);
140 }
141
142 /**
143 * When you create a new credit card, you must specify a customer or recipient on
144 * which to create it.
145 *
146 * If the card’s owner has no default card, then the new card will become the
147 * default. However, if the owner already has a default, then it will not change.
148 * To change the default, you should <a href="/docs/api#update_customer">update the
149 * customer</a> to have a new <code>default_source</code>.
150 *
151 * @param string $parentId
152 * @param null|array $params
153 * @param null|array|\Stripe\Util\RequestOptions $opts
154 *
155 * @throws \Stripe\Exception\ApiErrorException if the request fails
156 *
157 * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
158 */
159 public function createSource($parentId, $params = null, $opts = null)
160 {
161 return $this->request('post', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts);
162 }
163
164 /**
165 * Creates a new <code>TaxID</code> object for a customer.
166 *
167 * @param string $parentId
168 * @param null|array $params
169 * @param null|array|\Stripe\Util\RequestOptions $opts
170 *
171 * @throws \Stripe\Exception\ApiErrorException if the request fails
172 *
173 * @return \Stripe\TaxId
174 */
175 public function createTaxId($parentId, $params = null, $opts = null)
176 {
177 return $this->request('post', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts);
178 }
179
180 /**
181 * Permanently deletes a customer. It cannot be undone. Also immediately cancels
182 * any active subscriptions on the customer.
183 *
184 * @param string $id
185 * @param null|array $params
186 * @param null|array|\Stripe\Util\RequestOptions $opts
187 *
188 * @throws \Stripe\Exception\ApiErrorException if the request fails
189 *
190 * @return \Stripe\Customer
191 */
192 public function delete($id, $params = null, $opts = null)
193 {
194 return $this->request('delete', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
195 }
196
197 /**
198 * Removes the currently applied discount on a customer.
199 *
200 * @param string $id
201 * @param null|array $params
202 * @param null|array|\Stripe\Util\RequestOptions $opts
203 *
204 * @throws \Stripe\Exception\ApiErrorException if the request fails
205 *
206 * @return \Stripe\Customer
207 */
208 public function deleteDiscount($id, $params = null, $opts = null)
209 {
210 return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts);
211 }
212
213 /**
214 * @param string $parentId
215 * @param string $id
216 * @param null|array $params
217 * @param null|array|\Stripe\Util\RequestOptions $opts
218 *
219 * @throws \Stripe\Exception\ApiErrorException if the request fails
220 *
221 * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
222 */
223 public function deleteSource($parentId, $id, $params = null, $opts = null)
224 {
225 return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
226 }
227
228 /**
229 * Deletes an existing <code>TaxID</code> object.
230 *
231 * @param string $parentId
232 * @param string $id
233 * @param null|array $params
234 * @param null|array|\Stripe\Util\RequestOptions $opts
235 *
236 * @throws \Stripe\Exception\ApiErrorException if the request fails
237 *
238 * @return \Stripe\TaxId
239 */
240 public function deleteTaxId($parentId, $id, $params = null, $opts = null)
241 {
242 return $this->request('delete', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts);
243 }
244
245 /**
246 * Retrieves a Customer object.
247 *
248 * @param string $id
249 * @param null|array $params
250 * @param null|array|\Stripe\Util\RequestOptions $opts
251 *
252 * @throws \Stripe\Exception\ApiErrorException if the request fails
253 *
254 * @return \Stripe\Customer
255 */
256 public function retrieve($id, $params = null, $opts = null)
257 {
258 return $this->request('get', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
259 }
260
261 /**
262 * Retrieves a specific customer balance transaction that updated the customer’s <a
263 * href="/docs/billing/customer/balance">balances</a>.
264 *
265 * @param string $parentId
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\CustomerBalanceTransaction
273 */
274 public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts = null)
275 {
276 return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
277 }
278
279 /**
280 * Retrieves a customer’s cash balance.
281 *
282 * @param string $parentId
283 * @param null|array $params
284 * @param null|array|\Stripe\Util\RequestOptions $opts
285 *
286 * @throws \Stripe\Exception\ApiErrorException if the request fails
287 *
288 * @return \Stripe\CashBalance
289 */
290 public function retrieveCashBalance($parentId, $params = null, $opts = null)
291 {
292 return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
293 }
294
295 /**
296 * Retrieves a PaymentMethod object for a given Customer.
297 *
298 * @param string $parentId
299 * @param string $id
300 * @param null|array $params
301 * @param null|array|\Stripe\Util\RequestOptions $opts
302 *
303 * @throws \Stripe\Exception\ApiErrorException if the request fails
304 *
305 * @return \Stripe\Customer
306 */
307 public function retrievePaymentMethod($parentId, $id, $params = null, $opts = null)
308 {
309 return $this->request('get', $this->buildPath('/v1/customers/%s/payment_methods/%s', $parentId, $id), $params, $opts);
310 }
311
312 /**
313 * Retrieve a specified source for a given customer.
314 *
315 * @param string $parentId
316 * @param string $id
317 * @param null|array $params
318 * @param null|array|\Stripe\Util\RequestOptions $opts
319 *
320 * @throws \Stripe\Exception\ApiErrorException if the request fails
321 *
322 * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
323 */
324 public function retrieveSource($parentId, $id, $params = null, $opts = null)
325 {
326 return $this->request('get', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
327 }
328
329 /**
330 * Retrieves the <code>TaxID</code> object with the given identifier.
331 *
332 * @param string $parentId
333 * @param string $id
334 * @param null|array $params
335 * @param null|array|\Stripe\Util\RequestOptions $opts
336 *
337 * @throws \Stripe\Exception\ApiErrorException if the request fails
338 *
339 * @return \Stripe\TaxId
340 */
341 public function retrieveTaxId($parentId, $id, $params = null, $opts = null)
342 {
343 return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts);
344 }
345
346 /**
347 * Search for customers you’ve previously created using Stripe’s <a
348 * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use
349 * search in read-after-write flows where strict consistency is necessary. Under
350 * normal operating conditions, data is searchable in less than a minute.
351 * Occasionally, propagation of new or updated data can be up to an hour behind
352 * during outages. Search functionality is not available to merchants in India.
353 *
354 * @param null|array $params
355 * @param null|array|\Stripe\Util\RequestOptions $opts
356 *
357 * @throws \Stripe\Exception\ApiErrorException if the request fails
358 *
359 * @return \Stripe\SearchResult<\Stripe\Customer>
360 */
361 public function search($params = null, $opts = null)
362 {
363 return $this->requestSearchResult('get', '/v1/customers/search', $params, $opts);
364 }
365
366 /**
367 * Updates the specified customer by setting the values of the parameters passed.
368 * Any parameters not provided will be left unchanged. For example, if you pass the
369 * <strong>source</strong> parameter, that becomes the customer’s active source
370 * (e.g., a card) to be used for all charges in the future. When you update a
371 * customer to a new valid card source by passing the <strong>source</strong>
372 * parameter: for each of the customer’s current subscriptions, if the subscription
373 * bills automatically and is in the <code>past_due</code> state, then the latest
374 * open invoice for the subscription with automatic collection enabled will be
375 * retried. This retry will not count as an automatic retry, and will not affect
376 * the next regularly scheduled payment for the invoice. Changing the
377 * <strong>default_source</strong> for a customer will not trigger this behavior.
378 *
379 * This request accepts mostly the same arguments as the customer creation call.
380 *
381 * @param string $id
382 * @param null|array $params
383 * @param null|array|\Stripe\Util\RequestOptions $opts
384 *
385 * @throws \Stripe\Exception\ApiErrorException if the request fails
386 *
387 * @return \Stripe\Customer
388 */
389 public function update($id, $params = null, $opts = null)
390 {
391 return $this->request('post', $this->buildPath('/v1/customers/%s', $id), $params, $opts);
392 }
393
394 /**
395 * Most credit balance transaction fields are immutable, but you may update its
396 * <code>description</code> and <code>metadata</code>.
397 *
398 * @param string $parentId
399 * @param string $id
400 * @param null|array $params
401 * @param null|array|\Stripe\Util\RequestOptions $opts
402 *
403 * @throws \Stripe\Exception\ApiErrorException if the request fails
404 *
405 * @return \Stripe\CustomerBalanceTransaction
406 */
407 public function updateBalanceTransaction($parentId, $id, $params = null, $opts = null)
408 {
409 return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
410 }
411
412 /**
413 * Changes the settings on a customer’s cash balance.
414 *
415 * @param string $parentId
416 * @param null|array $params
417 * @param null|array|\Stripe\Util\RequestOptions $opts
418 *
419 * @throws \Stripe\Exception\ApiErrorException if the request fails
420 *
421 * @return \Stripe\CashBalance
422 */
423 public function updateCashBalance($parentId, $params = null, $opts = null)
424 {
425 return $this->request('post', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
426 }
427
428 /**
429 * @param string $parentId
430 * @param string $id
431 * @param null|array $params
432 * @param null|array|\Stripe\Util\RequestOptions $opts
433 *
434 * @throws \Stripe\Exception\ApiErrorException if the request fails
435 *
436 * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
437 */
438 public function updateSource($parentId, $id, $params = null, $opts = null)
439 {
440 return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
441 }
442
443 /**
444 * @param string $parentId
445 * @param string $id
446 * @param null|array $params
447 * @param null|array|\Stripe\Util\RequestOptions $opts
448 *
449 * @throws \Stripe\Exception\ApiErrorException if the request fails
450 *
451 * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
452 */
453 public function verifySource($parentId, $id, $params = null, $opts = null)
454 {
455 return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s/verify', $parentId, $id), $params, $opts);
456 }
457 }
458