#_pablomn

1 messages · Page 1 of 1 (latest)

keen veldtBOT
mental onyx
#

Hi 👋 that approach won't work as metadata is not automatically copied from one object to related objects. So the Charges you're looking for won't have the metadata you're trying to query for so you won't see any results.

nimble belfry
#

Good morning Toby,

#

thanks for jumping in

#

what would you suggest?

mental onyx
#

I'm not quite sure yet. With the approach you're describing, it sounds like it will be possible to have Invoice Items on a single Invoice that have different metadata because their associated with different buildings. Is that a correct understanding?

nimble belfry
#

yeah. something like that.
I mean, we want to have
1 complete invoice that we send at the end of each month where we specify:

  • The Charge for the monthly subscription
  • The Charge for each extra "Service" that customer have used

so that's for the Customer while we also need to be able that the Owners of the buildings to be able what charges their Residents have

#

this invoice for example

mental onyx
#

The reason I'm asking, is because an Invoice creates a single Charge object. There isn't a unique Charge for each Invoice Item. So if you can mingle building Invoice Items on a single Invoice, then the Charge for that Invoice will also be comingled and you won't be able to associate a Charge with a specific building.

nimble belfry
#

ok well. Regarding the metadata: No, all invoice-items that I'm adding are always the same (buildingId: 1234), so I was hoping that somehow that metadata would be "copied" to the "Invoice" and with that also be copied to the "Charge"

mental onyx
#

Gotcha. That copying does not happen automatically, it is something you would need to build. My thought is that you can put the metadata that you want to reference on the Invoice object level. Then later when trying to find the related charge you can do a search for the Invoice you're looking for, and then follow the chain of objects to find the associated Charge for that Invoice.

nimble belfry
#

Thanks, ok I think that's something I was going to endup doing.
Now, I think I can retrieve the Upcoming Invoice (so I can add the buildingID metadata as soon as I add the InvoiceItem).. but I am not sure if I can UPDATE the upcomingInvoice with metadata... is that possible?

mental onyx
#

No, retrieving an upcoming Invoice only generates a preview of the next Invoice that will be generated for the Customer. You can't pass metadata there as the Invoice isn't actually created and those details won't persist.

nimble belfry
#

I see....

#

Interesting... and it makes much sense

#

so what would be a good approach if I want to somehow "flag" the invoice when it is ready to be "captured"

#

I meant to say: As soon as the invoice is ready / created

mental onyx
#

Are you making the requests to create the Invoices, or are they being automatically created for you by a Subscription?

nimble belfry
#

they are created automatically

mental onyx
nimble belfry
#

sweet. thanks. you're awesome

#

I'll take a look at that