Class: Stripe::ErrorObject

Inherits:
StripeObject show all
Defined in:
lib/stripe/error_object.rb

Overview

Represents an error object as returned by the API.

Constant Summary

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Method Summary collapse

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 Method Details

#chargeObject

For card errors, the ID of the failed charge.



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

def charge
  @values[:charge]
end

#codeObject

For some errors that could be handled programmatically, a short string indicating the error code reported.



21
22
23
# File 'lib/stripe/error_object.rb', line 21

def code
  @values[:code]
end

#decline_codeObject

For card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.



27
28
29
# File 'lib/stripe/error_object.rb', line 27

def decline_code
  @values[:decline_code]
end

#doc_urlObject

A URL to more information about the error code reported.



32
33
34
# File 'lib/stripe/error_object.rb', line 32

def doc_url
  @values[:doc_url]
end

#messageObject

A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.



38
39
40
# File 'lib/stripe/error_object.rb', line 38

def message
  @values[:message]
end

#paramObject

If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.



45
46
47
# File 'lib/stripe/error_object.rb', line 45

def param
  @values[:param]
end

#payment_intentObject

The PaymentIntent object for errors returned on a request involving a PaymentIntent.



51
52
53
# File 'lib/stripe/error_object.rb', line 51

def payment_intent
  @values[:payment_intent]
end

#payment_methodObject

The PaymentMethod object for errors returned on a request involving a PaymentMethod.



57
58
59
# File 'lib/stripe/error_object.rb', line 57

def payment_method
  @values[:payment_method]
end

#setup_intentObject

The SetupIntent object for errors returned on a request involving a SetupIntent.



63
64
65
# File 'lib/stripe/error_object.rb', line 63

def setup_intent
  @values[:setup_intent]
end

#sourceObject

The source object for errors returned on a request involving a source.



68
69
70
# File 'lib/stripe/error_object.rb', line 68

def source
  @values[:source]
end

#typeObject

The type of error returned. One of ‘api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`.



74
75
76
# File 'lib/stripe/error_object.rb', line 74

def type
  @values[:type]
end