[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 class Stripe_Subscription extends Stripe_ApiResource 4 { 5 /** 6 * @return string The API URL for this Stripe subscription. 7 */ 8 public function instanceUrl() 9 { 10 $id = $this['id']; 11 $customer = $this['customer']; 12 if (!$id) { 13 throw new Stripe_InvalidRequestError( 14 "Could not determine which URL to request: " . 15 "class instance has invalid ID: $id", 16 null 17 ); 18 } 19 $id = Stripe_ApiRequestor::utf8($id); 20 $customer = Stripe_ApiRequestor::utf8($customer); 21 22 $base = self::classUrl('Stripe_Customer'); 23 $customerExtn = urlencode($customer); 24 $extn = urlencode($id); 25 return "$base/$customerExtn/subscriptions/$extn"; 26 } 27 28 /** 29 * @param array|null $params 30 * @return Stripe_Subscription The deleted subscription. 31 */ 32 public function cancel($params=null) 33 { 34 $class = get_class(); 35 return self::_scopedDelete($class, $params); 36 } 37 38 /** 39 * @return Stripe_Subscription The saved subscription. 40 */ 41 public function save() 42 { 43 $class = get_class(); 44 return self::_scopedSave($class); 45 } 46 47 /** 48 * @return Stripe_Subscription The updated subscription. 49 */ 50 public function deleteDiscount() 51 { 52 $requestor = new Stripe_ApiRequestor($this->_apiKey); 53 $url = $this->instanceUrl() . '/discount'; 54 list($response, $apiKey) = $requestor->request('delete', $url); 55 $this->refreshFrom(array('discount' => null), $apiKey, true); 56 } 57 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |