Class: Stripe::CreditNote

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

Overview

Issue a credit note to adjust an invoice’s amount after the invoice is finalized.

Related guide: [Credit notes](stripe.com/docs/billing/invoices/credit-notes)

Constant Summary collapse

OBJECT_NAME =
"credit_note"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

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

Class Method Details

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

When retrieving a credit note preview, you’ll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.



26
27
28
29
30
31
32
33
# File 'lib/stripe/resources/credit_note.rb', line 26

def self.list_preview_line_items(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/credit_notes/preview/lines",
    params: params,
    opts: opts
  )
end

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

Get a preview of a credit note without creating it.



36
37
38
39
40
41
42
43
# File 'lib/stripe/resources/credit_note.rb', line 36

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

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

Marks a credit note as void. Learn more about [voiding credit notes](stripe.com/docs/billing/invoices/credit-notes#voiding).



46
47
48
49
50
51
52
53
# File 'lib/stripe/resources/credit_note.rb', line 46

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

Instance Method Details

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

Marks a credit note as void. Learn more about [voiding credit notes](stripe.com/docs/billing/invoices/credit-notes#voiding).



16
17
18
19
20
21
22
23
# File 'lib/stripe/resources/credit_note.rb', line 16

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