Sha256: 0a88bd8583052e841b3f0213c133bcb8166f12915ea5b20a56f07de4c50dbc34

Contents?: true

Size: 1.85 KB

Versions: 9

Compression:

Stored size: 1.85 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  # Issue a credit note to adjust an invoice's amount after the invoice is finalized.
  #
  # Related guide: [Credit notes](https://stripe.com/docs/billing/invoices/credit-notes)
  class CreditNote < APIResource
    extend Stripe::APIOperations::Create
    extend Stripe::APIOperations::List
    include Stripe::APIOperations::Save

    OBJECT_NAME = "credit_note"

    # Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
    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

    # 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.
    def self.list_preview_line_items(params = {}, opts = {})
      request_stripe_object(
        method: :get,
        path: "/v1/credit_notes/preview/lines",
        params: params,
        opts: opts
      )
    end

    # Get a preview of a credit note without creating it.
    def self.preview(params = {}, opts = {})
      request_stripe_object(
        method: :get,
        path: "/v1/credit_notes/preview",
        params: params,
        opts: opts
      )
    end

    # Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stripe-10.7.1 lib/stripe/resources/credit_note.rb
stripe-10.8.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.7.0 lib/stripe/resources/credit_note.rb
stripe-10.7.0.pre.beta.3 lib/stripe/resources/credit_note.rb
stripe-10.7.0.pre.beta.2 lib/stripe/resources/credit_note.rb
stripe-10.7.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.6.0 lib/stripe/resources/credit_note.rb
stripe-10.6.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.5.0 lib/stripe/resources/credit_note.rb