Closed Taronyuu closed 6 years ago
Subscriptions aren't recurring invoices, they're web hooks.
I don't know why... but at the time of developing this there was a situation when the invoice item did not include the product id. However I just tested it and it works as expected. Is there any situation where this might occur?
My apologies for making this useless issue, thank you! :)
Not that I'm aware of.
I found the issue that was actually occurring, I'm hoping this makes a bit more sense.
This is a screenshot of the data from the invoice item that is taken from a recurring invoice:
This is a screenshot of the actual product used when creating the recurring invoice:
As you can see the IDs are different, I assume this is because you should be able to modify the product used in a recurring invoice without editing the original product. However, at this point there is no way to tell what was the original product from the API. Is it even possible to get the original product used here without keeping track of that by my own application?
We use the product_key field to match products
That is indeed what I'm doing at this point, I was just hoping that there was a better way. I'm afraid not.
Thank you for your quick responses and my apologies for screwing it up at the start! :)
Is there a way to get the ID of a product used in a recurring invoice after it has been created? Because as far as I know, no ID is returned when retrieving the recurring invoice.
Example:
Get all the plans:
Get a recurring subscription that uses a plan:
I can loop through all the invoice items and there is no way to relate them.
However, the
$products
do have the IDs included:At this point I'm using the product key to match them, but obviously this will fail if the product ever gets renamed. Am I missing something or is this indeed not possible?