#stellar-invoices

1 messages · Page 1 of 1 (latest)

winged peak
#

Hi there, how can I help?

sonic crown
#

i'm trying to get a preview of the invoice when updates are applied to a subscription

#

the net amount and items in the upcomingInvoice is different from the actual invoice

#

i'm using this invoices.retrieveUpcoming because i want the proration amounts

winged peak
sonic crown
#

req_XivbFuFYb0deQ1

winged peak
#

Thanks, give me a sec to take a look

#

I'm unable to see the response because the GET response is not cached.

#

Can you tell me the amount that you are expecting vs the amount that you are getting the API?

sonic crown
#

this is the array of description of invoice lines, the last one add the extra amount, it shouldn't be there, line 2 - 3 already take care of it

winged peak
#

Hmm, I thought the problem is with amount?

sonic crown
#

yes that's what adds the amount

#

sorry if i wasn't clear

winged peak
#

No worries, so please correct me if I'm wrong.

You expectation is the first 3 lines, but the API returns 4 lines, is this the correct understanding?

sonic crown
#

yes

#

these are the parameters i pass to the api

#

additionalItems = invoice_items

winged peak
#

Hmm, but it looks different than the request that you passed to me iar_XivbFuFYb0deQ1, the quantity is 3 in this request.

sonic crown
#

yeah

#

it may bbe old

#

i will create a new request

#

ok here is the request: req_zHUlCYocVAVarj corresponding to the screenshots

winged peak
#

OK, thanks. So the upcoming invoice should contain

  • 4 x price_1KYOGRSAuIq5vjOhesZ0uLv3
  • 1 x price_1KYOGSSAuIq5vjOhZtcv8oyT
  • proration for price_1KYOGRSAuIq5vjOhesZ0uLv3 assuming the update happens at 1 March 2022 05:42:50 UTC
sonic crown
#

yes

#

request also has coupon, but they are product specific so they won't be applied to these products

winged peak
#

Yes you are right.

#

Does it answer your question?

sonic crown
winged peak
#

Sorry I mean does it clear your doubt? because you specify 4 x price_1KYOGRSAuIq5vjOhesZ0uLv3 in the request, therefore it shows up in line 4 of the response.

sonic crown
#

no

#

look here is the invoice when actually paid

winged peak
#

I think the description array is what confuses you, may I know from which response property did you get it from?

sonic crown
#

invoice.lines.data

winged peak
#

Ok, can you check the type of the last item, is it susbcription or invoiceitem ?

sonic crown
#

type=subscription

winged peak
#

Thanks for confirming. So the lines array contains both invoiceitem and subscription items. The first 3 items are what you see in the invoice from Dashboard, and the last one is the subscription item that make up the invoice.

So I'll suggest to you do a filter and only present the items which type=invoiceitem

sonic crown
#

okay

#

thanks