#Benoît

1 messages · Page 1 of 1 (latest)

valid starBOT
worn blade
#

What SKU IDs do you mean here? Are you referring to our Product API or some custom metadata you provided?

#

Can you share an example event ID I can look at to see how your invoices are set up?

full fjord
#

Yes, thanks !

#

evt_1N6IejAYYvne95SHWg3NTVmg

valid starBOT
full fjord
#

The SKU ID used was "sku_G58sbWs4ZLPmkX", and it belongs to the product "prod_G58sARvgqnJmfV"

#

In the webhook payload, it seems it has created a new product : "prod_NrDp6Rb9cxZEgz". When i access this ID on the Stripe Dashboard, it says that this product has been archived

worn blade
#

Yes, because you're defined an ad-hoc amount for the items, a temporary price/product is created for you

full fjord
#

Ok, i see

#

Is there a way for mapping the "real" SKU to my invoice item ?

worn blade
#

That part of our product API is deprecated, but you can more finely control price and product data by creating those yourself and setting metadata to map to other attributes of your system. We recommend setting up explicit Prices to create invoice items with:
https://stripe.com/docs/invoicing/integration#create-prices

#

Create a price for a product, with optional metadata:

const price = await stripe.prices.create({
  product: '{{PRODUCT_ID}}',
  unit_amount: 1000,
  currency: 'usd',
  //  metadata: { ... },
});

Create invoice as you're doing already, then:

const invoiceItem = await stripe.invoiceItems.create({
  customer: '{{CUSTOMER_ID}}',
  price: '{{PRICE_ID}}',
  invoice: '{{INVOICE_ID}}',
});
full fjord
#

Could i use "metadata" in my invoiceItem object instead ?

tranquil orbit
#

Hello, 👋 catching up. Will check on if you can use that metadata here in a sec

#

Yes I think metadata on the invoice item could be a viable workaround if you don't want to shift all the way to individual prices.

full fjord
#

Hello ! Thanks !

#

I'm trying it. I'll let you know. I also think it will work

#

It worked ! Nice !
Thanks for this workaround 👍