Dispute.php 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * A dispute occurs when a customer questions your charge with their card issuer.
  6. * When this happens, you're given the opportunity to respond to the dispute with
  7. * evidence that shows that the charge is legitimate. You can find more information
  8. * about the dispute process in our <a href="/docs/disputes">Disputes and Fraud</a>
  9. * documentation.
  10. *
  11. * Related guide: <a href="https://stripe.com/docs/disputes">Disputes and
  12. * Fraud</a>.
  13. *
  14. * @property string $id Unique identifier for the object.
  15. * @property string $object String representing the object's type. Objects of the same type share the same value.
  16. * @property int $amount Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed).
  17. * @property \Stripe\BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
  18. * @property string|\Stripe\Charge $charge ID of the charge that was disputed.
  19. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  20. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
  21. * @property \Stripe\StripeObject $evidence
  22. * @property \Stripe\StripeObject $evidence_details
  23. * @property bool $is_charge_refundable If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute.
  24. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
  25. * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  26. * @property null|string $network_reason_code Network-dependent reason code for the dispute.
  27. * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was disputed.
  28. * @property string $reason Reason given by cardholder for dispute. Possible values are <code>bank_cannot_process</code>, <code>check_returned</code>, <code>credit_not_processed</code>, <code>customer_initiated</code>, <code>debit_not_authorized</code>, <code>duplicate</code>, <code>fraudulent</code>, <code>general</code>, <code>incorrect_account_details</code>, <code>insufficient_funds</code>, <code>product_not_received</code>, <code>product_unacceptable</code>, <code>subscription_canceled</code>, or <code>unrecognized</code>. Read more about <a href="https://stripe.com/docs/disputes/categories">dispute reasons</a>.
  29. * @property string $status Current status of dispute. Possible values are <code>warning_needs_response</code>, <code>warning_under_review</code>, <code>warning_closed</code>, <code>needs_response</code>, <code>under_review</code>, <code>charge_refunded</code>, <code>won</code>, or <code>lost</code>.
  30. */
  31. class Dispute extends ApiResource
  32. {
  33. const OBJECT_NAME = 'dispute';
  34. use ApiOperations\All;
  35. use ApiOperations\Retrieve;
  36. use ApiOperations\Update;
  37. const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
  38. const REASON_CHECK_RETURNED = 'check_returned';
  39. const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
  40. const REASON_CUSTOMER_INITIATED = 'customer_initiated';
  41. const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
  42. const REASON_DUPLICATE = 'duplicate';
  43. const REASON_FRAUDULENT = 'fraudulent';
  44. const REASON_GENERAL = 'general';
  45. const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
  46. const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds';
  47. const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received';
  48. const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable';
  49. const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled';
  50. const REASON_UNRECOGNIZED = 'unrecognized';
  51. const STATUS_CHARGE_REFUNDED = 'charge_refunded';
  52. const STATUS_LOST = 'lost';
  53. const STATUS_NEEDS_RESPONSE = 'needs_response';
  54. const STATUS_UNDER_REVIEW = 'under_review';
  55. const STATUS_WARNING_CLOSED = 'warning_closed';
  56. const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
  57. const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review';
  58. const STATUS_WON = 'won';
  59. /**
  60. * @param null|array|string $opts
  61. *
  62. * @throws \Stripe\Exception\ApiErrorException if the request fails
  63. *
  64. * @return \Stripe\Dispute the closed dispute
  65. */
  66. // TODO: add $params to standardize signature
  67. public function close($opts = null)
  68. {
  69. $url = $this->instanceUrl() . '/close';
  70. list($response, $opts) = $this->_request('post', $url, null, $opts);
  71. $this->refreshFrom($response, $opts);
  72. return $this;
  73. }
  74. }