M2_Stripe_Charge

The Membership 2 M2 Stripe Charge class.

Defined (1)

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

/lib/stripe-php/lib/Stripe/Charge.php  
  1. class M2_Stripe_Charge extends M2_Stripe_ApiResource 
  2. /** 
  3. * @param string $id The ID of the charge to retrieve. 
  4. * @param string|null $apiKey 
  5. * @return Stripe_Charge 
  6. */ 
  7. public static function retrieve($id, $apiKey=null) 
  8. $class = get_class(); 
  9. return self::_scopedRetrieve($class, $id, $apiKey); 
  10.  
  11. /** 
  12. * @param array|null $params 
  13. * @param string|null $apiKey 
  14. * @return array An array of Stripe_Charges. 
  15. */ 
  16. public static function all($params=null, $apiKey=null) 
  17. $class = get_class(); 
  18. return self::_scopedAll($class, $params, $apiKey); 
  19.  
  20. /** 
  21. * @param array|null $params 
  22. * @param string|null $apiKey 
  23. * @return Stripe_Charge The created charge. 
  24. */ 
  25. public static function create($params=null, $apiKey=null) 
  26. $class = get_class(); 
  27. return self::_scopedCreate($class, $params, $apiKey); 
  28.  
  29. /** 
  30. * @return Stripe_Charge The saved charge. 
  31. */ 
  32. public function save() 
  33. $class = get_class(); 
  34. return self::_scopedSave($class); 
  35.  
  36. /** 
  37. * @param array|null $params 
  38. * @return Stripe_Charge The refunded charge. 
  39. */ 
  40. public function refund($params=null) 
  41. $requestor = new M2_Stripe_ApiRequestor($this->_apiKey); 
  42. $url = $this->instanceUrl() . '/refund'; 
  43. list($response, $apiKey) = $requestor->request('post', $url, $params); 
  44. $this->refreshFrom($response, $apiKey); 
  45. return $this; 
  46.  
  47. /** 
  48. * @param array|null $params 
  49. * @return Stripe_Charge The captured charge. 
  50. */ 
  51. public function capture($params=null) 
  52. $requestor = new M2_Stripe_ApiRequestor($this->_apiKey); 
  53. $url = $this->instanceUrl() . '/capture'; 
  54. list($response, $apiKey) = $requestor->request('post', $url, $params); 
  55. $this->refreshFrom($response, $apiKey); 
  56. return $this; 
  57.  
  58. /** 
  59. * @param array|null $params 
  60. * @return array The updated dispute. 
  61. */ 
  62. public function updateDispute($params=null) 
  63. $requestor = new M2_Stripe_ApiRequestor($this->_apiKey); 
  64. $url = $this->instanceUrl() . '/dispute'; 
  65. list($response, $apiKey) = $requestor->request('post', $url, $params); 
  66. $this->refreshFrom(array('dispute' => $response), $apiKey, true); 
  67. return $this->dispute; 
  68.  
  69. /** 
  70. * @return Stripe_Charge The updated charge. 
  71. */ 
  72. public function closeDispute() 
  73. $requestor = new M2_Stripe_ApiRequestor($this->_apiKey); 
  74. $url = $this->instanceUrl() . '/dispute/close'; 
  75. list($response, $apiKey) = $requestor->request('post', $url); 
  76. $this->refreshFrom($response, $apiKey); 
  77. return $this;