#jen_stilletoz-metadata
1 messages · Page 1 of 1 (latest)
export function createInvoiceItem(cus, price, tax_rates,discount,product,taxAmount) {
return key.invoiceItems.create({
customer: cus,
price: price,
tax_rates: [tax_rates],
discounts: [discount],
metadata: {'membership': product, 'taxAmount': taxAmount}
})
.then(function (err, invoiceitem) {
if (err) {
return Promise.resolve(err); //does not work
}
return Promise.resolve(invoiceitem);
})
.catch((err) => {
return err;
});
}
this is my backend coding
this is the same way i did for createcustomer
So that would put metadata on the invoice item that is created but metadata is not usually copied between related objects
What object(s) do you want the metadata to be on that are related to that invoice item?
i want to pass custom info
the product they purchase and the taxamount
i want them as metadata
cause the client is setting up subscription manually so they want to know the product they purchase through metadata when they export to a csv file
On what object?
You should be able to do that, you just need to explicitly set it on the object you want it on
can you send me an example
I am still a bit unclear on where you want it to be set
Do you have an example ID of an object that you want this data do be on?
in payments in stripe
there's a section here as metadata
i want to pass this info
i followed this api
What is the ID of the object from the screenshot?
invoice id in_1K3urOAiIteXI5oGOxL7rxcR
Right, so that metadata is on the Invoice's items but not the invoice. To update the invoice, you will need to update the invoice itself https://stripe.com/docs/api/invoices/update
Unfortunately not with that call by itself. You'd want to update the invoice and then finalize it
Actually you can do it in either order because this is just metadata
what do you mean
@dusk rain taking over. Just try to call that API and see if it works!