#santosh-rana_api

1 messages ¡ Page 1 of 1 (latest)

velvet whaleBOT
static crescentBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

velvet whaleBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1255477757278945330

📝 Have more to share? Add details, code, screenshots, videos, etc. below.

last forge
#

Do you have details of the error? The ID of the request that threw the error?

sullen coral
#

Thats a request id

#

im getting this error messaage: The sum of credit_amount, refund_amount and out_of_band_amount ($1,000.00) must equal the credit note amount ($900.00) on a paid invoice

#

My invoice is 1800

#

but when i try to issue credit for 900 still throw an error i tried with small mount still same error

#

same invoice another request req_QurHyc7V3DtqnB

last forge
#

Thanks, checking on this

sullen coral
#

req_R5eY5Tj6YZRzmz

last forge
#

Yeah we think this has to do with the coupon/discount applied to the invoice, confirming the maths

sullen coral
#

yes we have ormo code applied 10%

#

original line item cost was 2000 and 10% discount after 1800 was paid

#

Doesn't that mean we can issue credit up to 1800?

frozen bramble
#

I don't understand CreditNotes, but I'd suggest just doing it in the Dashboard and then you can copy what it does.

It send this:

{
  "invoice": "in_xxx",
  "lines": {
    "0": {
      "type": "invoice_line_item",
      "invoice_line_item": "il_xxx",
      "amount": "100000"
    }
  },
  "refund_amount": "90000",
  "reason": "product_unsatisfactory",
 
}
#

I think the idea is whatever amount you intend to credit($1000 in your case), you have to discount that by the 10% because there was already a discount applied. That's presumably why the Dashboard converts this into a $900 refund when you credit $1000.

sullen coral
#

hmmm

frozen bramble
#

if you want to refund $1000 exactly apparently you need to credit by $1111.11 (i.e. 110%).

#

I don't understand it either really but hopefully that unblocks you in terms of actual development

#

just use the Dashboard and copy the API requests it makes if you want to use CreditNotes

sullen coral
#

This will work but very wierd isn't it the 1800 was post discount on my line item haha

#

if i need to do full refund then i need to pass pre disocunt amount ?

frozen bramble
#

you pass the pre discount amount to the line[0].amount , and the post-discount(actually paid) to refund_amount

sullen coral
#

Yeah its working now that way

#

but for the invoice which does not have a discount it work without doing this

frozen bramble
#

yep

#

it's just however "CreditNotes + Discounts" work , which I don't really have an intuitive understanding of myself(I never really use this API) but hopefully this unblocks you in the actual development side

sullen coral
#

have to do some logic before passing amount but yeah overall it works