CashBalance.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * A customer's <code>Cash balance</code> represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
  6. *
  7. * @property string $object String representing the object's type. Objects of the same type share the same value.
  8. * @property null|\Stripe\StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
  9. * @property string $customer The ID of the customer whose cash balance this object represents.
  10. * @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.
  11. * @property \Stripe\StripeObject $settings
  12. */
  13. class CashBalance extends ApiResource
  14. {
  15. const OBJECT_NAME = 'cash_balance';
  16. /**
  17. * @return string the API URL for this balance transaction
  18. */
  19. public function instanceUrl()
  20. {
  21. $customer = $this['customer'];
  22. $customer = Util\Util::utf8($customer);
  23. $base = Customer::classUrl();
  24. $customerExtn = \urlencode($customer);
  25. return "{$base}/{$customerExtn}/cash_balance";
  26. }
  27. /**
  28. * @param array|string $_id
  29. * @param null|array|string $_opts
  30. *
  31. * @throws \Stripe\Exception\BadMethodCallException
  32. */
  33. public static function retrieve($_id, $_opts = null)
  34. {
  35. $msg = 'Customer Cash Balance cannot be retrieved without a ' .
  36. 'customer ID. Retrieve a Customer Cash Balance using ' .
  37. "`Customer::retrieveCashBalance('customer_id')`.";
  38. throw new Exception\BadMethodCallException($msg);
  39. }
  40. /**
  41. * @param string $_id
  42. * @param null|array $_params
  43. * @param null|array|string $_options
  44. *
  45. * @throws \Stripe\Exception\BadMethodCallException
  46. */
  47. public static function update($_id, $_params = null, $_options = null)
  48. {
  49. $msg = 'Customer Cash Balance cannot be updated without a ' .
  50. 'customer ID. Retrieve a Customer Cash Balance using ' .
  51. "`Customer::updateCashBalance('customer_id')`.";
  52. throw new Exception\BadMethodCallException($msg);
  53. }
  54. }