#phillip_api

1 messages · Page 1 of 1 (latest)

eternal stoneBOT
#

👋 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/1293891885412122649

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

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.

brave wolf
#

Let me know if my question is clear. Might be a bit tricky to understand

#

This is how I report the usage (spent ad budget):

const meterEvent = await stripe.billing.meterEvents.create({
    event_name: 'ad_budget',
    payload: {
        value: spentAdBudgetLast7DaysInCentsIncludingFees.toString(),
        // @ts-ignore: invoice.customer is a string
        stripe_customer_id: invoiceOrSubscription.customer,
    },
})
golden merlin
brave wolf
#

Hi @golden merlin , I checked it out but it seems not to be possible to add more positions to the calculations at the bottom?

golden merlin
#

Yeah that's not possible I'm afraid

brave wolf
#

Okay no worries. And what about the invoice position of the usage subscription? It's a bit weird when we display 500 quantity / price per unit 0,01€. It would be better if we could display it like this:
"Ad Budget spent" / Taxes/ Amount: 5€"

Is this possible?

golden merlin
#

AFAIK, no. The invoices aren't really customisable to that extent unfortunately

brave wolf
#

Last question: Do you think I could listen to a invoice.created webhook, then intercept this invoice and create a new one via API as desired?

golden merlin
#

Yep, totally feasible! A lot of merchants do that who want more control over the invoice PDF

brave wolf
#

Okay, and when I do that the money will still be deducted from the credit card on file? (that belongs to the subscription)

golden merlin
#

To be clear you wouldn't create a new invoice via the API – you'd just use some API/tool to generate a PDF in the layout you want from the existing invoice

brave wolf
#

So I would need to generate the invoice myself, I can't just generate a new invoice via Stripe API?

Because I was hoping I could do something like:

  1. intercept the invoice with the weird layout (quantity 500 / price per unit 0,01€) and get it's data
  2. Generate a new invoice like Stripe.createInvoice({ item: 'Ad Budget', amount: 500 }) which will then be displayed similar to this one:
golden merlin
#

I mean, sure. But then you have the issue of duplicate invoices within Stripe which may cause accounting issues for you

#

And you're still stuck then within the confines of our invoice customisation. Where as you can in theory use some third-party tool to design the PDF however you need using the data from our API

brave wolf
#

Hm, yeah but it seems a bit overkill to implement a third party invoice tool.
If we could display this invoice position like "Ad Budget" / "Quantity 1" / "Amount": 5€ we would be already satisfied.

And I thought I might be able to "delete" / archive the invoice from the invoice.created hook and just create a new, final invoice... So there wont be any accounting issues

Does this make sense? 😅

Sounds hacky but it's the best possible solution I came up with.

golden merlin
#

Like I said, makes sense but if it was me and I wanted greater control over the PDF layout/design then I'd reach for another tool to handle that

brave wolf
#

Alright, I will keep that in mind... Even if I would rather not to, because another tool means additional complexity 😅

Thanks for your time! I have all the answers I needed