PPPStripeCharge

Class Charge.

Defined (1)

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

/includes/api/stripe-php/lib/Charge.php  
  1. class Charge extends ApiResource 
  2. /** 
  3. * @param string $id The ID of the charge to retrieve. 
  4. * @param array|string|null $options 
  5. * @return Charge 
  6. */ 
  7. public static function retrieve($id, $options = null) 
  8. return self::_retrieve($id, $options); 
  9.  
  10. /** 
  11. * @param array|null $params 
  12. * @param array|string|null $options 
  13. * @return Collection of Charges 
  14. */ 
  15. public static function all($params = null, $options = null) 
  16. return self::_all($params, $options); 
  17.  
  18. /** 
  19. * @param array|null $params 
  20. * @param array|string|null $options 
  21. * @return Charge The created charge. 
  22. */ 
  23. public static function create($params = null, $options = null) 
  24. return self::_create($params, $options); 
  25.  
  26. /** 
  27. * @param string $id The ID of the charge to update. 
  28. * @param array|null $params 
  29. * @param array|string|null $options 
  30. * @return Charge The updated charge. 
  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 $options 
  37. * @return Charge The saved charge. 
  38. */ 
  39. public function save($options = null) 
  40. return $this->_save($options); 
  41.  
  42. /** 
  43. * @param array|null $params 
  44. * @param array|string|null $options 
  45. * @return Charge The refunded charge. 
  46. */ 
  47. public function refund($params = null, $options = null) 
  48. $url = $this->instanceUrl() . '/refund'; 
  49. list($response, $opts) = $this->_request('post', $url, $params, $options); 
  50. $this->refreshFrom($response, $opts); 
  51. return $this; 
  52.  
  53. /** 
  54. * @param array|null $params 
  55. * @param array|string|null $options 
  56. * @return Charge The captured charge. 
  57. */ 
  58. public function capture($params = null, $options = null) 
  59. $url = $this->instanceUrl() . '/capture'; 
  60. list($response, $opts) = $this->_request('post', $url, $params, $options); 
  61. $this->refreshFrom($response, $opts); 
  62. return $this; 
  63.  
  64. /** 
  65. * @param array|null $params 
  66. * @param array|string|null $options 
  67. * @deprecated Use the `save` method on the Dispute object 
  68. * @return array The updated dispute. 
  69. */ 
  70. public function updateDispute($params = null, $options = null) 
  71. $url = $this->instanceUrl() . '/dispute'; 
  72. list($response, $opts) = $this->_request('post', $url, $params, $options); 
  73. $this->refreshFrom(array('dispute' => $response), $opts, true); 
  74. return $this->dispute; 
  75.  
  76. /** 
  77. * @param array|string|null $options 
  78. * @deprecated Use the `close` method on the Dispute object 
  79. * @return Charge The updated charge. 
  80. */ 
  81. public function closeDispute($options = null) 
  82. $url = $this->instanceUrl() . '/dispute/close'; 
  83. list($response, $opts) = $this->_request('post', $url, null, $options); 
  84. $this->refreshFrom($response, $opts); 
  85. return $this; 
  86.  
  87. /** 
  88. * @param array|string|null $opts 
  89. * @return Charge The updated charge. 
  90. */ 
  91. public function markAsFraudulent($opts = null) 
  92. $params = array('fraud_details' => array('user_report' => 'fraudulent')); 
  93. $url = $this->instanceUrl(); 
  94. list($response, $opts) = $this->_request('post', $url, $params, $opts); 
  95. $this->refreshFrom($response, $opts); 
  96. return $this; 
  97.  
  98. /** 
  99. * @param array|string|null $opts 
  100. * @return Charge The updated charge. 
  101. */ 
  102. public function markAsSafe($opts = null) 
  103. $params = array('fraud_details' => array('user_report' => 'safe')); 
  104. $url = $this->instanceUrl(); 
  105. list($response, $opts) = $this->_request('post', $url, $params, $opts); 
  106. $this->refreshFrom($response, $opts); 
  107. return $this;