#defekt7x - Subscription metadata
1 messages ยท Page 1 of 1 (latest)
The only way I can get this to work is to listen for a invoice.created webhook and do the following:
async onInvoiceCreate(event: Stripe.Event) {
const data = event.data.object as Stripe.Invoice;
const invoiceId = data.id;
await this.stripe.invoices.update(invoiceId, {
metadata: {
ItemCode: 'code here',
},
});
return true;
}
I'm not sure if that's ideal but let me know if there's anything that I'm missing here
Yeah that delay does not sound ideal.
Let me take a look
Okay so how are you interacting with the metadata in question?
What do you want it to do?
Our integration with Avalara will pick it up. I don't personally have to do anything with it, but Avalara looks for those values to determine which tax code to use
This is their docs page if it's helpful: https://help.avalara.com/FYHP/Avalara_for_Stripe/Connector_for_Stripe_Invoicing/Install_and_Configure_Avalara_AvaTax_for_Stripe_Invoicing/Understand_the_Stripe_Invoicing_metadata_that_impacts_AvaTax#Invoice_metadata
๐ Just hopping in here - give me a minute to catch up
When you set the metadata of the subscription I belive that will automatically copy over that metadata to the invoice line items.
Oh, really? I do have some subscription metadata already, and it's definitely not getting set on the invoice metadata but how do I check the invoice line items metadata? Is there a spot for that in the dashboard that I can easily see?
Can you send over the subscription ID? I can take a look real quick
Here's a subscription ID: in_1Knn7XCaXW5ee6rAC6b9iBru you'll see the ItemCode invoice metadata and that's because of the webhook that I created and posted above. If we're looking for subscription metadata that should get copied over to the invoice line items, then we're looking for 2 values: productId and trial_period_days
oh sorry that's an invoice ID
That's okay - that gives me enough to start looking
Yup, I can see on that Invoice that it has metadata set on the line items. You can see for yourself if you look at one of the invoice events like https://dashboard.stripe.com/test/events/evt_1Knn7aCaXW5ee6rATQnNzLE6 or if you re-retrieve the invoice
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Amazing. I'll add ItemCode to the main subscription metadata then. Thanks so much!
๐ happy to help!