#apostolis_best-practices

1 messages · Page 1 of 1 (latest)

split brookBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1414516663247835147

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

misty basin
#

Hi! Looking in your query!

mystic cloak
#

From my tests the balance is only updated after an invoice is issued.

#

Hmm, I have subscribed the user to the product as well

#

So my understanding is that the grant would only be applied once the invoice is issued.

#

I assume the alternative is to issue invoices on demand, if that would help

split brookBOT
snow basin
#

👋 taking over for my colleague. Let me catch up.

mystic cloak
snow basin
#

this would give you the credit grant ID

mystic cloak
#

How do I get its remaining balance next?

snow basin
mystic cloak
#

That would only give back the amount after an invoice is issued

#

See my comment above:

#

In future, this will also take into account any usage that hasn’t yet been invoiced for a customer.

snow basin
#

until we add this, what you can do is to create a preview of the next invoice, and reduce the amount from the available_balance

#

you must only take the invoice items that refer to that meter of course

mystic cloak
#

I'll take a look thanks

snow basin
#

let me know if you need any more help

mystic cloak
#

Is there a way to know which grant is used in the preview invoice? E.g. I created 2 grants and I can see in the preview invoice:

#
        "pretax_credit_amounts": [
          {
            "amount": 24830,
            "credit_balance_transaction": null,
            "type": "credit_balance_transaction"
          },
          {
            "amount": 3000,
            "credit_balance_transaction": null,
            "type": "credit_balance_transaction"
          }
        ],
#

Is there any way to know which grant each entry is for?

snow basin
#

I don't think you could by directly looking at the invoice itself

split brookBOT
valid beacon
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!