#mikebm-product-metadata
1 messages · Page 1 of 1 (latest)
Where are they automatically being converted to prices?
Is there a reason you can't retrieve this as a SKU? https://stripe.com/docs/api/skus/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks for the info. Looking at how you may do this.
So the invoice itself is giving you price_123 IDs for each of these SKUs?
correct
I'm catching up and looking, one sec
Basically, when I fetch an invoice that had a lineItem of a sku on it with the new API, I get a price on it.
When I get this price object, it is basically what looks like a generated price.
Example: Invoice in_1JsES5Gl0Xvhgv1Gyhc4X66X
This is an invoice with a SKU on it.
It is returning a price with price ID of price_1JsES4Gl0Xvhgv1GH4sgxkrV
This price is missing all metadata from the original SKU.
Now, If I get the product referenced on that price. It has an ID of prod_KXJ4AejGiucmSu
This product is not the original product from the sku, but some archived product it created
Also missing all metadata from the original product
My solution to solving this was putting a skuID metadata on the line item. If this is there, then I know to load the original SKU instead of using the price on it.
@grizzled crown where did you use SKUs before? you didn't use it with Subscriptions did you?
but to unblock you, you'd need to copy the SKU metadata on to the Product or Price
We didn't use it with Subscriptions, only one time purchases
yeah, that's what has been the challenge. This price creation and product creation happens automatically
everywhere we reference a price from an invoice line item, I had to write code to first check metadata for 'skuID', and then call stripe API to fetch the sku. Otherwise, if that is missing, then I know I can rely on price on the invoice line item
basically, it became a nightmare to track all those places down. I have it solved, but was hoping we could just rely on the price that comes back from the invoice to have the metadata.
Ideally, the real solution is to stop using SKU's! hah
only one time purchases
with Orders API?
We create invoice line items, via InvoiceItem.create, then call Invoice.create, then pay() on the invoice
ah, I just answered my own question
It's just a text invoice line item, that's why.
We don't call setPrice on InvoiceItemCreateParams because we don't have a price to set
and so Stripe is apparently creating one for us
and InvoiceItemCreateParam's doesn't support setting a sku on it
yeah I assume you're using the price_data hash and Stripe creates an inline Price to "back" your InvoiceItems
Unfortunately, no. It's just taking the Description and creating a price for it with that nickname, then creates a product from that same Description with the same name.
🤷♂️
Thanks, and sorry for the confusion. I have a better understanding what's going on now.
It's unfortunate it auto creates a price, but we can work around that for now