PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.4
GiveWP – Donation Plugin and Fundraising Platform v4.15.4
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / vendor / stripe / stripe-php / lib / Customer.php

Customer.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.4, at vendor/stripe/stripe-php/lib/Customer.php

344 lines 15.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;
6
7 /**
8 * This object represents a customer of your business. It lets you create recurring
9 * charges and track payments that belong to the same customer.
10 *
11 * Related guide: <a
12 * href="https://stripe.com/docs/payments/save-during-payment">Save a card during
13 * payment</a>.
14 *
15 * @property string $id Unique identifier for the object.
16 * @property string $object String representing the object's type. Objects of the same type share the same value.
17 * @property null|\Stripe\StripeObject $address The customer's address.
18 * @property int $balance Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized.
19 * @property null|\Stripe\CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. These funds can be applied towards payment intents with source &quot;cash_balance&quot;.The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically.
20 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21 * @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> the customer can be charged in for recurring billing purposes.
22 * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source <p>ID of the default payment source for the customer.</p><p>If you are using payment methods created via the PaymentMethods API, see the <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> field instead.</p>
23 * @property null|bool $delinquent <p>When the customer's latest invoice is billed by charging automatically, <code>delinquent</code> is <code>true</code> if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, <code>delinquent</code> is <code>true</code> if the invoice isn't paid by its due date.</p><p>If an invoice is marked uncollectible by <a href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, <code>delinquent</code> doesn't get reset to <code>false</code>.</p>
24 * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
25 * @property null|\Stripe\Discount $discount Describes the current discount active on the customer, if there is one.
26 * @property null|string $email The customer's email address.
27 * @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers.
28 * @property \Stripe\StripeObject $invoice_settings
29 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
30 * @property \Stripe\StripeObject $metadata 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.
31 * @property null|string $name The customer's full name or business name.
32 * @property int $next_invoice_sequence The suffix of the customer's next invoice number, e.g., 0001.
33 * @property null|string $phone The customer's phone number.
34 * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference.
35 * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
36 * @property \Stripe\Collection<\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source> $sources The customer's payment sources, if any.
37 * @property \Stripe\Collection<\Stripe\Subscription> $subscriptions The customer's current subscriptions, if any.
38 * @property \Stripe\StripeObject $tax
39 * @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>&quot;Reverse charge&quot;</strong>.
40 * @property \Stripe\Collection<\Stripe\TaxId> $tax_ids The customer's tax IDs.
41 * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this customer belongs to.
42 */
43 class Customer extends ApiResource
44 {
45 const OBJECT_NAME = 'customer';
46
47 use ApiOperations\All;
48 use ApiOperations\Create;
49 use ApiOperations\Delete;
50 use ApiOperations\NestedResource;
51 use ApiOperations\Retrieve;
52 use ApiOperations\Search;
53 use ApiOperations\Update;
54
55 const TAX_EXEMPT_EXEMPT = 'exempt';
56 const TAX_EXEMPT_NONE = 'none';
57 const TAX_EXEMPT_REVERSE = 'reverse';
58
59 public static function getSavedNestedResources()
60 {
61 static $savedNestedResources = null;
62 if (null === $savedNestedResources) {
63 $savedNestedResources = new Util\Set([
64 'source',
65 ]);
66 }
67
68 return $savedNestedResources;
69 }
70
71 /**
72 * @param null|array $params
73 * @param null|array|string $opts
74 *
75 * @return \Stripe\Customer the updated customer
76 */
77 public function deleteDiscount($params = null, $opts = null)
78 {
79 $url = $this->instanceUrl() . '/discount';
80 list($response, $opts) = $this->_request('delete', $url, $params, $opts);
81 $this->refreshFrom(['discount' => null], $opts, true);
82
83 return $this;
84 }
85
86 /**
87 * @param null|array $params
88 * @param null|array|string $opts
89 * @param mixed $id
90 *
91 * @throws \Stripe\Exception\ApiErrorException if the request fails
92 *
93 * @return \Stripe\Collection<\Stripe\Customer> list of PaymentMethods
94 */
95 public static function allPaymentMethods($id, $params = null, $opts = null)
96 {
97 $url = static::resourceUrl($id) . '/payment_methods';
98 list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
99 $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
100 $obj->setLastResponse($response);
101
102 return $obj;
103 }
104
105 /**
106 * @param null|array $params
107 * @param null|array|string $opts
108 *
109 * @throws \Stripe\Exception\ApiErrorException if the request fails
110 *
111 * @return \Stripe\SearchResult<Customer> the customer search results
112 */
113 public static function search($params = null, $opts = null)
114 {
115 $url = '/v1/customers/search';
116
117 return self::_searchResource($url, $params, $opts);
118 }
119
120 const PATH_CASH_BALANCE = '/cash_balance';
121
122 /**
123 * @param string $id the ID of the customer to which the cash balance belongs
124 * @param null|array $params
125 * @param null|array|string $opts
126 * @param mixed $cashBalanceId
127 *
128 * @throws \Stripe\Exception\ApiErrorException if the request fails
129 *
130 * @return \Stripe\cash_balance
131 */
132 public static function retrieveCashBalance($id, $cashBalanceId, $params = null, $opts = null)
133 {
134 return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts);
135 }
136
137 /**
138 * @param string $id the ID of the customer to which the cash balance belongs
139 * @param null|array $params
140 * @param null|array|string $opts
141 * @param mixed $cashBalanceId
142 *
143 * @throws \Stripe\Exception\ApiErrorException if the request fails
144 *
145 * @return \Stripe\cash_balance
146 */
147 public static function updateCashBalance($id, $cashBalanceId, $params = null, $opts = null)
148 {
149 return self::_updateNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts);
150 }
151 const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
152
153 /**
154 * @param string $id the ID of the customer on which to retrieve the customer balance transactions
155 * @param null|array $params
156 * @param null|array|string $opts
157 *
158 * @throws \Stripe\Exception\ApiErrorException if the request fails
159 *
160 * @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction> the list of customer balance transactions
161 */
162 public static function allBalanceTransactions($id, $params = null, $opts = null)
163 {
164 return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
165 }
166
167 /**
168 * @param string $id the ID of the customer on which to create the customer balance transaction
169 * @param null|array $params
170 * @param null|array|string $opts
171 *
172 * @throws \Stripe\Exception\ApiErrorException if the request fails
173 *
174 * @return \Stripe\CustomerBalanceTransaction
175 */
176 public static function createBalanceTransaction($id, $params = null, $opts = null)
177 {
178 return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
179 }
180
181 /**
182 * @param string $id the ID of the customer to which the customer balance transaction belongs
183 * @param string $balanceTransactionId the ID of the customer balance transaction to retrieve
184 * @param null|array $params
185 * @param null|array|string $opts
186 *
187 * @throws \Stripe\Exception\ApiErrorException if the request fails
188 *
189 * @return \Stripe\CustomerBalanceTransaction
190 */
191 public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
192 {
193 return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
194 }
195
196 /**
197 * @param string $id the ID of the customer to which the customer balance transaction belongs
198 * @param string $balanceTransactionId the ID of the customer balance transaction to update
199 * @param null|array $params
200 * @param null|array|string $opts
201 *
202 * @throws \Stripe\Exception\ApiErrorException if the request fails
203 *
204 * @return \Stripe\CustomerBalanceTransaction
205 */
206 public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
207 {
208 return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
209 }
210 const PATH_SOURCES = '/sources';
211
212 /**
213 * @param string $id the ID of the customer on which to retrieve the payment sources
214 * @param null|array $params
215 * @param null|array|string $opts
216 *
217 * @throws \Stripe\Exception\ApiErrorException if the request fails
218 *
219 * @return \Stripe\Collection<\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source> the list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source)
220 */
221 public static function allSources($id, $params = null, $opts = null)
222 {
223 return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
224 }
225
226 /**
227 * @param string $id the ID of the customer on which to create the payment source
228 * @param null|array $params
229 * @param null|array|string $opts
230 *
231 * @throws \Stripe\Exception\ApiErrorException if the request fails
232 *
233 * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
234 */
235 public static function createSource($id, $params = null, $opts = null)
236 {
237 return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts);
238 }
239
240 /**
241 * @param string $id the ID of the customer to which the payment source belongs
242 * @param string $sourceId the ID of the payment source to delete
243 * @param null|array $params
244 * @param null|array|string $opts
245 *
246 * @throws \Stripe\Exception\ApiErrorException if the request fails
247 *
248 * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
249 */
250 public static function deleteSource($id, $sourceId, $params = null, $opts = null)
251 {
252 return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
253 }
254
255 /**
256 * @param string $id the ID of the customer to which the payment source belongs
257 * @param string $sourceId the ID of the payment source to retrieve
258 * @param null|array $params
259 * @param null|array|string $opts
260 *
261 * @throws \Stripe\Exception\ApiErrorException if the request fails
262 *
263 * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
264 */
265 public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
266 {
267 return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
268 }
269
270 /**
271 * @param string $id the ID of the customer to which the payment source belongs
272 * @param string $sourceId the ID of the payment source to update
273 * @param null|array $params
274 * @param null|array|string $opts
275 *
276 * @throws \Stripe\Exception\ApiErrorException if the request fails
277 *
278 * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source
279 */
280 public static function updateSource($id, $sourceId, $params = null, $opts = null)
281 {
282 return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
283 }
284 const PATH_TAX_IDS = '/tax_ids';
285
286 /**
287 * @param string $id the ID of the customer on which to retrieve the tax ids
288 * @param null|array $params
289 * @param null|array|string $opts
290 *
291 * @throws \Stripe\Exception\ApiErrorException if the request fails
292 *
293 * @return \Stripe\Collection<\Stripe\TaxId> the list of tax ids
294 */
295 public static function allTaxIds($id, $params = null, $opts = null)
296 {
297 return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
298 }
299
300 /**
301 * @param string $id the ID of the customer on which to create the tax id
302 * @param null|array $params
303 * @param null|array|string $opts
304 *
305 * @throws \Stripe\Exception\ApiErrorException if the request fails
306 *
307 * @return \Stripe\TaxId
308 */
309 public static function createTaxId($id, $params = null, $opts = null)
310 {
311 return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
312 }
313
314 /**
315 * @param string $id the ID of the customer to which the tax id belongs
316 * @param string $taxIdId the ID of the tax id to delete
317 * @param null|array $params
318 * @param null|array|string $opts
319 *
320 * @throws \Stripe\Exception\ApiErrorException if the request fails
321 *
322 * @return \Stripe\TaxId
323 */
324 public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
325 {
326 return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
327 }
328
329 /**
330 * @param string $id the ID of the customer to which the tax id belongs
331 * @param string $taxIdId the ID of the tax id to retrieve
332 * @param null|array $params
333 * @param null|array|string $opts
334 *
335 * @throws \Stripe\Exception\ApiErrorException if the request fails
336 *
337 * @return \Stripe\TaxId
338 */
339 public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
340 {
341 return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
342 }
343 }
344