stripe / stripe-python

Python library for the Stripe API.
https://stripe.com
MIT License
1.64k stars 418 forks source link

Can't expand invoice from quote #1359

Closed cedmt closed 1 month ago

cedmt commented 1 month ago

Describe the bug

When I try to expand the invoice in the quote, I still get null in the invoice field of the response. I believe I should get the invoice object. For example for :

stripe.Quote.finalize_quote(
                quote.id,
                expand=['invoice']
)

In my stripe dashboard I see that the library actually transformed my list into a object in the JSON. Could this be the cause of the bug or is it a problem with stripe itself?

Request POST body

{
  "expand": {
    "0": "invoice"
  }
}

To Reproduce

Create quote (with expand=['invoice']) Finalize quote (with expand=['invoice']) Retrieve quote (with expand=['invoice']) Quote will have invoice set to null in all cases.

Expected behavior

I expect the invoice field to not be null.

Code snippets

No response

OS

centos

Language version

Python 3.10.14

Library version

10.2.0 and 2.76.0

API version

2024-06-20

Additional context

No response

remi-stripe commented 1 month ago

The Invoice is created once you accept the Quote, not on finalization. So after you call the Accept Quote API the invoice property will be set and properly expandable. Since this is more an integration support question I'm going to close but don't hesitate to contact our support team if you have any follow-up questions: https://support.stripe.com/contact

cedmt commented 1 month ago

Thanks for the quick reply. I figured out that I could get what I need from expand=['line_items', 'computed.recurring.total_details.breakdown', 'computed.upfront.total_details.breakdown']

Leaving this here for future generations!