Sha256: 5391081cfa2304bf6aaf40c731798851a8cae6ad9882903a9525074cac767b86

Contents?: true

Size: 1.34 KB

Versions: 33

Compression:

Stored size: 1.34 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"

    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

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

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

    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

33 entries across 33 versions & 1 rubygems

Version Path
stripe-10.5.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.4.0 lib/stripe/resources/credit_note.rb
stripe-10.4.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.3.0 lib/stripe/resources/credit_note.rb
stripe-10.3.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.2.0 lib/stripe/resources/credit_note.rb
stripe-10.2.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.1.0 lib/stripe/resources/credit_note.rb
stripe-10.1.0.pre.beta.2 lib/stripe/resources/credit_note.rb
stripe-10.1.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-10.0.0 lib/stripe/resources/credit_note.rb
stripe-9.5.0.pre.beta.2 lib/stripe/resources/credit_note.rb
stripe-9.5.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-9.4.0 lib/stripe/resources/credit_note.rb
stripe-9.4.0.pre.beta.3 lib/stripe/resources/credit_note.rb
stripe-9.4.0.pre.beta.2 lib/stripe/resources/credit_note.rb
stripe-9.4.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-9.3.0 lib/stripe/resources/credit_note.rb
stripe-9.3.0.pre.beta.1 lib/stripe/resources/credit_note.rb
stripe-9.2.0 lib/stripe/resources/credit_note.rb