Class: Stripe::Dispute
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Dispute
- 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: Evidence, EvidenceDetails, PaymentMethodDetails
Constant Summary collapse
- OBJECT_NAME =
"dispute"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Disputed amount.
-
#balance_transactions ⇒ Object
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.
-
#charge ⇒ Object
readonly
ID of the charge that’s disputed.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#enhanced_eligibility_types ⇒ Object
readonly
List of eligibility types that are included in ‘enhanced_evidence`.
-
#evidence ⇒ Object
readonly
Attribute for field evidence.
-
#evidence_details ⇒ Object
readonly
Attribute for field evidence_details.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#is_charge_refundable ⇒ Object
readonly
If true, it’s still possible to refund the disputed payment.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#network_reason_code ⇒ Object
readonly
Network-dependent reason code for the dispute.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#payment_intent ⇒ Object
readonly
ID of the PaymentIntent that’s disputed.
-
#payment_method_details ⇒ Object
readonly
Attribute for field payment_method_details.
-
#reason ⇒ Object
readonly
Reason given by cardholder for dispute.
-
#status ⇒ Object
readonly
The current status of a dispute.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.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.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your disputes.
- .object_name ⇒ Object
-
.update(dispute, params = {}, opts = {}) ⇒ Object
When you get a dispute, contacting your customer is always the best first step.
Instance Method Summary collapse
-
#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.
Methods included from APIOperations::List
Methods included from APIOperations::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
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, 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
#amount ⇒ Object (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).
375 376 377 |
# File 'lib/stripe/resources/dispute.rb', line 375 def amount @amount end |
#balance_transactions ⇒ Object (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.
377 378 379 |
# File 'lib/stripe/resources/dispute.rb', line 377 def balance_transactions @balance_transactions end |
#charge ⇒ Object (readonly)
ID of the charge that’s disputed.
379 380 381 |
# File 'lib/stripe/resources/dispute.rb', line 379 def charge @charge end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
381 382 383 |
# File 'lib/stripe/resources/dispute.rb', line 381 def created @created end |
#currency ⇒ Object (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).
383 384 385 |
# File 'lib/stripe/resources/dispute.rb', line 383 def currency @currency end |
#enhanced_eligibility_types ⇒ Object (readonly)
List of eligibility types that are included in ‘enhanced_evidence`.
385 386 387 |
# File 'lib/stripe/resources/dispute.rb', line 385 def enhanced_eligibility_types @enhanced_eligibility_types end |
#evidence ⇒ Object (readonly)
Attribute for field evidence
387 388 389 |
# File 'lib/stripe/resources/dispute.rb', line 387 def evidence @evidence end |
#evidence_details ⇒ Object (readonly)
Attribute for field evidence_details
389 390 391 |
# File 'lib/stripe/resources/dispute.rb', line 389 def evidence_details @evidence_details end |
#id ⇒ Object (readonly)
Unique identifier for the object.
391 392 393 |
# File 'lib/stripe/resources/dispute.rb', line 391 def id @id end |
#is_charge_refundable ⇒ Object (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.
393 394 395 |
# File 'lib/stripe/resources/dispute.rb', line 393 def is_charge_refundable @is_charge_refundable end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
395 396 397 |
# File 'lib/stripe/resources/dispute.rb', line 395 def livemode @livemode end |
#metadata ⇒ Object (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.
397 398 399 |
# File 'lib/stripe/resources/dispute.rb', line 397 def end |
#network_reason_code ⇒ Object (readonly)
Network-dependent reason code for the dispute.
399 400 401 |
# File 'lib/stripe/resources/dispute.rb', line 399 def network_reason_code @network_reason_code end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
401 402 403 |
# File 'lib/stripe/resources/dispute.rb', line 401 def object @object end |
#payment_intent ⇒ Object (readonly)
ID of the PaymentIntent that’s disputed.
403 404 405 |
# File 'lib/stripe/resources/dispute.rb', line 403 def payment_intent @payment_intent end |
#payment_method_details ⇒ Object (readonly)
Attribute for field payment_method_details
405 406 407 |
# File 'lib/stripe/resources/dispute.rb', line 405 def payment_method_details @payment_method_details end |
#reason ⇒ Object (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`, `noncompliant`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Learn more about [dispute reasons](stripe.com/docs/disputes/categories).
407 408 409 |
# File 'lib/stripe/resources/dispute.rb', line 407 def reason @reason end |
#status ⇒ Object (readonly)
The current status of a dispute. Possible values include:‘warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, `lost`, or `prevented`.
409 410 411 |
# File 'lib/stripe/resources/dispute.rb', line 409 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.
426 427 428 429 430 431 432 433 |
# File 'lib/stripe/resources/dispute.rb', line 426 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 |
.field_remappings ⇒ Object
460 461 462 |
# File 'lib/stripe/resources/dispute.rb', line 460 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
452 453 454 455 456 457 458 |
# File 'lib/stripe/resources/dispute.rb', line 452 def self.inner_class_types @inner_class_types = { evidence: Evidence, evidence_details: EvidenceDetails, payment_method_details: PaymentMethodDetails, } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your disputes.
436 437 438 |
# File 'lib/stripe/resources/dispute.rb', line 436 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/disputes", params: params, opts: opts) end |
.object_name ⇒ Object
15 16 17 |
# File 'lib/stripe/resources/dispute.rb', line 15 def self.object_name "dispute" end |
.update(dispute, 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](docs.stripe.com/docs/disputes/categories).
443 444 445 446 447 448 449 450 |
# File 'lib/stripe/resources/dispute.rb', line 443 def self.update(dispute, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/disputes/%<dispute>s", { dispute: CGI.escape(dispute) }), 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.
414 415 416 417 418 419 420 421 |
# File 'lib/stripe/resources/dispute.rb', line 414 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 |