#HSaade-Credit-Note

1 messages · Page 1 of 1 (latest)

bronze cedar
#

Hi there!

#

Reading!

#

Can you provide the request ID where you hit that error?

unkempt copper
#

req_ryZ7DxzGFSRB2p

bronze cedar
#

Sorry for the delay!

#

Looking now

unkempt copper
#

it's alright

bronze cedar
#

Okay so you want to actually credit them $5.99?

#

Or can you specify what exactly you do want to accomplish with this credit note?

unkempt copper
#

I'll get back to you in a minute plz

bronze cedar
#

Sure no problem!

unkempt copper
#

This is exactly what I am trying to accomplish, but through the API:

bronze cedar
#

So you want to credit them $677.20

#

I think your issue here is that you are setting both credit_amount and invoice_line_item

#

You likely just want to be setting invoice_line_item

unkempt copper
#

but then how will the API know that I want to credit, and not refund?

minor glen
#

you pass refund: false or refund: true

unkempt copper
#

As this is not in the docs, is it a parameter in the CreditNote.create() method, or is that in the lines dict?

minor glen
unkempt copper
#

refund is a parameter that takes a refund ID, not a bool. am I missing something?

minor glen
#

Ah my bad I misread you're right.

#

So what happens when you pass credit_amount but it's the correct amount?

#

Like right now you passed credit_amount: 599 but that's $5.99. All our amounts are in the smallest currency unit, here cents

unkempt copper
#

No issues, I adjusted the credit_amount, here is the new exception:
Request req_IEHmWCDAddfVaW: The sum of credit amount, refund amount and out of band amount ($599.00) must equal the credit note amount ($677.20).

minor glen
#

Okay so now what if you pass the real amount you want credit_amount: 67720?

unkempt copper
#

it looks like I need to know the exact credit amount before sending it to the API. Is there a way I can make this calculated by Stripe?

minor glen
#

sorry CreditNotes are the one part of our API I barely understand so we'll have to discover it together, it's always so confusing 😅

#

What I usually do is look at what call the Dashboard makes, have you looked at that?

unkempt copper
#

no worries at all, yes we can definitely discover that together..plz guide me as what you mean by "what call the Dashboard makes". where do I see that?

minor glen
#

Create that CreditNote and then look at the Invoice and it should have the Log for that creation and you can look at all the parameters

unkempt copper
#

Correct, I have all the details of the CN. However, my main challenge is not resolved as of now. I am not able to determine the total amount to be credited. I only know the line item's price before tax, so how do I go with that only?

minor glen
#

Can you try and share an exact CreditNote that you already created in the Dashboard and looks exactly like what you want? Once we have that we can look at how it was created and then mirror it

unkempt copper
#

Sure, here is one: cn_1LVdDcBQSc48BDFbS7XMRGV2

keen storm
#

Thanks! I'll take a look (koopajah has to head out soon, so I'm taking over)

unkempt copper
#

Hello karbi! I'm honestly not sure, all I have is the line item Price, which I want to create a "valid" credit note with. A valid credit note is one that reverses any discount and tax on the original invoice..

keen storm
#

Ahhh I think I see what this is - are you intending to do a partial refund of the line item, or do you want to be fully refunding that line item?

unkempt copper
#

Usually, in this use case, the line items have more than 1 quantity. So what I want is to cancel 1 quantity and create a Credit Note with it. So if the line items have a total of 5 quantities, I want to reverse one and credit it, along with discounts and taxes

#

so it's a partial refund in the form of a credit only if there are 2 or more quantities, but if it's only 1, then it's a total refund in the form of a credit

keen storm
#

Got it!

#

Do you have any test mode invoices handy with line items >1? The dashboard example you gave still only had a quantity of 1, and it'd be great to see an example where it's just crediting back part of the quantity

unkempt copper
#

oh okay, sure, I can create a test case and share it with you

#

Here is the test case

#

I will do the credit now

#

Here's the credit note: cn_1LVhDRBQSc48BDFbR7oRgqUD

keen storm
#

This seems to be more complicated then I initially thought/the dashboard is doing a lot of behind the scenes calculations to get the correct amount - I'm still looking to see if there's a simpler solution that I'm just missing

#

AH! I think I found it - so what you can do is Preview the Credit Note (https://stripe.com/docs/api/credit_notes/preview) without specifying any amounts, and that'll do all the calculations for you and tell you how much that credit totals out to

#

I need to head out, but the credit note preview should be exactly what you want - if you need anything else @dry ermine can answer you questions