Class: Stripe::Dispute

Inherits:
APIResource show all
Extended by:
APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/dispute.rb

Overview

A dispute occurs when a customer questions your charge with their card issuer. When this happens, you have the opportunity to respond to the dispute with evidence that shows that the charge is legitimate.

Related guide: [Disputes and fraud](stripe.com/docs/disputes)

Defined Under Namespace

Classes: CloseParams, Evidence, EvidenceDetails, ListParams, PaymentMethodDetails, RetrieveParams, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"dispute"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#amountObject (readonly)

Disputed amount. Usually the amount of the charge, but it can differ (usually because of currency fluctuation or because only part of the order is disputed).



733
734
735
# File 'lib/stripe/resources/dispute.rb', line 733

def amount
  @amount
end

#balance_transactionsObject (readonly)

List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.



736
737
738
# File 'lib/stripe/resources/dispute.rb', line 736

def balance_transactions
  @balance_transactions
end

#chargeObject (readonly)

ID of the charge that’s disputed.



739
740
741
# File 'lib/stripe/resources/dispute.rb', line 739

def charge
  @charge
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



742
743
744
# File 'lib/stripe/resources/dispute.rb', line 742

def created
  @created
end

#currencyObject (readonly)

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



745
746
747
# File 'lib/stripe/resources/dispute.rb', line 745

def currency
  @currency
end

#enhanced_eligibility_typesObject (readonly)

List of eligibility types that are included in ‘enhanced_evidence`.



748
749
750
# File 'lib/stripe/resources/dispute.rb', line 748

def enhanced_eligibility_types
  @enhanced_eligibility_types
end

#evidenceObject (readonly)

Attribute for field evidence



751
752
753
# File 'lib/stripe/resources/dispute.rb', line 751

def evidence
  @evidence
end

#evidence_detailsObject (readonly)

Attribute for field evidence_details



754
755
756
# File 'lib/stripe/resources/dispute.rb', line 754

def evidence_details
  @evidence_details
end

#idObject (readonly)

Unique identifier for the object.



757
758
759
# File 'lib/stripe/resources/dispute.rb', line 757

def id
  @id
end

#is_charge_refundableObject (readonly)

If true, it’s still possible to refund the disputed payment. After the payment has been fully refunded, no further funds are withdrawn from your Stripe account as a result of this dispute.



760
761
762
# File 'lib/stripe/resources/dispute.rb', line 760

def is_charge_refundable
  @is_charge_refundable
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



763
764
765
# File 'lib/stripe/resources/dispute.rb', line 763

def livemode
  @livemode
end

#metadataObject (readonly)

Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



766
767
768
# File 'lib/stripe/resources/dispute.rb', line 766

def 
  @metadata
end

#network_reason_codeObject (readonly)

Network-dependent reason code for the dispute.



769
770
771
# File 'lib/stripe/resources/dispute.rb', line 769

def network_reason_code
  @network_reason_code
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



772
773
774
# File 'lib/stripe/resources/dispute.rb', line 772

def object
  @object
end

#payment_intentObject (readonly)

ID of the PaymentIntent that’s disputed.



775
776
777
# File 'lib/stripe/resources/dispute.rb', line 775

def payment_intent
  @payment_intent
end

#payment_method_detailsObject (readonly)

Attribute for field payment_method_details



778
779
780
# File 'lib/stripe/resources/dispute.rb', line 778

def payment_method_details
  @payment_method_details
end

#reasonObject (readonly)

Reason given by cardholder for dispute. Possible values are ‘bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Learn more about [dispute reasons](stripe.com/docs/disputes/categories).



781
782
783
# File 'lib/stripe/resources/dispute.rb', line 781

def reason
  @reason
end

#statusObject (readonly)

Current status of dispute. Possible values are ‘warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, or `lost`.



784
785
786
# File 'lib/stripe/resources/dispute.rb', line 784

def status
  @status
end

Class Method Details

.close(dispute, params = {}, opts = {}) ⇒ Object

Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.

The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.



801
802
803
804
805
806
807
808
# File 'lib/stripe/resources/dispute.rb', line 801

def self.close(dispute, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(dispute) }),
    params: params,
    opts: opts
  )
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of your disputes.



811
812
813
# File 'lib/stripe/resources/dispute.rb', line 811

def self.list(params = {}, opts = {})
  request_stripe_object(method: :get, path: "/v1/disputes", params: params, opts: opts)
end

.object_nameObject



15
16
17
# File 'lib/stripe/resources/dispute.rb', line 15

def self.object_name
  "dispute"
end

.update(id, params = {}, opts = {}) ⇒ Object

When you get a dispute, contacting your customer is always the best first step. If that doesn’t work, you can submit evidence to help us resolve the dispute in your favor. You can do this in your [dashboard](dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically.

Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute. To figure out which evidence fields to provide, see our [guide to dispute types](stripe.com/docs/disputes/categories).



818
819
820
821
822
823
824
825
# File 'lib/stripe/resources/dispute.rb', line 818

def self.update(id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/disputes/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#close(params = {}, opts = {}) ⇒ Object

Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.

The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.



789
790
791
792
793
794
795
796
# File 'lib/stripe/resources/dispute.rb', line 789

def close(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end