PPPStripeSubscription

Class Subscription.

Defined (1)

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

/includes/api/stripe-php/lib/Subscription.php  
  1. class Subscription extends ApiResource 
  2. /** 
  3. * These constants are possible representations of the status field. 
  4. * @link https://stripe.com/docs/api#subscription_object-status 
  5. */ 
  6. const STATUS_ACTIVE = 'active'; 
  7. const STATUS_CANCELED = 'canceled'; 
  8. const STATUS_PAST_DUE = 'past_due'; 
  9. const STATUS_TRIALING = 'trialing'; 
  10. const STATUS_UNPAID = 'unpaid'; 
  11.  
  12. /** 
  13. * @param string $id The ID of the subscription to retrieve. 
  14. * @param array|string|null $opts 
  15. * @return Subscription 
  16. */ 
  17. public static function retrieve($id, $opts = null) 
  18. return self::_retrieve($id, $opts); 
  19.  
  20. /** 
  21. * @param array|null $params 
  22. * @param array|string|null $opts 
  23. * @return Collection of Subscriptions 
  24. */ 
  25. public static function all($params = null, $opts = null) 
  26. return self::_all($params, $opts); 
  27.  
  28. /** 
  29. * @param array|null $params 
  30. * @param array|string|null $opts 
  31. * @return Subscription The created subscription. 
  32. */ 
  33. public static function create($params = null, $opts = null) 
  34. return self::_create($params, $opts); 
  35.  
  36. /** 
  37. * @param string $id The ID of the subscription to retrieve. 
  38. * @param array|null $params 
  39. * @param array|string|null $options 
  40. * @return Subscription The updated subscription. 
  41. */ 
  42. public static function update($id, $params = null, $options = null) 
  43. return self::_update($id, $params, $options); 
  44.  
  45. /** 
  46. * @param array|null $params 
  47. * @return Subscription The deleted subscription. 
  48. */ 
  49. public function cancel($params = null, $opts = null) 
  50. return $this->_delete($params, $opts); 
  51.  
  52. /** 
  53. * @param array|string|null $opts 
  54. * @return Subscription The saved subscription. 
  55. */ 
  56. public function save($opts = null) 
  57. return $this->_save($opts); 
  58.  
  59. /** 
  60. * @return Subscription The updated subscription. 
  61. */ 
  62. public function deleteDiscount() 
  63. $url = $this->instanceUrl() . '/discount'; 
  64. list($response, $opts) = $this->_request('delete', $url); 
  65. $this->refreshFrom(array('discount' => null), $opts, true);