PPPStripeCustomer

Class Customer.

Defined (1)

The class is defined in the following location(s).

/includes/api/stripe-php/lib/Customer.php  
  1. class Customer extends ApiResource 
  2. /** 
  3. * @param string $id The ID of the customer to retrieve. 
  4. * @param array|string|null $opts 
  5. * @return Customer 
  6. */ 
  7. public static function retrieve($id, $opts = null) 
  8. return self::_retrieve($id, $opts); 
  9.  
  10. /** 
  11. * @param array|null $params 
  12. * @param array|string|null $opts 
  13. * @return Collection of Customers 
  14. */ 
  15. public static function all($params = null, $opts = null) 
  16. return self::_all($params, $opts); 
  17.  
  18. /** 
  19. * @param array|null $params 
  20. * @param array|string|null $opts 
  21. * @return Customer The created customer. 
  22. */ 
  23. public static function create($params = null, $opts = null) 
  24. return self::_create($params, $opts); 
  25.  
  26. /** 
  27. * @param string $id The ID of the customer to update. 
  28. * @param array|null $params 
  29. * @param array|string|null $options 
  30. * @return Customer The updated customer. 
  31. */ 
  32. public static function update($id, $params = null, $options = null) 
  33. return self::_update($id, $params, $options); 
  34.  
  35. /** 
  36. * @param array|string|null $opts 
  37. * @return Customer The saved customer. 
  38. */ 
  39. public function save($opts = null) 
  40. return $this->_save($opts); 
  41.  
  42. /** 
  43. * @param array|null $params 
  44. * @param array|string|null $opts 
  45. * @return Customer The deleted customer. 
  46. */ 
  47. public function delete($params = null, $opts = null) 
  48. return $this->_delete($params, $opts); 
  49.  
  50. /** 
  51. * @param array|null $params 
  52. * @return InvoiceItem The resulting invoice item. 
  53. */ 
  54. public function addInvoiceItem($params = null) 
  55. if (!$params) { 
  56. $params = array(); 
  57. $params['customer'] = $this->id; 
  58. $ii = InvoiceItem::create($params, $this->_opts); 
  59. return $ii; 
  60.  
  61. /** 
  62. * @param array|null $params 
  63. * @return array An array of the customer's Invoices. 
  64. */ 
  65. public function invoices($params = null) 
  66. if (!$params) { 
  67. $params = array(); 
  68. $params['customer'] = $this->id; 
  69. $invoices = Invoice::all($params, $this->_opts); 
  70. return $invoices; 
  71.  
  72. /** 
  73. * @param array|null $params 
  74. * @return array An array of the customer's InvoiceItems. 
  75. */ 
  76. public function invoiceItems($params = null) 
  77. if (!$params) { 
  78. $params = array(); 
  79. $params['customer'] = $this->id; 
  80. $iis = InvoiceItem::all($params, $this->_opts); 
  81. return $iis; 
  82.  
  83. /** 
  84. * @param array|null $params 
  85. * @return array An array of the customer's Charges. 
  86. */ 
  87. public function charges($params = null) 
  88. if (!$params) { 
  89. $params = array(); 
  90. $params['customer'] = $this->id; 
  91. $charges = Charge::all($params, $this->_opts); 
  92. return $charges; 
  93.  
  94. /** 
  95. * @param array|null $params 
  96. * @return Subscription The updated subscription. 
  97. */ 
  98. public function updateSubscription($params = null) 
  99. $url = $this->instanceUrl() . '/subscription'; 
  100. list($response, $opts) = $this->_request('post', $url, $params); 
  101. $this->refreshFrom(array('subscription' => $response), $opts, true); 
  102. return $this->subscription; 
  103.  
  104. /** 
  105. * @param array|null $params 
  106. * @return Subscription The cancelled subscription. 
  107. */ 
  108. public function cancelSubscription($params = null) 
  109. $url = $this->instanceUrl() . '/subscription'; 
  110. list($response, $opts) = $this->_request('delete', $url, $params); 
  111. $this->refreshFrom(array('subscription' => $response), $opts, true); 
  112. return $this->subscription; 
  113.  
  114. /** 
  115. * @return Customer The updated customer. 
  116. */ 
  117. public function deleteDiscount() 
  118. $url = $this->instanceUrl() . '/discount'; 
  119. list($response, $opts) = $this->_request('delete', $url); 
  120. $this->refreshFrom(array('discount' => null), $opts, true);