Path: blob/master/externals/stripe-php/lib/Stripe/Charge.php
12256 views
<?php12class Stripe_Charge extends Stripe_ApiResource3{4/**5* @param string $id The ID of the charge to retrieve.6* @param string|null $apiKey7*8* @return Stripe_Charge9*/10public static function retrieve($id, $apiKey=null)11{12$class = get_class();13return self::_scopedRetrieve($class, $id, $apiKey);14}1516/**17* @param array|null $params18* @param string|null $apiKey19*20* @return array An array of Stripe_Charges.21*/22public static function all($params=null, $apiKey=null)23{24$class = get_class();25return self::_scopedAll($class, $params, $apiKey);26}2728/**29* @param array|null $params30* @param string|null $apiKey31*32* @return Stripe_Charge The created charge.33*/34public static function create($params=null, $apiKey=null)35{36$class = get_class();37return self::_scopedCreate($class, $params, $apiKey);38}3940/**41* @return Stripe_Charge The saved charge.42*/43public function save()44{45$class = get_class();46return self::_scopedSave($class);47}4849/**50* @param array|null $params51*52* @return Stripe_Charge The refunded charge.53*/54public function refund($params=null)55{56$requestor = new Stripe_ApiRequestor($this->_apiKey);57$url = $this->instanceUrl() . '/refund';58list($response, $apiKey) = $requestor->request('post', $url, $params);59$this->refreshFrom($response, $apiKey);60return $this;61}6263/**64* @param array|null $params65*66* @return Stripe_Charge The captured charge.67*/68public function capture($params=null)69{70$requestor = new Stripe_ApiRequestor($this->_apiKey);71$url = $this->instanceUrl() . '/capture';72list($response, $apiKey) = $requestor->request('post', $url, $params);73$this->refreshFrom($response, $apiKey);74return $this;75}7677/**78* @param array|null $params79*80* @return array The updated dispute.81*/82public function updateDispute($params=null)83{84$requestor = new Stripe_ApiRequestor($this->_apiKey);85$url = $this->instanceUrl() . '/dispute';86list($response, $apiKey) = $requestor->request('post', $url, $params);87$this->refreshFrom(array('dispute' => $response), $apiKey, true);88return $this->dispute;89}9091/**92* @return Stripe_Charge The updated charge.93*/94public function closeDispute()95{96$requestor = new Stripe_ApiRequestor($this->_apiKey);97$url = $this->instanceUrl() . '/dispute/close';98list($response, $apiKey) = $requestor->request('post', $url);99$this->refreshFrom($response, $apiKey);100return $this;101}102}103104105