The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::Stripe::Billing::CreditNote - A Stripe Credit Note Object

SYNOPSIS

    my $note = $stripe->credite_note({
        amount => 2000,
        memo => 'Credit note for your purchase on 2020-03-17',
        currency => 'eur',
        # Required
        invoice => $invoice_object,
        number => 'CR2020031701',
        metadata => { transac_id => 1212, client_id => 789, ts => 1584403200 }
        total => 2000
    });

VERSION

    v0.201.0

DESCRIPTION

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

CREATING A CREDIT NOTE

Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result in any combination of the following:

  • Refund: create a new refund (using refund_amount) or link an existing refund (using refund).

  • Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized.

  • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).

For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.

You may issue multiple credit notes for an invoice. Each credit note will increment the invoice’s pre_payment_credit_notes_amount or post_payment_credit_notes_amount depending on its status at the time of credit note creation.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Billing::CreditNote object. It may also take an hash like arguments, that also are method of the same name.

METHODS

id string

Unique identifier for the object.

object string, value is "credit_note"

String representing the object’s type. Objects of the same type share the same value.

amount integer

The integer amount in JPY representing the total amount of the credit note, including tax.

created timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

currency currency

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer string (expandable)

ID of the customer. When expanded, this is a Net::API::Stripe::Customer object.

customer_balance_transaction string (expandable)

Customer balance transaction related to this credit note. When expanded, this is a Net::API::Stripe::Balance::Transaction object.

discount_amount integer

The integer amount in JPY representing the total amount of discount that was credited.

discount_amounts array of hash

The aggregate amounts calculated per discount for all line items.

It has the following properties:

amount integer

The amount, in JPY, of the discount.

discount string

The discount that was applied to get this discount amount.

invoice string (expandable)

ID of the invoice. When expanded, this is a Net::API::Stripe::Billing::Invoice object.

lines() list

Line items that make up the credit note.

This is a Net::API::Stripe::List object with a list of Net::API::Stripe::Billing::CreditNote::LineItem

livemode boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

memo string

Customer-facing text that appears on the credit note PDF.

metadata hash

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

number string

A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.

out_of_band_amount() integer

Amount that was credited outside of Stripe.

pdf string

The link to download the PDF of the credit note.

reason string

Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory

refund string (expandable)

Refund related to this credit note. When expanded, this is a Net::API::Stripe::Refund object.

status string

Status of this credit note, one of issued or void. Learn more about voiding credit notes.

subtotal() integer

The integer amount in JPY representing the amount of the credit note, excluding tax and discount.

subtotal_excluding_tax integer

The integer amount in JPY representing the amount of the credit note, excluding all tax and invoice level discounts.

tax_amounts() array of objects

The amount of tax calculated per tax rate for this line item.

This is a dynamic class with the following properties:

amount integer

The amount, in JPY, of the tax.

inclusive boolean

Whether this tax amount is inclusive or exclusive.

tax_rate string expandable

The tax rate that was applied to get this tax amount.

When expanded, this is a Net::API::Stripe::Tax::Rate object.

total() integer

The integer amount in JPY representing the total amount of the credit note, including tax and discount.

total_excluding_tax integer

The integer amount in JPY representing the total amount of the credit note, excluding tax, but including discounts.

type string

Type of this credit note, one of post_payment or pre_payment. A pre_payment credit note means it was issued when the invoice was open. A post_payment credit note means it was issued when the invoice was paid.

voided_at timestamp

The time that the credit note was voided. This is a DateTime object.

API SAMPLE

    {
      "id": "cn_fake124567890",
      "object": "credit_note",
      "amount": 1690,
      "created": 1571397911,
      "currency": "jpy",
      "customer": "cus_fake124567890",
      "customer_balance_transaction": null,
      "invoice": "in_fake124567890",
      "livemode": false,
      "memo": null,
      "metadata": {},
      "number": "ABCD-1234-CN-01",
      "pdf": "https://pay.stripe.com/credit_notes/acct_19eGgRCeyNCl6fY2/cnst_123456789/pdf",
      "reason": null,
      "refund": null,
      "status": "issued",
      "type": "pre_payment",
      "voided_at": null
    }

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/credit_notes, https://stripe.com/docs/billing/invoices/credit-notes

COPYRIGHT & LICENSE

Copyright (c) 2020-2020 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.